diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2019-03-06 17:16:54 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2019-03-07 11:24:08 +0530 |
commit | abffb74716ba22a3c083776e38744b1e80640a02 (patch) | |
tree | 6432752def3f99c452cbea9e19b1022c5f1d8d38 /csarvalidation/README.md | |
parent | dac3233ad8afe25398655d61c11a7791e71bef38 (diff) |
Add README.md
Issue-ID: VNFSDK-276
Change-Id: I4917b8bf484feaf34a8bcdead677cd12cfb18057
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'csarvalidation/README.md')
-rw-r--r-- | csarvalidation/README.md | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/csarvalidation/README.md b/csarvalidation/README.md new file mode 100644 index 0000000..b6192f8 --- /dev/null +++ b/csarvalidation/README.md @@ -0,0 +1,90 @@ +CSAR Validation +=============== +Validates CSAR based on +* ETSI SOL004 specification +* ONAP VNFREQS & PNFREQS + +Every validation aspect is modeled as one test cases using Open Command Specification (OCS) 1.o +and by using Open CLI Platform (OCLIP), those test cases are executed similar to running commands + +SOL004 specification is implemented in org.onap.cvc.csar.CSARArchive class by supporting both the +options one with TOSCA-meta and another one without TOSCA-meta. This class could be used as SDK for +parsing the given CSAR. + +Every VNFREQS & PNFREQS is implemented as independent test case and following guidelines provide +required steps to add test cases. + +How to add new test cases? +-------------------------- +Assume that we want to address the VNFREQS R02454 as one test case. + +1. Create new OCS yaml vtp-validate-csar-r02454.yaml under src/main/resources/open-cli-schema folder + +NOTE: +Name of the file should be always in the form of vtp-validate-csar-<VNFREWQS-Number>.yaml +Inside this YAML, add name as csar-validate-<VNFREWQS-Number>. +Remaining section would be same as other existing OCS YAML. + +2. Add corresponding implementation class under src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR02454.java + +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 + +4. Implement the run() method in this class by using the below code snippet + + 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(); + + // *********** ADD REQUIRED VALIDATION ************ + + 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())); + } + } + +5. Add the new class into src/main/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand file + +6. Run the test cases at src/test/java/org/onap/cvc/csar/CsarValidatorTest and verify that it picked up the new test cases. + +How to configure vnfreqs.properties +----------------------------------- + +1. To enable the given vnfreqs, edit vnfreqs.enabled with required VNFREQS number + +2. To ignore certian errors, use errors.ignored. + +How to run CSAR validation +-------------------------- +Follow the setups given below to run as csar-validate command + +1. Install OCLIP (wget https://raw.githubusercontent.com/onap/cli/master/deployment/zip/installer/install-latest.sh | sh) + +2. Run mvn clean install on this project, and copy the target/validation-csar-x.y.z.jar in to $OPEN_CLI_HOME/lib + +3. Run oclip --product onap-vtp csar-validate --csar <CSAR path> + +Contact +------- +Kanagaraj.Manickam@huawei.com
\ No newline at end of file |