diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model')
15 files changed, 1040 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java new file mode 100644 index 0000000000..8aad825055 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.ArrayList; +import java.util.List; + +public class Constraint { + private Object[] length; + private Integer[] range; + private List<Object> valid_values; + private String pattern; + + public Constraint() { + } + + public Integer[] getRange() { + return range; + } + + public void setRange(Integer[] inRange) { + this.range = new Integer[]{inRange[0], inRange[1]}; + } + + public List<Object> getValid_values() { + return valid_values; + } + + public void setValid_values(List<Object> validValues) { + this.valid_values = validValues; + } + + /** + * Add valid value. + * + * @param validValue the valid value + */ + public void addValidValue(Object validValue) { + if (this.valid_values == null) { + this.valid_values = new ArrayList<>(); + } + valid_values.add(validValue); + } + + public Object[] getLength() { + return length; + } + + public void setLength(Object[] length) { + this.length = length; + } + + public String getPattern() { + return pattern; + } + + public void setPattern(String pattern) { + this.pattern = pattern; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java new file mode 100644 index 0000000000..b2f45d06d9 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.Map; + +public class Environment { + Map<String, Object> parameters; + + public Map<String, Object> getParameters() { + return parameters; + } + + public void setParameters(Map<String, Object> parameters) { + this.parameters = parameters; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java new file mode 100644 index 0000000000..84259b1807 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.ArrayList; +import java.util.List; + +public enum GroupTypeValues { + EXCLUSIVITY("exclusivity"), + AFFINITY("affinity"), + DIVERSITY("diversity"); + + private static List<String> groupTypeAsStrings; + + static { + groupTypeAsStrings = new ArrayList<>(); + for (GroupTypeValues attGroupTypeValue : GroupTypeValues.values()) { + groupTypeAsStrings.add(attGroupTypeValue.groupTypeValue); + } + } + + private String groupTypeValue; + + GroupTypeValues(String groupTypeValue) { + this.groupTypeValue = groupTypeValue; + } + + public static boolean isGroupTypeValid(String groupType) { + return groupTypeAsStrings.contains(groupType); + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java new file mode 100644 index 0000000000..4170d35d7a --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.List; +import java.util.Map; + +public class HeatOrchestrationTemplate { + String heat_template_version; + String description; + List<ParameterGroup> parameter_groups; + Map<String, Parameter> parameters; + Map<String, Resource> resources; + Map<String, Output> outputs; + Map<String, Object> conditions; + + public String getHeat_template_version() { + return heat_template_version; + } + + public void setHeat_template_version(String heatTemplateVersion) { + this.heat_template_version = heatTemplateVersion; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List<ParameterGroup> getParameter_groups() { + return parameter_groups; + } + + public void setParameter_groups(List<ParameterGroup> parameterGroups) { + this.parameter_groups = parameterGroups; + } + + public Map<String, Parameter> getParameters() { + return parameters; + } + + public void setParameters(Map<String, Parameter> parameters) { + this.parameters = parameters; + } + + public Map<String, Resource> getResources() { + return resources; + } + + public void setResources(Map<String, Resource> resources) { + this.resources = resources; + } + + public Map<String, Output> getOutputs() { + return outputs; + } + + public void setOutputs(Map<String, Output> outputs) { + this.outputs = outputs; + } + + public Map<String, Object> getConditions() { + return conditions; + } + + public void setConditions(Map<String, Object> conditions) { + this.conditions = conditions; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java new file mode 100644 index 0000000000..c822a78a93 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.ArrayList; +import java.util.List; + +public enum HeatPseudoParameters { + OS_STACK_NAME("OS::stack_name"), + OS_STACK_ID("OS::stack_id"), + OS_PROJECT_ID("OS::project_id"); + + private static List<String> pseudoParameterNames; + + static { + pseudoParameterNames = new ArrayList<>(); + for (HeatPseudoParameters parameter : HeatPseudoParameters.values()) { + pseudoParameterNames.add(parameter.getPseudoParameter()); + } + } + + private String pseudoParameter; + + HeatPseudoParameters(String pseudoParameter) { + this.pseudoParameter = pseudoParameter; + } + + public static List<String> getPseudoParameterNames() { + return pseudoParameterNames; + } + + public static void setPseudoParameterNames(List<String> pseudoParameterNames) { + HeatPseudoParameters.pseudoParameterNames = pseudoParameterNames; + } + + public String getPseudoParameter() { + return pseudoParameter; + } + + public void setPseudoParameter(String pseudoParameter) { + this.pseudoParameter = pseudoParameter; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java new file mode 100644 index 0000000000..d4adfe7d32 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The enum Heat resources types. + */ +public enum HeatResourcesTypes { + /** + * Nova server resource type heat resources types. + */ + NOVA_SERVER_RESOURCE_TYPE("OS::Nova::Server"), + /** + * Nova server group resource type heat resources types. + */ + NOVA_SERVER_GROUP_RESOURCE_TYPE("OS::Nova::ServerGroup"), + /** + * Neutron port resource type heat resources types. + */ + NEUTRON_PORT_RESOURCE_TYPE("OS::Neutron::Port"), + /** + * Contrail network rule resource type heat resources types. + */ + CONTRAIL_NETWORK_RULE_RESOURCE_TYPE("OS::Contrail::NetworkPolicy"), + /** + * Contrail network attach rule resource type heat resources types. + */ + CONTRAIL_NETWORK_ATTACH_RULE_RESOURCE_TYPE("OS::Contrail::AttachPolicy"), + /** + * Contrail virtual network resource type heat resources types. + */ + CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE("OS::Contrail::VirtualNetwork"), + /** + * Cinder volume resource type heat resources types. + */ + CINDER_VOLUME_RESOURCE_TYPE("OS::Cinder::Volume"), + /** + * Cinder volume attachment resource type heat resources types. + */ + CINDER_VOLUME_ATTACHMENT_RESOURCE_TYPE("OS::Cinder::VolumeAttachment"), + /** + * Neutron net resource type heat resources types. + */ + NEUTRON_NET_RESOURCE_TYPE("OS::Neutron::Net"), + /** + * Neutron subnet resource type heat resources types. + */ + NEUTRON_SUBNET_RESOURCE_TYPE("OS::Neutron::Subnet"), + /** + * Neutron security group resource type heat resources types. + */ + NEUTRON_SECURITY_GROUP_RESOURCE_TYPE("OS::Neutron::SecurityGroup"), + /** + * Heat software config type heat resources types. + */ + HEAT_SOFTWARE_CONFIG_TYPE("OS::Heat::SoftwareConfig"), + /** + * Heat cloud config type heat resources types. + */ + HEAT_CLOUD_CONFIG_TYPE("OS::Heat::CloudConfig"), + /** + * Heat multipart mime type heat resources types. + */ + HEAT_MULTIPART_MIME_TYPE("OS::Heat::MultipartMime"), + /** + * Heat contrail network ipam type heat resources types. + */ + HEAT_CONTRAIL_NETWORK_IPAM_TYPE("OS::Contrail::NetworkIpam"), + /** + * Contrail v 2 virtual network resource type heat resources types. + */ + CONTRAIL_V2_VIRTUAL_NETWORK_RESOURCE_TYPE("OS::ContrailV2::VirtualNetwork"), + /** + * Contrail v 2 virtual machine interface resource type heat resources types. + */ + CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE("OS::ContrailV2::VirtualMachineInterface"), + /** + * Contrail service template heat resources types. + */ + CONTRAIL_SERVICE_TEMPLATE("OS::Contrail::ServiceTemplate"), + /** + * Contrail service instance heat resources types. + */ + CONTRAIL_SERVICE_INSTANCE("OS::Contrail::ServiceInstance"), + /** + * Contrail v 2 network rule resource type heat resources types. + */ + CONTRAIL_V2_NETWORK_RULE_RESOURCE_TYPE("OS::ContrailV2::NetworkPolicy"), + /** + * Resource group resource type heat resources types. + */ + RESOURCE_GROUP_RESOURCE_TYPE("OS::Heat::ResourceGroup"); + + private static Map<String, HeatResourcesTypes> stringToHeatResourceTypeMap; + + static { + stringToHeatResourceTypeMap = new HashMap<>(); + + for (HeatResourcesTypes type : HeatResourcesTypes.values()) { + stringToHeatResourceTypeMap.put(type.heatResource, type); + } + } + + private String heatResource; + + + HeatResourcesTypes(String heatResource) { + this.heatResource = heatResource; + } + + /** + * Find by heat resource heat resources types. + * + * @param heatResource the heat resource + * @return the heat resources types + */ + public static HeatResourcesTypes findByHeatResource(String heatResource) { + return stringToHeatResourceTypeMap.get(heatResource); + } + + /** + * Is resource type valid boolean. + * + * @param resourceType the resource type + * @return the boolean + */ + public static boolean isResourceTypeValid(String resourceType) { + return Objects.nonNull(findByHeatResource(resourceType)); + } + + /** + * Is resource expected to be exposed boolean. + * + * @param resourceType the resource type + * @return the boolean + */ + public static boolean isResourceExpectedToBeExposed(String resourceType) { + return (resourceType.equals(NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource()) + || resourceType.equals(CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource()) + || resourceType.equals(NEUTRON_NET_RESOURCE_TYPE.getHeatResource()) + || resourceType.equals(CINDER_VOLUME_RESOURCE_TYPE.getHeatResource()) + || resourceType.equals(NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource()) + ); + } + + /** + * Gets list for resource type. + * + * @param types the types + * @return the list for resource type + */ + public static Map<HeatResourcesTypes, List<String>> getListForResourceType( + HeatResourcesTypes... types) { + Map<HeatResourcesTypes, List<String>> result = new HashMap<>(); + + for (HeatResourcesTypes type : types) { + result.put(type, new ArrayList<>()); + } + + return result; + } + + /** + * Gets heat resource. + * + * @return the heat resource + */ + public String getHeatResource() { + + return heatResource; + } + + /** + * Sets heat resource. + * + * @param heatResource the heat resource + */ + public void setHeatResource(String heatResource) { + this.heatResource = heatResource; + } + +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java new file mode 100644 index 0000000000..8222edded2 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +public class Output { + String description; + Object value; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java new file mode 100644 index 0000000000..63681cc80c --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.List; +import java.util.Map; + +public class Parameter { + String type; + String label; + String description; + Object _default; + boolean hidden; + List<Map<String, Object>> constraints; + boolean immutable; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Object get_default() { + return _default; + } + + public void set_default(Object defaultValue) { + this._default = defaultValue; + } + + public boolean isHidden() { + return hidden; + } + + public void setHidden(boolean hidden) { + this.hidden = hidden; + } + + public List<Map<String, Object>> getConstraints() { + return constraints; + } + + public void setConstraints(List<Map<String, Object>> constraints) { + this.constraints = constraints; + } + + public boolean isImmutable() { + return immutable; + } + + public void setImmutable(boolean immutable) { + this.immutable = immutable; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java new file mode 100644 index 0000000000..8ab066f4a4 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.List; + +public class ParameterGroup { + String label; + String description; + List<String> parameters; + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List<String> getParameters() { + return parameters; + } + + public void setParameters(List<String> parameters) { + this.parameters = parameters; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java new file mode 100644 index 0000000000..37c430ec36 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +public enum ParameterType { + + STRING("string"), + NUMBER("number"), + JSON("json"), + BOOLEAN("boolean"), + COMMA_DELIMITED_LIST("comma_delimited_list"); + + private String displayName; + + ParameterType(String displayName) { + this.displayName = displayName; + } + + public String getDisplayName() { + return displayName; + } + + +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java new file mode 100644 index 0000000000..3195e61fe5 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +public enum PolicyTypes { + AFFINITY("affinity"), + ANTI_AFFINITY("anti-affinity"); + + private static Map<String, PolicyTypes> stringToPolicyTypesMap; + + static { + stringToPolicyTypesMap = new HashMap<>(); + for (PolicyTypes type : PolicyTypes.values()) { + stringToPolicyTypesMap.put(type.policy, type); + } + } + + private String policy; + + PolicyTypes(String policy) { + this.policy = policy; + } + + public static PolicyTypes findByPolicy(String policy) { + return stringToPolicyTypesMap.get(policy); + } + + public static boolean isGivenPolicyValid(String policyToCheck) { + return Objects.nonNull(findByPolicy(policyToCheck)); + } + + public String getPolicy() { + return policy; + } + + public void setPolicy(String policy) { + this.policy = policy; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java new file mode 100644 index 0000000000..e8d43fc10c --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +public enum PropertiesMapKeyTypes { + IMAGE("image"), + FLAVOR("flavor"), + NETWORKS("networks"), + RESOURCE_DEF("resource_def"); + + private String keyMap; + + PropertiesMapKeyTypes(String keyMap) { + this.keyMap = keyMap; + } + + public String getKeyMap() { + return keyMap; + } + + public void setKeyMap(String keyMap) { + this.keyMap = keyMap; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java new file mode 100644 index 0000000000..f4c3cd91cb --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.Map; + +public class Resource { + String type; + Map<String, Object> properties; + Object metadata; + Object depends_on; + Object update_policy; + Object deletion_policy; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Map<String, Object> getProperties() { + return properties; + } + + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } + + public Object getMetadata() { + return metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + public Object getDepends_on() { + return depends_on; + } + + public void setDepends_on(Object dependsOn) { + this.depends_on = dependsOn; + } + + public Object getUpdate_policy() { + return update_policy; + } + + public void setUpdate_policy(Object updatePolicy) { + this.update_policy = updatePolicy; + } + + public Object getDeletion_policy() { + return deletion_policy; + } + + public void setDeletion_policy(Object deletionPolicy) { + this.deletion_policy = deletionPolicy; + } + + @Override + public String toString() { + return "Resource{" + + "type='" + type + '\'' + + ", properties=" + properties + + ", metadata=" + metadata + + ", depends_on=" + depends_on + + ", update_policy='" + update_policy + '\'' + + ", deletion_policy='" + deletion_policy + '\'' + + '}'; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java new file mode 100644 index 0000000000..b36d130597 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +public enum ResourceReferenceFunctions { + GET_RESOURCE("get_resource"), + GET_PARAM("get_param"), + GET_ATTR("get_attr"), + GET_FILE("get_file"), + SCHEDULER_HINTS("scheduler_hints"); + + + private String function; + + ResourceReferenceFunctions(String function) { + this.function = function; + } + + public String getFunction() { + return function; + } + + public void setFunction(String function) { + this.function = function; + } +} diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java new file mode 100644 index 0000000000..d7ede70942 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.heat.datatypes.model; + +import java.util.HashMap; +import java.util.Map; + +public enum ResourceTypeToMessageString { + SERVER_GROUP(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE, "ServerGroup"), + SECURITY_GROUP(HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE, "SecurityGroup"), + NETWORK_POLICY(HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE, "NetworkPolicy"); + + private static Map<HeatResourcesTypes, String> resourcesTypesStringMap; + + static { + resourcesTypesStringMap = new HashMap<>(); + + for (ResourceTypeToMessageString resourceTypeToMessageString : ResourceTypeToMessageString + .values()) { + resourcesTypesStringMap + .put(resourceTypeToMessageString.type, resourceTypeToMessageString.messageString); + } + } + + private String messageString; + private HeatResourcesTypes type; + + + ResourceTypeToMessageString(HeatResourcesTypes type, String messgageString) { + this.type = type; + this.messageString = messgageString; + } + + public static String getTypeForMessageFromResourceType(HeatResourcesTypes type) { + return resourcesTypesStringMap.get(type); + } +} |