diff options
author | 2019-03-28 17:50:06 +0530 | |
---|---|---|
committer | 2019-03-28 18:31:52 +0530 | |
commit | 4827d14388d40fdffd95d560ae6500604aff578f (patch) | |
tree | c374ba32a0fc1bd62816be142e4c21de8ed2f66e /csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR09467.java | |
parent | d34c02725d33d4b9cfa3ac70742b47be65b31066 (diff) |
Update test cases to fix the TOSCA issues
Issue-ID: VNFSDK-352
Change-Id: I058dbe23a02244b90f3e9d58c136960249c7ffdf
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR09467.java')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR09467.java | 36 |
1 files changed, 27 insertions, 9 deletions
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 index cbacc35..407d872 100644 --- 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 @@ -1,5 +1,5 @@ /* - * Copyright 2017 Huawei Technologies Co., Ltd. +x * 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. @@ -28,13 +28,20 @@ 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) { + public static class CSARErrorEntryMissingVDUCompute extends CSARErrorEntryMissing { + public CSARErrorEntryMissingVDUCompute(String defYaml, String entry) { super(entry, defYaml); this.setCode("0x1000"); } } + public static class CSARErrorEntryMissingVDUVirtualStorage extends CSARErrorEntryMissing { + public CSARErrorEntryMissingVDUVirtualStorage(String defYaml, String entry) { + super(entry, defYaml); + this.setCode("0x1001"); + } + } + @Override protected void validateCSAR(CSARArchive csar) throws Exception { try(FileInputStream ipStream = new FileInputStream(csar.getDefinitionYamlFile())) { @@ -42,23 +49,34 @@ public class VTPValidateCSARR09467 extends VTPValidateCSARBase { yaml = (Map<String, ?>) yaml.get("topology_template"); Map<String, ?> nodeTmpls = (Map<String,?>) yaml.get("node_templates"); - boolean vlExist = false; + boolean computeExist = false; + boolean storageExist = 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; + computeExist = true; + + } + + if (type.equalsIgnoreCase("tosca.nodes.nfv.VDU.VirtualStorage")) { + storageExist = true; + } } } - if (!vlExist) - this.errors.add(new CSARErrorEntryMissingFlavor( + if (!computeExist) + this.errors.add(new CSARErrorEntryMissingVDUCompute( csar.getDefinitionYamlFile().getName(), - "Flavor")); + "VDU Compute")); + + if (!storageExist) + this.errors.add(new CSARErrorEntryMissingVDUVirtualStorage( + csar.getDefinitionYamlFile().getName(), + "VirtualStorage")); } } |