diff options
Diffstat (limited to 'csarvalidation')
83 files changed, 2355 insertions, 1261 deletions
diff --git a/csarvalidation/README.md b/csarvalidation/README.md index b6192f8..5da08dd 100644 --- a/csarvalidation/README.md +++ b/csarvalidation/README.md @@ -1,7 +1,7 @@ CSAR Validation =============== Validates CSAR based on -* ETSI SOL004 specification +* ETSI SOL004 & SOL001 specification * ONAP VNFREQS & PNFREQS Every validation aspect is modeled as one test cases using Open Command Specification (OCS) 1.o @@ -31,7 +31,7 @@ NOTE: Add @OnapCommandSchema(schema = "vtp-validate-csar-r02454.yaml") annotation to the class, where the schema will have OCS YAML file name -3. Add required CSARError inside this class and set unique error code using CSARError::setSubCode() method +3. Add required CSARError inside this class and set unique error code using CSARError::setCode() method 4. Implement the run() method in this class by using the below code snippet diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java index fdef030..24cef0e 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java @@ -135,9 +135,9 @@ public class CSARArchive { this.code = code; } - private String code; + private String vnfreqNo; - private String subCode; + private String code; protected String message = ""; @@ -177,6 +177,14 @@ public class CSARArchive { this.lineNumber = lineNumber; } + public String getVnfreqNo() { + return this.vnfreqNo; + } + + public void setVnfreqNo(String no) { + this.vnfreqNo = no; + } + public String toString() { try { return new ObjectMapper().writeValueAsString(this); @@ -185,22 +193,6 @@ public class CSARArchive { return "{}"; } } - - public String getSubCode() { - return subCode; - } - - public void setSubCode(String subCode) { - this.subCode = subCode; - } - - public String getErrorCode() { - if (this.getSubCode() != null) { - return this.getSubCode(); - } - - return this.getCode(); - } } public static class CSARErrorInvalidEntry extends CSARError { @@ -217,6 +209,11 @@ public class CSARArchive { public static class CSARErrorInvalidEntryValue extends CSARError { public CSARErrorInvalidEntryValue(String entry, String file, int lineNo, String message, String validValues) { + this(entry, file, message, validValues); + this.lineNumber = lineNo; + } + + public CSARErrorInvalidEntryValue(String entry, String file, String message, String validValues) { super("0x1001"); this.message = "Invalid value. Entry [" + entry + "]"; if (validValues != null) { @@ -228,7 +225,6 @@ public class CSARArchive { } this.file = file; - this.lineNumber = lineNo; } } @@ -242,6 +238,12 @@ public class CSARArchive { this.file = file; this.lineNumber = lineNo; } + + public CSARErrorEntryMissing(String entry, String file) { + super("0x1002"); + this.message = "Missing. Entry [" + entry + "]"; + this.file = file; + } } @@ -317,7 +319,7 @@ public class CSARArchive { definitionYaml, -1, null); - this.setSubCode("0x001"); + this.setCode("0x001"); } } @@ -329,7 +331,7 @@ public class CSARArchive { null, Entry_Definition__tosca_definitions_version__simple_1_1); - this.setSubCode("0x0002"); + this.setCode("0x0002"); } } @@ -341,7 +343,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x0003"); + this.setCode("0x0003"); } } @@ -353,7 +355,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x0004"); + this.setCode("0x0004"); } } @@ -365,7 +367,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x0005"); + this.setCode("0x0005"); } } @@ -377,7 +379,7 @@ public class CSARArchive { definitionYaml + " does not exist", null); - this.setSubCode("0x0006"); + this.setCode("0x0006"); } } @@ -389,7 +391,7 @@ public class CSARArchive { manifest + " does not exist", null); - this.setSubCode("0x0007"); + this.setCode("0x0007"); } } @@ -401,7 +403,7 @@ public class CSARArchive { logs + " does not exist", null); - this.setSubCode("0x0008"); + this.setCode("0x0008"); } } @@ -413,7 +415,7 @@ public class CSARArchive { tests + " folder does not exist", null); - this.setSubCode("0x0009"); + this.setCode("0x0009"); } } @@ -425,7 +427,7 @@ public class CSARArchive { license + " does not exist", null); - this.setSubCode("0x000a"); + this.setCode("0x000a"); } } @@ -437,7 +439,7 @@ public class CSARArchive { certificate + " does not exist", null); - this.setSubCode("0x000b"); + this.setCode("0x000b"); } } @@ -448,7 +450,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x000c"); + this.setCode("0x000c"); } } @@ -459,7 +461,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x000d"); + this.setCode("0x000d"); } } @@ -470,7 +472,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x000e"); + this.setCode("0x000e"); } } @@ -481,7 +483,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x000f"); + this.setCode("0x000f"); } } @@ -492,7 +494,7 @@ public class CSARArchive { -1, null); - this.setSubCode("0x0010"); + this.setCode("0x0010"); } } @@ -504,7 +506,7 @@ public class CSARArchive { "Only one definition YAML should be provided at the root of the archive", fileNames); - this.setSubCode("0x0011"); + this.setCode("0x0011"); } } @@ -517,7 +519,7 @@ public class CSARArchive { "Only one manifest MF file should be provided at the root of the archive", fileNames); - this.setSubCode("0x0012"); + this.setCode("0x0012"); } } @@ -530,7 +532,7 @@ public class CSARArchive { definitionYaml + ".mf", //fix the name part manifest); - this.setSubCode("0x0013"); + this.setCode("0x0013"); } } @@ -542,7 +544,7 @@ public class CSARArchive { "Only one certificates file should be provided at the root of the archive", fileNames); - this.setSubCode("0x0014"); + this.setCode("0x0014"); } } @@ -555,7 +557,7 @@ public class CSARArchive { definitionYaml + ".cert", //fix the name part certificate); - this.setSubCode("0x0015"); + this.setCode("0x0015"); } } diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java b/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java index c480332..6a8e3bd 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java @@ -210,7 +210,7 @@ public class VTPValidateCSAR extends OnapCommand { resultSOL004.setPassed(true); for (CSARError error: resultSOL004.getErrors()) { - if (!ignoreCodes.contains(error.getErrorCode())) { + if (!ignoreCodes.contains(error.getCode())) { resultSOL004.setPassed(false); overallPass = false; break; @@ -236,7 +236,7 @@ public class VTPValidateCSAR extends OnapCommand { result.setPassed(true); for (CSARError error: result.getErrors()) { - if (!ignoreCodes.contains(error.getErrorCode())) { + if (!ignoreCodes.contains(error.getCode())) { result.setPassed(false); overallPass = false; break; diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR26881.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java index e9efd38..d07884d 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR26881.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java @@ -22,60 +22,47 @@ import java.util.List; import org.onap.cli.fw.cmd.OnapCommand; import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; import org.onap.cvc.csar.CSARArchive; import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * R-26881: VNF artifacts - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r26881.yaml") -public class VTPValidateCSARR26881 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR26881.class); +public abstract class VTPValidateCSARBase extends OnapCommand { + protected static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARBase.class); - public static class CSARErrorEntryMissingArtifactsNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingArtifactsNotFound() { - super( - "Artifacts", - CSARArchive.CSAR_Archive, - -1, - "The VNF provider MUST provide the binaries and images needed to instantiate the VNF (VNF and VNFC images)."); - this.setSubCode("r26881-0x1000"); - } - } + protected abstract void validateCSAR(CSARArchive csar) throws Exception; + + protected abstract String getVnfReqsNo(); + + protected List<CSARError> errors = new ArrayList<>(); @Override protected void run() throws OnapCommandException { //Read the input arguments String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); + //execute try { CSARArchive csar = new CSARArchive(); csar.init(path); csar.parse(); - if (!csar.getFileFromCsar("artifacts").exists()) { - errors.add(new CSARErrorEntryMissingArtifactsNotFound()); - } + this.validateCSAR(csar); csar.cleanup(); } catch (Exception e) { - LOG.error("R-26881: ", e); + LOG.error(this.getVnfReqsNo() + ": Failed to validate CSAR" , e); throw new OnapCommandExecutionFailed(e.getMessage()); } - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); + for (CSARError e: this.errors) { + e.setVnfreqNo(this.getVnfReqsNo()); + this.getResult().getRecordsMap().get("code").getValues().add(this.getVnfReqsNo() + "-" + e.getCode()); this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); } + + this.getResult().setOutput(this.errors); } } diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR02454.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR02454.java deleted file mode 100644 index c77db76..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR02454.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.yaml.snakeyaml.Yaml; - -/** - * R-02454: The VNF MUST support the existence of multiple major/minor - * versions of the VNF software and/or sub-components and interfaces that - * support both forward and backward compatibility to be transparent to the - * Service Provider usage. - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r02454.yaml") -public class VTPValidateCSARR02454 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR02454.class); - - public static class CSARErrorEntryMissingSwImage extends CSARErrorEntryMissing { - public CSARErrorEntryMissingSwImage(String defYaml, String entry) { - super( - entry, - defYaml, - -1, - "The VNF MUST support the existence of multiple major/minor versions " - + "of the VNF software and/or sub-components and interfaces that support both " - + "forward and backward compatibility to be transparent to the Service Provider usage."); - this.setSubCode("r02454-0x1000"); - } - } - - private List<CSARError> validate(CSARArchive csar) throws FileNotFoundException, IOException { - List<CSARError> errors = new ArrayList<>(); - - try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { - Map<String, ?> yaml = (Map<String, ?>) new Yaml().load(ipStream); - yaml = (Map<String, ?>) yaml.get("topology_template"); - Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); - - boolean vlExist = false; - - for (Object nodeO: nodeTmpls.values()) { - Map<String, ?> node = (Map<String, ?>) nodeO; - if (node.containsKey("type")) { - String type = (String)node.get("type"); - if (type.equalsIgnoreCase("tosca.artifacts.nfv.SwImage")) { - vlExist = true; - break; - } - } - } - - if (!vlExist) - errors.add(new CSARErrorEntryMissingSwImage( - csar.getDefinitionYamlFile().getName(), - "Software Image")); - } - - return errors; - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - errors = this.validate(csar); - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-02454: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR04298.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR04298.java deleted file mode 100644 index 3c2ffd5..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR04298.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-04298: VNF provider MUST provider their testing scripts to support testing. - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r04298.yaml") -public class VTPValidateCSARR04298 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR04298.class); - - public static class CSARErrorEntryMissingTestFolderNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingTestFolderNotFound() { - super( - "Tests", - CSARArchive.CSAR_Archive, - -1, - "The VNF provider MUST provide their testing scripts to support testing."); - this.setSubCode("r04298-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (csar.getTestsFolder() == null) { - errors.add(new CSARErrorEntryMissingTestFolderNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-04298: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR07879.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR07879.java deleted file mode 100644 index 8f975cc..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR07879.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-07879: playbooks directory - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r07879.yaml") -public class VTPValidateCSARR07879 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR07879.class); - - public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingAnsiblePlaybookNotFound() { - super( - "playbooks", - CSARArchive.CSAR_Archive, - -1, - "The VNF Package MUST include all relevant playbooks to ONAP to be loaded on the Ansible Server."); - this.setSubCode("r07879-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (!csar.getFileFromCsar("playbooks").exists()) { - errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-07879: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR09467.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR09467.java deleted file mode 100644 index 8ce3a23..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR09467.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.yaml.snakeyaml.Yaml; - -/** - * R-09467: The VNF MUST utilize only NCSP standard compute flavors. [5] - compute, virtual storage - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r09467.yaml") -public class VTPValidateCSARR09467 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR09467.class); - - public static class CSARErrorEntryMissingFlavor extends CSARErrorEntryMissing { - public CSARErrorEntryMissingFlavor(String defYaml, String entry) { - super( - entry, - defYaml, - -1, - "The VNF MUST utilize only NCSP standard compute flavors. [5] - compute, virtual storage"); - this.setSubCode("r09467-0x1000"); - } - } - - private List<CSARError> validate(CSARArchive csar) throws FileNotFoundException, IOException { - List<CSARError> errors = new ArrayList<>(); - - try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { - Map<String, ?> yaml = (Map<String, ?>) new Yaml().load(ipStream); - yaml = (Map<String, ?>) yaml.get("topology_template"); - Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); - - boolean vlExist = false; - - for (Object nodeO: nodeTmpls.values()) { - Map<String, ?> node = (Map<String, ?>) nodeO; - if (node.containsKey("type")) { - String type = (String)node.get("type"); - if (type.equalsIgnoreCase("tosca.nodes.nfv.VDU.Compute")) { - vlExist = true; - break; - } - } - } - - if (!vlExist) - errors.add(new CSARErrorEntryMissingFlavor( - csar.getDefinitionYamlFile().getName(), - "Flavor")); - } - - return errors; - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - errors = this.validate(csar); - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-09467: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR13390.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR13390.java deleted file mode 100644 index 6c44ee6..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR13390.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-r13390: cookbooks directory - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r13390.yaml") -public class VTPValidateCSARR13390 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR13390.class); - - public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingAnsiblePlaybookNotFound() { - super( - "cookbooks", - CSARArchive.CSAR_Archive, - -1, - "The VNF provider MUST provide cookbooks to be loaded on the appropriate Chef Server."); - this.setSubCode("r13390-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (!csar.getFileFromCsar("playbooks").exists()) { - errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-13390: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR23823.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR23823.java deleted file mode 100644 index f8a0385..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR23823.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-04298: VNF provider MUST provider their testing scripts to support testing. - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r23823.yaml") -public class VTPValidateCSARR23823 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR23823.class); - - public static class CSARErrorEntryMissingCertificatesNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingCertificatesNotFound() { - super( - "Certificates", - CSARArchive.CSAR_Archive, - -1, - "The VNF Package MUST include appropriate credentials so that ONAP can interact with the Chef Server"); - this.setSubCode("r23823-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (csar.getCertificatesFile() == null) { - errors.add(new CSARErrorEntryMissingCertificatesNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-23823: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR27310.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR27310.java deleted file mode 100644 index 7b2e25a..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR27310.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-27310: Manifest file - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r27310.yaml") -public class VTPValidateCSARR27310 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR27310.class); - - public static class CSARErrorEntryMissingChefArtifactsNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingChefArtifactsNotFound() { - super( - "cookbooks", - CSARArchive.CSAR_Archive, - -1, - "The VNF Package MUST include all relevant Chef artifacts (roles/cookbooks/recipes) " - + "required to execute VNF actions requested by ONAP for loading on appropriate Chef Server."); - this.setSubCode("r27310-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (!csar.getFileFromCsar("cookbooks").exists()) { - errors.add(new CSARErrorEntryMissingChefArtifactsNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-27310: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR35851.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR35851.java deleted file mode 100644 index 068b372..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR35851.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.yaml.snakeyaml.Yaml; - -/** - * R-35851: The VNF Package MUST include VNF topology that describes - * basic network and application connectivity internal and external to the VNF - * including Link type, KPIs, Bandwidth, latency, jitter, QoS - * (if applicable) for each interface - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r35851.yaml") -public class VTPValidateCSARR35851 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR35851.class); - - public static class CSARErrorEntryMissingDefinitionYamlTopology extends CSARErrorEntryMissing { - public CSARErrorEntryMissingDefinitionYamlTopology(String defYaml, String entry) { - super( - entry, - defYaml, - -1, - "The VNF Package MUST include VNF topology that describes basic " - + "network and application connectivity internal and external to " - + "the VNF including Link type, KPIs, Bandwidth, latency, jitter, " - + "QoS (if applicable) for each interface"); - this.setSubCode("r35851-0x1000"); - } - } - - private List<CSARError> validate(CSARArchive csar) throws FileNotFoundException, IOException { - List<CSARError> errors = new ArrayList<>(); - - try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { - Map<String, ?> yaml = (Map<String, ?>) new Yaml().load(ipStream); - yaml = (Map<String, ?>) yaml.get("topology_template"); - Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); - - boolean vlExist = false; - - for (Object nodeO: nodeTmpls.values()) { - Map<String, ?> node = (Map<String, ?>) nodeO; - if (node.containsKey("type")) { - String type = (String)node.get("type"); - if (type.equalsIgnoreCase("tosca.nodes.nfv.VnfVirtualLink")) { - vlExist = true; - break; - } - } - } - - if (!vlExist) - errors.add(new CSARErrorEntryMissingDefinitionYamlTopology( - csar.getDefinitionYamlFile().getName(), - "Topology VL")); - } - - return errors; - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - errors = this.validate(csar); - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-35851: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR40293.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR40293.java deleted file mode 100644 index eaf0710..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR40293.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-r40293: playbooks directory - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r40293.yaml") -public class VTPValidateCSARR40293 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR40293.class); - - public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingAnsiblePlaybookNotFound() { - super( - "playbooks", - CSARArchive.CSAR_Archive, - -1, - "The VNF MUST make available (or load on VNF Ansible Server) playbooks that conform to the ONAP requirement."); - this.setSubCode("r40293-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (!csar.getFileFromCsar("playbooks").exists()) { - errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-40293: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR43958.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR43958.java deleted file mode 100644 index 10ae1c0..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR43958.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-43958: Test reports - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r43958.yaml") -public class VTPValidateCSARR43958 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR43958.class); - - public static class CSARErrorEntryMissingTestReportNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingTestReportNotFound() { - super( - "Tests/report.txt", - CSARArchive.CSAR_Archive, - -1, - "The VNF Package MUST include documentation describing the tests that were conducted by the VNF provider and the test results."); - this.setSubCode("r43958-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (!csar.getFileFromCsar("Tests/report.txt").exists()) { - errors.add(new CSARErrorEntryMissingTestReportNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-43958: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR66070.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR66070.java deleted file mode 100644 index 8d51c94..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR66070.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-66070: VNF provider details - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r66070.yaml") -public class VTPValidateCSARR66070 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR66070.class); - - public static class CSARErrorEntryVNFProviderDetailsNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryVNFProviderDetailsNotFound() { - super( - "VNF Vendor details", - CSARArchive.TOSCA_Metadata + " or " + CSARArchive.TOSCA_Metadata__TOSCA_Meta__Entry_Definitions + " file", - -1, - "The VNF Package MUST include VNF Identification Data to uniquely identify the" - + " resource for a given VNF provider. The identification data must include: " - + "an identifier for the VNF, the name of the VNF as was given by the VNF provider, " - + "VNF description, VNF provider, and version."); - this.setSubCode("r66070-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (csar.getVendorName() == null || - csar.getVersion() == null) { - errors.add(new CSARErrorEntryVNFProviderDetailsNotFound()); - } - //do the validation - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-66070: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR77707.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR77707.java deleted file mode 100644 index 9549e67..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR77707.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-77707: Manifest file - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r77707.yaml") -public class VTPValidateCSARR77707 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR77707.class); - - public static class CSARErrorEntryMissingDefinitionNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingDefinitionNotFound() { - super( - "TOSCA definition or Tosca.Meata", - CSARArchive.CSAR_Archive, - -1, - "The VNF provider MUST include a Manifest File that contains a list " - + "of all the components in the VNF package."); - this.setSubCode("r77707-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (csar.getToscaMeta().getEntryDefinitionYaml() == null || - csar.getDefinitionYamlFile() == null || !csar.getDefinitionYamlFile().exists()) { - errors.add(new CSARErrorEntryMissingDefinitionNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-77707: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR77786.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR77786.java deleted file mode 100644 index 1fa5a1f..0000000 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR77786.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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.onap.cvc.csar.cc; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.cli.fw.cmd.OnapCommand; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.schema.OnapCommandSchema; -import org.onap.cvc.csar.CSARArchive; -import org.onap.cvc.csar.CSARArchive.CSARError; -import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * R-77786: cookbooks directory - */ -@OnapCommandSchema(schema = "vtp-validate-csar-r77786.yaml") -public class VTPValidateCSARR77786 extends OnapCommand { - private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSARR77786.class); - - public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { - public CSARErrorEntryMissingAnsiblePlaybookNotFound() { - super( - "cookbooks", - CSARArchive.CSAR_Archive, - -1, - "The VNF Package MUST include all relevant cookbooks to be loaded on the ONAP Chef Server."); - this.setSubCode("r77786-0x1000"); - } - } - - @Override - protected void run() throws OnapCommandException { - //Read the input arguments - String path = (String) getParametersMap().get("csar").getValue(); - List<CSARError> errors = new ArrayList<>(); - //execute - try { - CSARArchive csar = new CSARArchive(); - csar.init(path); - csar.parse(); - - if (!csar.getFileFromCsar("playbooks").exists()) { - errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); - } - - csar.cleanup(); - } catch (Exception e) { - LOG.error("R-77786: ", e); - throw new OnapCommandExecutionFailed(e.getMessage()); - } - - this.getResult().setOutput(errors); - - //set the result - for (CSARError e: errors) { - this.getResult().getRecordsMap().get("code").getValues().add(e.getCode()); - this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage()); - this.getResult().getRecordsMap().get("file").getValues().add(e.getFile()); - this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber())); - } - } -} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR09467.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR09467.java new file mode 100644 index 0000000..cbacc35 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR09467.java @@ -0,0 +1,69 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import java.io.FileInputStream; +import java.util.Map; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; +import org.yaml.snakeyaml.Yaml; + +@OnapCommandSchema(schema = "vtp-validate-csar-r09467.yaml") +public class VTPValidateCSARR09467 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingFlavor extends CSARErrorEntryMissing { + public CSARErrorEntryMissingFlavor(String defYaml, String entry) { + super(entry, defYaml); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { + Map<String, ?> yaml = (Map<String, ?>) new Yaml().load(ipStream); + yaml = (Map<String, ?>) yaml.get("topology_template"); + Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); + + boolean vlExist = false; + + for (Object nodeO: nodeTmpls.values()) { + Map<String, ?> node = (Map<String, ?>) nodeO; + if (node.containsKey("type")) { + String type = (String)node.get("type"); + if (type.equalsIgnoreCase("tosca.nodes.nfv.VDU.Compute")) { + vlExist = true; + break; + } + } + } + + if (!vlExist) + this.errors.add(new CSARErrorEntryMissingFlavor( + csar.getDefinitionYamlFile().getName(), + "Flavor")); + } + } + + @Override + protected String getVnfReqsNo() { + return "R09467"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR15837.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR15837.java new file mode 100644 index 0000000..e89bb85 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR15837.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r15837.yaml") +public class VTPValidateCSARR15837 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R15837"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR17852.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR17852.java new file mode 100644 index 0000000..96181fd --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR17852.java @@ -0,0 +1,34 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r17852.yaml") +public class VTPValidateCSARR17852 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + } + + @Override + protected String getVnfReqsNo() { + return "R17852"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR32155.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR32155.java new file mode 100644 index 0000000..fac261a --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR32155.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r32155.yaml") +public class VTPValidateCSARR32155 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R32155"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35851.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35851.java new file mode 100644 index 0000000..6c7b3a6 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35851.java @@ -0,0 +1,70 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import java.io.FileInputStream; +import java.util.Map; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; +import org.yaml.snakeyaml.Yaml; + +@OnapCommandSchema(schema = "vtp-validate-csar-r35851.yaml") +public class VTPValidateCSARR35851 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingDefinitionYamlTopology extends CSARErrorEntryMissing { + public CSARErrorEntryMissingDefinitionYamlTopology(String defYaml, String entry) { + super(entry, defYaml); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { + Map<String, ?> yaml = (Map<String, ?>) new Yaml().load(ipStream); + yaml = (Map<String, ?>) yaml.get("topology_template"); + Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); + + boolean vlExist = false; + + for (Object nodeO: nodeTmpls.values()) { + Map<String, ?> node = (Map<String, ?>) nodeO; + if (node.containsKey("type")) { + String type = (String)node.get("type"); + if (type.equalsIgnoreCase("tosca.nodes.nfv.VnfVirtualLink")) { + vlExist = true; + break; + } + } + } + + if (!vlExist) + this.errors.add(new CSARErrorEntryMissingDefinitionYamlTopology( + csar.getDefinitionYamlFile().getName(), + "Topology VL")); + } + + } + + @Override + protected String getVnfReqsNo() { + return "R35851"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java new file mode 100644 index 0000000..1b442cb --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r35854.yaml") +public class VTPValidateCSARR35854 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R35854"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR46527.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR46527.java new file mode 100644 index 0000000..bc680a3 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR46527.java @@ -0,0 +1,35 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r46527.yaml") +public class VTPValidateCSARR46527 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + } + + @Override + protected String getVnfReqsNo() { + return "R46527"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR54356.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR54356.java new file mode 100644 index 0000000..02f7b0d --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR54356.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r54356.yaml") +public class VTPValidateCSARR54356 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R54356"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java new file mode 100644 index 0000000..0f4f64d --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r65486.yaml") +public class VTPValidateCSARR65486 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R65486"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR67895.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR67895.java new file mode 100644 index 0000000..a45ba5e --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR67895.java @@ -0,0 +1,34 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r67895.yaml") +public class VTPValidateCSARR67895 extends VTPValidateCSARBase { + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R67895"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR95321.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR95321.java new file mode 100644 index 0000000..fd9b2d6 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR95321.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol001; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r95321.yaml") +public class VTPValidateCSARR95321 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + } + + @Override + protected String getVnfReqsNo() { + return "R95321"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123.java new file mode 100644 index 0000000..8fc216b --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123.java @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-01123.yaml") +public class VTPValidateCSARR01123 extends VTPValidateCSARBase { + + public static class CSARErrorEntryVNFProviderDetailsNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryVNFProviderDetailsNotFound() { + super("VNF Vendor details", + CSARArchive.TOSCA_Metadata + " or " + CSARArchive.TOSCA_Metadata__TOSCA_Meta__Entry_Definitions + " file"); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (csar.getVendorName() == null || + csar.getVersion() == null) { + errors.add(new CSARErrorEntryVNFProviderDetailsNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R01123"; + } + + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR02454.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR02454.java new file mode 100644 index 0000000..14998f5 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR02454.java @@ -0,0 +1,69 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import java.io.FileInputStream; +import java.util.Map; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; +import org.yaml.snakeyaml.Yaml; + +@OnapCommandSchema(schema = "vtp-validate-csar-r02454.yaml") +public class VTPValidateCSARR02454 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingSwImage extends CSARErrorEntryMissing { + public CSARErrorEntryMissingSwImage(String defYaml, String entry) { + super(entry, defYaml); + this.setCode("0x1000"); + } + } + + @Override + protected String getVnfReqsNo() { + return "R02454"; + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { + Map<String, ?> yaml = (Map<String, ?>) new Yaml().load(ipStream); + yaml = (Map<String, ?>) yaml.get("topology_template"); + Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); + + boolean vlExist = false; + + for (Object nodeO: nodeTmpls.values()) { + Map<String, ?> node = (Map<String, ?>) nodeO; + if (node.containsKey("type")) { + String type = (String)node.get("type"); + if (type.equalsIgnoreCase("tosca.artifacts.nfv.SwImage")) { + vlExist = true; + break; + } + } + } + + if (!vlExist) + this.errors.add(new CSARErrorEntryMissingSwImage( + csar.getDefinitionYamlFile().getName(), + "Software Image")); + } + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java new file mode 100644 index 0000000..6503c54 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r04298.yaml") +public class VTPValidateCSARR04298 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingTestFolderNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingTestFolderNotFound() { + super("Tests", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + if (csar.getTestsFolder() == null) { + this.errors.add(new CSARErrorEntryMissingTestFolderNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R04298"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR07879.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR07879.java new file mode 100644 index 0000000..ad46620 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR07879.java @@ -0,0 +1,45 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r07879.yaml") +public class VTPValidateCSARR07879 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingAnsiblePlaybookNotFound() { + super("playbooks", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("playbooks").exists()) { + this.errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R07879"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java new file mode 100644 index 0000000..31298fa --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARError; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaDefinitionMetadataTemplateName; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaDefinitionNotFound; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaMetaDefinition; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r10087.yaml") +public class VTPValidateCSARR10087 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + + for (CSARError e : csar.getErrors()) { + if (e instanceof CSARErrorEntryMissingToscaMetaDefinition || + e instanceof CSARErrorEntryMissingToscaDefinitionNotFound || + e instanceof CSARErrorEntryMissingToscaDefinitionMetadataTemplateName) { + this.errors.add(e); + } + } + } + + @Override + protected String getVnfReqsNo() { + return "R10087"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java new file mode 100644 index 0000000..17c3018 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java @@ -0,0 +1,45 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r13390.yaml") +public class VTPValidateCSARR13390 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingAnsiblePlaybookNotFound() { + super("cookbooks", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("playbooks").exists()) { + this.errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R13390"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR21322.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR21322.java new file mode 100644 index 0000000..9c0a791 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR21322.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r21322.yaml") +public class VTPValidateCSARR21322 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingTestFolderNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingTestFolderNotFound() { + super("Tests", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (csar.getTestsFolder() == null) { + this.errors.add(new CSARErrorEntryMissingTestFolderNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R21322"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR23823.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR23823.java new file mode 100644 index 0000000..6919f28 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR23823.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r23823.yaml") +public class VTPValidateCSARR23823 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingCertificatesNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingCertificatesNotFound() { + super("Certificates", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (csar.getCertificatesFile() == null) { + errors.add(new CSARErrorEntryMissingCertificatesNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R23823"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java new file mode 100644 index 0000000..e036ce6 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r26881.yaml") +public class VTPValidateCSARR26881 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingArtifactsNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingArtifactsNotFound() { + super("Artifacts", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("artifacts").exists()) { + errors.add(new CSARErrorEntryMissingArtifactsNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R26881"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26885.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26885.java new file mode 100644 index 0000000..97f2d3c --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26885.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r26885.yaml") +public class VTPValidateCSARR26885 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingArtifactImage extends CSARErrorEntryMissing { + public CSARErrorEntryMissingArtifactImage() { + super("Artifacts/VNF_Image.bin", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("Artifacts/VNF_Image.bin").exists()) { + this.errors.add(new CSARErrorEntryMissingArtifactImage()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R26885"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR27310.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR27310.java new file mode 100644 index 0000000..4c2210a --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR27310.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r27310.yaml") +public class VTPValidateCSARR27310 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingChefArtifactsNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingChefArtifactsNotFound() { + super("cookbooks", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("cookbooks").exists()) { + errors.add(new CSARErrorEntryMissingChefArtifactsNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R27310"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR40293.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR40293.java new file mode 100644 index 0000000..7173156 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR40293.java @@ -0,0 +1,45 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r40293.yaml") +public class VTPValidateCSARR40293 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingAnsiblePlaybookNotFound() { + super("playbooks", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("playbooks").exists()) { + errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R40293"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR40820.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR40820.java new file mode 100644 index 0000000..99f180b --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR40820.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r40820.yaml") +public class VTPValidateCSARR40820 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingLicenseTerm extends CSARErrorEntryMissing { + public CSARErrorEntryMissingLicenseTerm() { + super("Licenses/License_term.txt", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("Licenses/License_term.txt").exists()) { + this.errors.add(new CSARErrorEntryMissingLicenseTerm()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R40820"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR43958.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR43958.java new file mode 100644 index 0000000..0d42628 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR43958.java @@ -0,0 +1,45 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r43958.yaml") +public class VTPValidateCSARR43958 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingTestReportNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingTestReportNotFound() { + super("Tests/report.txt", CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("Tests/report.txt").exists()) { + this.errors.add(new CSARErrorEntryMissingTestReportNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R43958"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR51347.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR51347.java new file mode 100644 index 0000000..1a39e14 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR51347.java @@ -0,0 +1,43 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARError; +import org.onap.cvc.csar.CSARArchive.CSARErrorInvalidEntryValueToscaDefinitionVersion; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r51347.yaml") +public class VTPValidateCSARR51347 extends VTPValidateCSARBase { + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + for (CSARError e : csar.getErrors()) { + if (e instanceof CSARErrorInvalidEntryValueToscaDefinitionVersion) { + this.errors.add(e); + break; + } + } + } + + @Override + protected String getVnfReqsNo() { + return "R51347"; + } + +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR66070.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR66070.java new file mode 100644 index 0000000..1d5c3c5 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR66070.java @@ -0,0 +1,47 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r66070.yaml") +public class VTPValidateCSARR66070 extends VTPValidateCSARBase { + + public static class CSARErrorEntryVNFProviderDetailsNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryVNFProviderDetailsNotFound() { + super("VNF Vendor details", + CSARArchive.TOSCA_Metadata + " or " + CSARArchive.TOSCA_Metadata__TOSCA_Meta__Entry_Definitions + " file"); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (csar.getVendorName() == null || + csar.getVersion() == null) { + errors.add(new CSARErrorEntryVNFProviderDetailsNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R66070"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77707.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77707.java new file mode 100644 index 0000000..13ac502 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77707.java @@ -0,0 +1,47 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r77707.yaml") +public class VTPValidateCSARR77707 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingDefinitionNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingDefinitionNotFound() { + super("TOSCA definition or Tosca.Meata", + CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (csar.getToscaMeta().getEntryDefinitionYaml() == null || + csar.getDefinitionYamlFile() == null || !csar.getDefinitionYamlFile().exists()) { + errors.add(new CSARErrorEntryMissingDefinitionNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R77707"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java new file mode 100644 index 0000000..efb258b --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissing; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r77786.yaml") +public class VTPValidateCSARR77786 extends VTPValidateCSARBase { + + public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { + public CSARErrorEntryMissingAnsiblePlaybookNotFound() { + super("cookbooks", + CSARArchive.CSAR_Archive); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getFileFromCsar("playbooks").exists()) { + errors.add(new CSARErrorEntryMissingAnsiblePlaybookNotFound()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R77786"; + } +} diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR87234.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR87234.java new file mode 100644 index 0000000..6400012 --- /dev/null +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR87234.java @@ -0,0 +1,48 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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.onap.cvc.csar.cc.sol004; + +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARErrorInvalidEntryValue; +import org.onap.cvc.csar.cc.VTPValidateCSARBase; + +@OnapCommandSchema(schema = "vtp-validate-csar-r87234.yaml") +public class VTPValidateCSARR87234 extends VTPValidateCSARBase { + + public static class CSARErrorInvalidEntryValueNonToscaMetaNotSupported extends CSARErrorInvalidEntryValue { + public CSARErrorInvalidEntryValueNonToscaMetaNotSupported() { + super("CSAR Mode", "CSAR Archive", + "Only " + CSARArchive.Mode.WITH_TOSCA_META_DIR.name() + " mode is supported", + CSARArchive.Mode.WITH_TOSCA_META_DIR.name()); + this.setCode("0x1000"); + } + } + + @Override + protected void validateCSAR(CSARArchive csar) throws Exception { + if (!csar.getToscaMeta().getMode().name().equalsIgnoreCase(CSARArchive.Mode.WITH_TOSCA_META_DIR.name())) { + this.errors.add(new CSARErrorInvalidEntryValueNonToscaMetaNotSupported()); + } + } + + @Override + protected String getVnfReqsNo() { + return "R87234"; + } + +} diff --git a/csarvalidation/src/main/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand b/csarvalidation/src/main/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand index 5bcd3cc..d868756 100644 --- a/csarvalidation/src/main/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand +++ b/csarvalidation/src/main/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand @@ -13,17 +13,33 @@ # limitations under the License. org.onap.cvc.csar.VTPValidateCSAR -org.onap.cvc.csar.cc.VTPValidateCSARR02454 -org.onap.cvc.csar.cc.VTPValidateCSARR04298 -org.onap.cvc.csar.cc.VTPValidateCSARR07879 -org.onap.cvc.csar.cc.VTPValidateCSARR09467 -org.onap.cvc.csar.cc.VTPValidateCSARR13390 -org.onap.cvc.csar.cc.VTPValidateCSARR23823 -org.onap.cvc.csar.cc.VTPValidateCSARR26881 -org.onap.cvc.csar.cc.VTPValidateCSARR27310 -org.onap.cvc.csar.cc.VTPValidateCSARR35851 -org.onap.cvc.csar.cc.VTPValidateCSARR40293 -org.onap.cvc.csar.cc.VTPValidateCSARR43958 -org.onap.cvc.csar.cc.VTPValidateCSARR66070 -org.onap.cvc.csar.cc.VTPValidateCSARR77707 -org.onap.cvc.csar.cc.VTPValidateCSARR77786
\ No newline at end of file +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR17852 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR09467 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR15837 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR32155 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR35851 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR35854 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR46527 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR54356 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR65486 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR67895 +org.onap.cvc.csar.cc.sol001.VTPValidateCSARR95321 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR01123 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR02454 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR04298 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR07879 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR13390 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR10087 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR21322 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR23823 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR26881 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR26885 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR27310 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR40293 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR40820 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR43958 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR51347 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR66070 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR77707 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR77786 +org.onap.cvc.csar.cc.sol004.VTPValidateCSARR87234 diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-hot.yaml b/csarvalidation/src/main/resources/open-cli-schema/hot/vtp-validate-hot.yaml index 8eb0ef5..8eb0ef5 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-hot.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/hot/vtp-validate-hot.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-casablanca.yaml b/csarvalidation/src/main/resources/open-cli-schema/obsolute/vtp-validate-csar-casablanca.yaml index 878eb67..878eb67 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-casablanca.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/obsolute/vtp-validate-csar-casablanca.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r09467.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r09467.yaml index c43fb6a..c43fb6a 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r09467.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r09467.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r15837.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r15837.yaml new file mode 100644 index 0000000..586f4af --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r15837.yaml @@ -0,0 +1,54 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r15837 + +description: | + Major TOSCA Types specified in ETSI NFV-SOL001 standard draft. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r17852.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r17852.yaml new file mode 100644 index 0000000..6626765 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r17852.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r17852 + +description: | + The VNFD MAY include TOSCA/YAML definitions that are not part of NFV Profile. If provided, + these definitions MUST comply with TOSCA Simple Profile in YAML v.1.2. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r32155.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r32155.yaml new file mode 100644 index 0000000..ac60d8b --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r32155.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r32155 + +description: | + The VNFD provided by VNF vendor may use the below described TOSCA interface types. + An on-boarding entity (ONAP SDC) MUST support them.. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r35851.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r35851.yaml index 1e024c0..1e024c0 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r35851.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r35851.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r35854.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r35854.yaml new file mode 100644 index 0000000..4a181e8 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r35854.yaml @@ -0,0 +1,57 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r35854 + +description: | + The VNF Descriptor (VNFD) provided by VNF vendor MUST comply with TOSCA/YAML based Service template + for VNF descriptor specified in ETSI NFV-SOL001. + Note: As the ETSI NFV-SOL001 is work in progress the below tables summarizes the TOSCA definitions + agreed to be part of current version of NFV profile and that VNFD MUST comply with in ONAP Release 2+ Requirements. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r46527.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r46527.yaml new file mode 100644 index 0000000..951f562 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r46527.yaml @@ -0,0 +1,69 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r17852 + +description: | + A VNFD is a deployment template which describes a VNF in terms of deployment and operational + behavior requirements. It contains virtualized resources (nodes) requirements as well as connectivity + and interfaces requirements and MUST comply with info elements specified in ETSI GS NFV-IFA 011. + The main parts of the VNFD are the following: + VNF topology: it is modeled in a cloud agnostic way using virtualized containers and their connectivity. + Virtual Deployment Units (VDU) describe the capabilities of the virtualized containers, such as virtual + CPU, RAM, disks; their connectivity is modeled with VDU Connection Point Descriptors (VduCpd), + Virtual Link Descriptors (VnfVld) and VNF External Connection Point Descriptors (VnfExternalCpd); + VNF deployment aspects: they are described in one or more deployment flavours, including configurable + parameters, instantiation levels, placement constraints (affinity / antiaffinity), minimum and maximum + VDU instance numbers. Horizontal scaling is modeled with scaling aspects and the respective scaling levels + in the deployment flavours; + Note: The deployment aspects (deployment flavour etc.) are postponed for future ONAP releases. + VNF lifecycle management (LCM) operations: describes the LCM operations supported per deployment flavour, + and their input parameters; Note, thatthe actual LCM implementation resides in a different layer, namely + referring to additional template artifacts. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r54356.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r54356.yaml new file mode 100644 index 0000000..ae724a5 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r54356.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r54356 + +description: | + Data types used by NFV node and is based on TOSCA/YAML constructs specified in draft GS NFV-SOL 001. + The node data definitions/attributes used in VNFD MUST comply. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r65486.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r65486.yaml new file mode 100644 index 0000000..4c3a04b --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r65486.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r65486 + +description: | + The VNFD MUST comply with ETSI GS NFV-SOL001 document endorsing the above mentioned NFV Profile and + maintaining the gaps with the requirements specified in ETSI GS NFV-IFA011 standard. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r67895.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r67895.yaml new file mode 100644 index 0000000..f7fc466 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r67895.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r67895 + +description: | + The VNFD provided by VNF vendor may use the below described TOSCA capabilities. + An on-boarding entity (ONAP SDC) MUST support them. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r95321.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r95321.yaml new file mode 100644 index 0000000..e605d0f --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol001/vtp-validate-csar-r95321.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r95321 + +description: | + The VNFD provided by VNF vendor may use the below described TOSCA relationships. + An on-boarding entity (ONAP SDC) MUST support them. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r01123.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r01123.yaml new file mode 100644 index 0000000..043fff2 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r01123.yaml @@ -0,0 +1,60 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r01123 + +description: | + The VNF package Manifest file MUST contain: VNF package meta-data, a list of all artifacts + (both internal and external) entry’s including their respected URI’s, an algorithm to calculate + a digest and a digest result calculated on the content of each artifacts, as specified in + ETSI GS NFV-SOL004. The VNF Package MUST include VNF Identification Data to uniquely + identify the resource for a given VNF provider. The identification data must include: + an identifier for the VNF, the name of the VNF as was given by the VNF provider, VNF + description, VNF provider, and version. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r02454.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r02454.yaml index 03d395d..03d395d 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r02454.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r02454.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r04298.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r04298.yaml index ecbdbcc..ecbdbcc 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r04298.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r04298.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r07879.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r07879.yaml index 3118f89..3118f89 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r07879.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r07879.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r10087.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r10087.yaml new file mode 100644 index 0000000..3428842 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r10087.yaml @@ -0,0 +1,56 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r10087 + +description: | + The VNF package MUST contain all standard artifacts as specified in ETSI GS NFV-SOL004 including + Manifest file, VNFD (or Main TOSCA/YAML based Service Template) and other optional artifacts. + CSAR Manifest file as per SOL004 - for example ROOT\ MainServiceTemplate.mf + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r13390.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r13390.yaml index de07c97..de07c97 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r13390.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r13390.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r21322.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r21322.yaml new file mode 100644 index 0000000..684c876 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r21322.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r21322 + +description: | + The VNF provider MUST provide their testing scripts to support testing as specified in ETSI NFV-SOL004 - + Testing directory in CSAR. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r23823.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r23823.yaml index e504da1..e504da1 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r23823.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r23823.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r26881.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r26881.yaml index 1a7a19b..1a7a19b 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r26881.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r26881.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r26885.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r26885.yaml new file mode 100644 index 0000000..5209792 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r26885.yaml @@ -0,0 +1,57 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r10087 + +description: | + The VNF provider MUST provide the binaries and images needed to instantiate the VNF (VNF and VNFC images) either as: + Local artifact in CSAR: ROOT\Artifacts\ VNF_Image.bin + externally referred (by URI) artifact in Manifest file (also may be referred by VNF Descriptor) + Note: Currently, ONAP doesn’t have the capability of Image management, we upload the image into VIM/VNFM manually. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r27310.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r27310.yaml index 156c20d..156c20d 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r27310.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r27310.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r40293.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r40293.yaml index 2e0e652..2e0e652 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r40293.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r40293.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r40820.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r40820.yaml new file mode 100644 index 0000000..fd4a4ea --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r40820.yaml @@ -0,0 +1,55 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r40820 + +description: | + The VNF provider MUST enumerate all of the open source licenses their VNF(s) incorporate. CSAR License + directory as per ETSI SOL004. for example ROOT\Licenses\ License_term.txt + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r43958.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r43958.yaml index aaef65a..aaef65a 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r43958.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r43958.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r51347.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r51347.yaml new file mode 100644 index 0000000..45d8e92 --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r51347.yaml @@ -0,0 +1,57 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r51347 + +description: | + The VNF package MUST be arranged as a CSAR archive as specified in TOSCA Simple Profile in YAML 1.2. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + metadata: + keyword: MUST + introduced: casablanca + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r66070.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r66070.yaml index d5bd847..d5bd847 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r66070.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r66070.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r77707.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r77707.yaml index 7f213d7..7f213d7 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r77707.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r77707.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r77786.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r77786.yaml index 787225a..787225a 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar-r77786.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r77786.yaml diff --git a/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r87234.yaml b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r87234.yaml new file mode 100644 index 0000000..01d45bf --- /dev/null +++ b/csarvalidation/src/main/resources/open-cli-schema/sol004/vtp-validate-csar-r87234.yaml @@ -0,0 +1,56 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# 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. + +open_cli_schema_version: 1.0 + +name: csar-validate-r87234 + +description: | + The VNF package provided by a VNF vendor MAY be either with TOSCA-Metadata directory (CSAR Option 1) + or without TOSCA-Metadata directory (CSAR Option 2) as specified in ETSI GS NFV-SOL004. On-boarding entity + (ONAP SDC) must support both options. + +info: + product: onap-vtp + version: 1.0 + service: validation + author: ONAP VTP Team onap-discuss@lists.onap.org + +parameters: + - name: csar + description: CSAR file path + long_option: csar + short_option: b + type: binary + is_optional: false + +results: + direction: landscape + attributes: + - name: code + description: Error code + scope: short + type: string + - name: message + description: Error message + scope: short + type: string + - name: file + description: File in which error occured + scope: short + type: string + - name: line-no + description: Line no at which error occured + scope: short + type: string diff --git a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar.yaml b/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar.yaml index 329122a..709af93 100644 --- a/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar.yaml +++ b/csarvalidation/src/main/resources/open-cli-schema/vtp-validate-csar.yaml @@ -16,7 +16,7 @@ open_cli_schema_version: 1.0 name: csar-validate -description: Validate CSAR package formats compliants to ETSI SOL004 and VNFREQS +description: Validate CSAR package formats compliants to ETSI SOL004, SOL001 and VNFREQS info: product: onap-vtp diff --git a/csarvalidation/src/main/resources/vnfreqs.properties b/csarvalidation/src/main/resources/vnfreqs.properties index 878b7f0..dde122f 100644 --- a/csarvalidation/src/main/resources/vnfreqs.properties +++ b/csarvalidation/src/main/resources/vnfreqs.properties @@ -1,3 +1,3 @@ -vnfreqs.enabled=r02454,r04298,r07879,r09467,r13390,r23823,r26881,r27310,r35851,r40293,r43958,r66070,r77707,r77786 +vnfreqs.enabled=r02454,r04298,r07879,r09467,r13390,r23823,r26881,r27310,r35851,r40293,r43958,r66070,r77707,r77786,r87234,r10087,r21322,r26885,r40820,r35854,r65486,r17852,r46527,r15837,r54356,r67895,r95321,r32155,r01123,r51347 # ignored all chef and ansible related tests errors.ignored=0x1005,0x1006,r07879-0x1000,r13390-0x1000,r27310-0x1000,r40293-0x1000,r77786-0x1000
\ No newline at end of file diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java index a925674..96a66c3 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java @@ -34,9 +34,7 @@ public class PnfManifestParserTest { @Before public void setUp() throws URISyntaxException, IOException { - String fileName = PnfManifestParserTest.class.getClassLoader().getResource("pnf/MainServiceTemplate.mf") - .toURI().getPath(); - pnfManifestParser = PnfManifestParser.getInstance(fileName); + pnfManifestParser = PnfManifestParser.getInstance("./src/test/resources/pnf/MainServiceTemplate.mf"); } @Test |