diff options
author | Gao Weitao <victor.gao@huawei.com> | 2019-03-18 06:06:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-18 06:06:56 +0000 |
commit | cb83eef8ba8f479576a07d08cf9b5c48b737778c (patch) | |
tree | f6e9ab3c8d92bb2a559b058260a366d6deff2087 /csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004 | |
parent | d8f859223948dcad8022ff72b794854305d493c8 (diff) | |
parent | 022ea3db9854c9dadd9ac986dcba06ae9be8fd63 (diff) |
Merge changes I4ddadfa3,I8fc71d45,I1d9f8d29
* changes:
Update readme with SOL001
Add SOL001 test case place holder
Fix the csarvalidation build failure on windows
Diffstat (limited to 'csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004')
19 files changed, 897 insertions, 0 deletions
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"; + } + +} |