Add new SOL004 ETSI Validator
[sdc.git] / openecomp-be / lib / openecomp-common-lib / src / main / java / org / openecomp / sdc / common / errors / Messages.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.common.errors;
18
19 import lombok.AllArgsConstructor;
20 import lombok.Getter;
21
22 @AllArgsConstructor
23 @Getter
24 public enum Messages {
25     CANT_LOAD_HEALING_CLASS("Can't load healing class %s."),
26
27     VERSION_UPGRADE("Item %s is of old version. A check out was made in order to get new " +
28         "functionalities"),
29
30     PACKAGE_PROCESS_ERROR("Could not process package '%s'"),
31     PACKAGE_INVALID_EXTENSION("Invalid package '%s' extension. Expecting %s."),
32     PACKAGE_EMPTY_ERROR("The given package is empty '%s'"),
33     PACKAGE_PROCESS_INTERNAL_PACKAGE_ERROR("Could not process internal package '%s'"),
34     PACKAGE_INVALID_ERROR("Invalid package content '%s'"),
35     PACKAGE_MISSING_INTERNAL_PACKAGE("Missing expected internal package"),
36     COULD_NOT_READ_MANIFEST_FILE("Could not read manifest file: %s [%s]"),
37     INVALID_ZIP_FILE("Invalid zip file"),
38     INVALID_CSAR_FILE("Invalid csar file"),
39     CSAR_FILE_NOT_FOUND("Each CSAR file must contain %s file."),
40     CSAR_DIRECTORIES_NOT_ALLOWED("Directory : %s , is not allowed."),
41     CSAR_FILES_NOT_ALLOWED("File : %s , are not allowed."),
42     MANIFEST_INVALID_LINE("Manifest contains invalid line: %s: %s"),
43     MANIFEST_START_METADATA("Manifest must starts with 'metadata:'"),
44     MANIFEST_NO_METADATA("Manifest must contain metadata"),
45     MANIFEST_NO_SOURCES("Manifest must contain Source"),
46     MANIFEST_METADATA_MISSING_ENTRY("Manifest metadata missing entry %s"),
47     MANIFEST_INVALID_NAME("Manifest file %s and TOSCA definitions file %s must have the same name"),
48     MANIFEST_INVALID_EXT("Manifest file must have extension \".mf\" "),
49     MANIFEST_METADATA_INVALID_ENTRY("Manifest metadata should only have pnf or vnf entries"),
50     MANIFEST_METADATA_INVALID_ENTRY1("Invalid Manifest metadata entry: '%s'."),
51     MANIFEST_METADATA_DUPLICATED_ENTRY("Duplicated Manifest metadata entry: '%s'."),
52     MANIFEST_METADATA_UNEXPECTED_ENTRY_TYPE(
53         "Manifest metadata should have either pnf or vnf entries, not both together"),
54     MANIFEST_INVALID_PNF_METADATA("%s TOSCA.meta file is applicable for VF only"),
55     MANIFEST_INVALID_NON_MANO_KEY("Invalid non mano key '%s'"),
56     MANIFEST_EMPTY_NON_MANO_KEY("Expecting a 'Source' entry for the non mano key '%s'"),
57     MANIFEST_EMPTY_NON_MANO_SOURCE("Empty non mano source"),
58     MANIFEST_EXPECTED_HASH_ENTRY("Expected Hash entry"),
59     MANIFEST_EXPECTED_HASH_VALUE("Expected Hash entry value"),
60     MANIFEST_EXPECTED_SOURCE_PATH("Expected Source entry path"),
61     MANIFEST_EXPECTED_ALGORITHM_VALUE("Expected Algorithm entry value"),
62     MANIFEST_EXPECTED_ALGORITHM_BEFORE_HASH("Expected 'Algorithm' entry before 'Hash' entry"),
63     MANIFEST_EXPECTED_SIGNATURE_VALUE("Expected 'Signature' entry value"),
64     MANIFEST_EXPECTED_CERTIFICATE_VALUE("Expected 'Certificate' entry value"),
65     MANIFEST_EXPECTED_SIGNATURE_BEFORE_CERTIFICATE("Expected 'Signature' entry before 'Certificate' entry"),
66     MANIFEST_DUPLICATED_CMS_SIGNATURE("Duplicated CMS signature"),
67     MANIFEST_SIGNATURE_DUPLICATED("Duplicated manifest signature"),
68     MANIFEST_SIGNATURE_LAST_ENTRY("The manifest signature must be the last entry of the manifest."),
69     MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT("Manifest metadata must only have the required number [%s] of "
70         + "entries"),
71     MANIFEST_EMPTY("The manifest is empty"),
72     MANIFEST_ERROR_WITH_LINE("%s;%nAt line %s: '%s'."),
73     MANIFEST_PARSER_INTERNAL("Invalid manifest file"),
74     MANIFEST_UNEXPECTED_ERROR("An unexpected error occurred while validating manifest '%s': %s"),
75     MANIFEST_VALIDATION_HELM_IS_BASE_MISSING("Definition of 'isBase' is missing in %d charts."),
76     MANIFEST_VALIDATION_HELM_IS_BASE_NOT_UNIQUE("More than one chart is marked as 'isBase'."),
77     MANIFEST_VALIDATION_HELM_IS_BASE_NOT_SET("None of charts is marked as 'isBase'."),
78     METADATA_PARSER_INTERNAL("Invalid Metadata file"),
79     METADATA_MISSING_OPTIONAL_FOLDERS("Missing folder %s in package"),
80     METADATA_UNSUPPORTED_ENTRY("Following entry not supported in TOSCA.meta %s"),
81     METADATA_INVALID_VERSION("Invalid entry %s value %s"),
82     METADATA_INVALID_VALUE("Invalid value %s in TOSCA.meta file"),
83     METADATA_MISSING_ENTRY("TOSCA.meta file in TOSCA-metadata directory missing entry %s"),
84     METADATA_NO_ENTRY_DEFINITIONS("TOSCA.meta must contain Entry Definitions"),
85     METADATA_INVALID_ENTRY_DEFINITIONS("TOSCA.meta must contain key:value entries"),
86
87     EMPTY_SW_INFORMATION_NON_MANO_ERROR(
88         "Non-mano Software Information artifact was declared in the manifest, but not provided"),
89     UNIQUE_SW_INFORMATION_NON_MANO_ERROR("Only one software information non-mano artifact is allowed. "
90         + "Found %s."),
91     INVALID_SW_INFORMATION_NON_MANO_ERROR("Invalid software information non-mano artifact: '%s'"),
92     INCORRECT_SW_INFORMATION_NON_MANO_ERROR(
93         "Incorrect software information non-mano artifact. The software version information is missing "
94             + "or it has one or more incorrect software version entries: '%s'"),
95     EMPTY_ONAP_CNF_HELM_NON_MANO_ERROR(
96         "Non-mano onap_cnf_helm artifact was declared in the manifest, but not provided"),
97     UNIQUE_ONAP_CNF_HELM_NON_MANO_ERROR("Only one onap_cnf_helm non-mano artifact is allowed. "
98         + "Found %s."),
99     FAILED_TO_VALIDATE_METADATA("Failed to validate metadata file"),
100     ARTIFACT_INVALID_SIGNATURE("Invalid signature '%s' provided for artifact '%s'"),
101     ARTIFACT_SIGNATURE_VALIDATION_ERROR(
102       "Could not validate signature '%s' provided for artifact '%s' with certificate '%s': %s"),
103     FAILED_TO_TRANSLATE_ZIP_FILE("Failed to translate zip file"),
104     ZIP_NOT_EXIST("Zip file doesn't exist"),
105
106     PERMISSIONS_ERROR("Permissions Error. The user does not have permission to perform this action."),
107     PERMISSIONS_OWNER_ERROR("Permissions Error. Only one owner is allowed."),
108
109     ENTITY_NOT_FOUND("Incorrect item/version details provided."),
110     SUB_ENTITY_NOT_FOUND("Incorrect sub entity details provided."),
111     FAILED_TO_SYNC("Non existing version cannot be synced."),
112     FAILED_TO_PUBLISH_OUT_OF_SYNC("Publish is not allowed since the version status is Out of sync"),
113
114     DELETE_VSP_ERROR("VSP has been certified and cannot be deleted."),
115     DELETE_VLM_ERROR("VLM has been certified and cannot be deleted."),
116
117     ZIP_SHOULD_NOT_CONTAIN_FOLDERS("Zip file should not contain folders"),
118     VES_ZIP_SHOULD_CONTAIN_YML_ONLY(
119         "Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML files" +
120             " (using .yaml/.yml extensions)"),
121     MANIFEST_NOT_EXIST("Manifest doesn't exist"),
122     MANIFEST_NOT_FOUND("Manifest file %s referenced in TOSCA.meta does not exist"),
123     FILE_TYPE_NOT_LEGAL("File type not legal as data for other file"),
124     MODULE_IN_MANIFEST_NO_YAML("Module '%s', has no yaml file reference"),
125     NO_MODULES_IN_MANIFEST("At least one Base/Module must be defined \n"),
126     MODULE_IN_MANIFEST_VOL_ENV_NO_VOL("Module '%s', has volume Env. reference with no Volume " +
127         "reference"),
128     ILLEGAL_MANIFEST("Illegal Manifest"),
129     NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST("no %s file was uploaded or file doesn't exist"),
130     MAPPING_OBJECTS_FAILURE("Failed to map object %s to %s. Exception message: %s"),
131     MORE_THEN_ONE_VOL_FOR_HEAT("heat contains more then one vol. selecting only first vol"),
132     FILE_LOAD_CONTENT_ERROR("Failed to load file '%s' content"),
133     CREATE_MANIFEST_FROM_ZIP("cannot create manifest from the attached zip file"),
134     CANDIDATE_PROCESS_FAILED("Candidate zip file process failed"),
135     FOUND_UNASSIGNED_FILES("cannot process zip since it has unassigned files"),
136     GENERATED_ARTIFACT_IN_USE("Artifact with file name %s is generated by SDC. "
137         + "Please remove this artifact from manifest and zip files"),
138
139     /* Monitor uploads related errors*/
140     ILLEGAL_MONITORING_ARTIFACT_TYPE("Illegal monitoring artifact type for component id %s, vsp id " +
141         "%s"),
142     /* manifest errors*/
143     MISSING_FILE_IN_ZIP("Missing file in zip"),
144     MISSING_FILE_IN_MANIFEST("Missing file in manifest"),
145     MISSING_FILE_NAME_IN_MANIFEST("Missing file name in manifest"),
146     MISSING_NESTED_FILE("Missing nested file - %s"),
147     MISSING_ARTIFACT("Missing artifact - %s"),
148     MISSING_MANIFEST_SOURCE("%s artifact %s referenced in manifest file does not exist"),
149     MISSING_MANIFEST_REFERENCE("'%s' artifact is not being referenced in manifest file"),
150     MISSING_METADATA_FILES("%s file referenced in TOSCA.meta does not exist"),
151     WRONG_HEAT_FILE_EXTENSION("Wrong HEAT file extension - %s"),
152     WRONG_ENV_FILE_EXTENSION("Wrong ENV file extension - %s"),
153     INVALID_MANIFEST_FILE("invalid manifest file"),
154     INVALID_FILE_TYPE("Missing or Unknown file type in Manifest"),
155     ENV_NOT_ASSOCIATED_TO_HEAT("ENV file must be associated to a HEAT file"),
156     CSAR_MANIFEST_FILE_NOT_EXIST("CSAR manifest file does not exist"),
157     CSAR_FAILED_TO_READ("CSAR file is not readable"),
158     TOSCA_PARSING_FAILURE("Invalid tosca file. Error code : %s, Error message : %s/"),
159
160     /*definition errors*/
161     MISSING_DEFINITION_FILE("Definition file %s referenced in TOSCA.meta does not exist"),
162     MISSING_IMPORT_FILE("Package must contain the referenced import file '%s'"),
163     MISSING_MAIN_DEFINITION_FILE("Package must contain the given main definition file '%s'"),
164     INVALID_IMPORT_STATEMENT("Definition file '%s' contains an invalid import statement: '%s'"),
165     INVALID_YAML_EXTENSION("Expecting yaml or yml extension for file: %s"),
166
167     /* content errors*/
168     INVALID_YAML_FORMAT("Invalid YAML format: %s"),
169     INVALID_YAML_FORMAT_1("Invalid YAML format in file '%s'. Format error:%n%s"),
170     INVALID_YAML_FORMAT_REASON("Invalid YAML format Problem - [%s]"),
171     EMPTY_YAML_FILE("empty yaml"),
172     EMPTY_YAML_FILE_1("The yaml file '%s' is empty"),
173     GENERAL_YAML_PARSER_ERROR("general parser error"),
174     GENERAL_HEAT_PARSER_ERROR("general parser error"),
175     INVALID_HEAT_FORMAT_REASON("Invalid HEAT format problem - [%s]"),
176     MISSING_RESOURCE_IN_DEPENDS_ON("a Missing resource in depend On, Missing Resource ID [%s]"),
177     REFERENCED_PARAMETER_NOT_FOUND("Referenced parameter - %s - not found, used in resource [%s]"),
178     GET_ATTR_NOT_FOUND("get_attr attribute not found, Attribute name [%s], Resource ID [%s]"),
179     MISSING_PARAMETER_IN_NESTED(
180         "Referenced parameter not found in nested file - %s, parameter name [%s], Resource ID [%s]"),
181     NESTED_LOOP("Nested files loop - %s"),
182     MORE_THAN_ONE_BIND_FROM_NOVA_TO_PORT("Resource Port %s exceed allowed relations from NovaServer"),
183     SERVER_NOT_DEFINED_FROM_NOVA("Missing server group definition - %s, %s"),
184     WRONG_POLICY_IN_SERVER_GROUP("Wrong policy in server group - %s"),
185     MISSING_IMAGE_AND_FLAVOR("Missing both Image and Flavor in NOVA Server, Resource ID [%s]"),
186     ENV_INCLUDES_PARAMETER_NOT_IN_HEAT("Env file %s includes a parameter not in HEAT - %s"),
187     PARAMETER_ENV_VALUE_NOT_ALIGN_WITH_TYPE("Parameter env value %s not align with type"),
188     PARAMETER_DEFAULT_VALUE_NOT_ALIGN_WITH_TYPE(
189         "Parameter - %s default value not align with type %s"),
190     INVALID_RESOURCE_TYPE("A resource has an invalid or unsupported type - %s, Resource ID [%s]"),
191     ARTIFACT_FILE_NOT_REFERENCED("Artifact file is not referenced."),
192     RESOURCE_NOT_IN_USE("%s not in use, Resource Id [%s]"),
193     PORT_NO_BIND_TO_ANY_NOVA_SERVER("Port not bind to any NOVA Server, Resource Id [%s]"),
194     INVALID_GET_RESOURCE_SYNTAX(
195         "invalid get_resource syntax is in use - %s , get_resource"
196             + " function should get the resource id of the referenced resource"),
197     INVALID_RESOURCE_GROUP_TYPE(
198         "OS::Heat::ResourceGroup resource with resource_def which is not pointing to "
199             + "nested heat file is not supported, Resource ID [%s], resource_def type [%s]"),
200     WRONG_VALUE_TYPE_ASSIGNED_NESTED_INPUT(
201         "Wrong value type assigned to a nested input parameter, nested resource [%s],"
202             + " property name [%s], nested file [%s]"),
203     NOVA_NAME_IMAGE_FLAVOR_NOT_CONSISTENT(
204         "Nova Server naming convention in image, flavor and name properties is not "
205             + "consistent, Resource ID [%s]"),
206     RESOURCE_GROUP_INVALID_INDEX_VAR(
207         "Wrong value assigned to a ResourceGroup index_var property (functions are not allowed"
208             + " but only strings), Resource ID [%s]"),
209     CONTRAIL_2_IN_USE("Contrail 2.x deprecated resource is in use, Resource ID [%s]"),
210
211     /* warnings */
212     REFERENCED_RESOURCE_NOT_FOUND("Referenced resource - %s not found"),
213     MISSING_GET_PARAM("Missing get_param in %s, Resource Id [%s]"),
214
215     /*OPENECOMP Guide lines*/
216     MISSING_NOVA_SERVER_METADATA("Missing Nova Server Metadata property, Resource ID [%s]"),
217     MISSING_NOVA_SERVER_VNF_ID("Missing VNF_ID in Metadata property, Resource ID [%s]"),
218     MISSING_NOVA_SERVER_VF_MODULE_ID("Missing VF_MODULE_ID in Metadata property, Resource id [%s]"),
219     NETWORK_PARAM_NOT_ALIGNED_WITH_GUIDE_LINE(
220         "Network Parameter Name not aligned with Guidelines, Parameter Name [%s] Resource ID [%s]"),
221     MISSIN_BASE_HEAT_FILE(
222         "Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources"),
223     MULTI_BASE_HEAT_FILE("Multi Base HEAT. Expected only one. Files %s."),
224     RESOURCE_NOT_DEFINED_IN_OUTPUT(
225         "Resource is not defined as output and thus cannot be Shared, Resource ID [%s]"),
226     RESOURCE_CONNECTED_TO_TWO_EXTERNAL_NETWORKS_WITH_SAME_ROLE(
227         "A resource is connected twice to the same network role, Network Role [%s],"
228             + " Resource ID [%s]"),
229     VOLUME_HEAT_NOT_EXPOSED("Volume is not defined as output and thus cannot be attached %s"),
230     FORBIDDEN_RESOURCE_IN_USE("%s is in use, Resource ID [%s]"),
231     PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES(
232         "%s '%s' Parameter Name not aligned with Guidelines, Parameter Name [%s], Resource ID [%s]."
233             + " As a result, VF/VFC Profile may miss this information"),
234     /* Contrail validator messages*/
235     MERGE_OF_CONTRAIL2_AND_CONTRAIL3_RESOURCES(
236         "HEAT Package includes both Contrail 2 and Contrail 3 resources. "
237             + "Contrail 2 resources can be found in %s. Contrail 3 resources can be found in %s"),
238     CONTRAIL_VM_TYPE_NAME_NOT_ALIGNED_WITH_NAMING_CONVENSION(
239         "Service Template naming convention in Image and Flavor "
240             + "properties is not consistent in Resource, Resource ID %s"),
241
242     /* Notifications */
243     FAILED_TO_MARK_NOTIFICATION_AS_READ("Failed to mark notifications as read"),
244     FAILED_TO_UPDATE_LAST_SEEN_NOTIFICATION("Failed to update last seen notification for user %s"),
245     FAILED_TO_VERIFY_SIGNATURE("Could not verify signature of signed package.");
246
247     private String errorMessage;
248
249     /**
250      * Formats the message with the given parameters.
251      *
252      * @param params The message string parameters to apply
253      * @return The formatted message.
254      */
255     public String formatMessage(final Object... params) {
256         return String.format(errorMessage, params);
257     }
258
259 }