2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.tosca.datatypes;
23 import org.openecomp.sdc.tosca.services.ToscaConstants;
25 import java.util.Collections;
26 import java.util.HashMap;
31 * The enum Tosca node type.
33 public enum ToscaNodeType {
36 * Compute tosca node type.
38 COMPUTE("tosca.nodes.Compute"),
40 * Root tosca node type.
42 ROOT("tosca.nodes.Root"),
44 * Block storage tosca node type.
46 BLOCK_STORAGE("tosca.nodes.BlockStorage"),
48 * Network tosca node type.
50 NETWORK("tosca.nodes.network.Network"),
52 * Network port tosca node type.
54 NETWORK_PORT("tosca.nodes.network.Port"),
56 * Nova server tosca node type.
58 NOVA_SERVER(ToscaConstants.NODES_PREFIX + "nova.Server"),
60 * Cinder volume tosca node type.
62 CINDER_VOLUME(ToscaConstants.NODES_PREFIX + "cinder.Volume"),
64 * Neutron net tosca node type.
66 NEUTRON_NET("org.openecomp.resource.vl.nodes.heat.network.neutron.Net"),
68 * Neutron port tosca node type.
70 NEUTRON_PORT("org.openecomp.resource.cp.nodes.heat.network.neutron.Port"),
72 * Neutron security rules tosca node type.
74 NEUTRON_SECURITY_RULES("org.openecomp.resource.vfc.rules.nodes"
75 + ".heat.network.neutron.SecurityRules"),
77 * Contrail virtual network tosca node type.
79 CONTRAIL_VIRTUAL_NETWORK("org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork"),
81 * Contrail network rule tosca node type.
83 CONTRAIL_NETWORK_RULE("org.openecomp.resource.vfc."
84 + "rules.nodes.heat.network.contrail.NetworkRules"),
86 * Contrailv 2 virtual network tosca node type.
88 CONTRAILV2_VIRTUAL_NETWORK("org.openecomp.resource.vl.nodes."
89 + "heat.network.contrailV2.VirtualNetwork"),
91 * Contrailv 2 network rule tosca node type.
93 CONTRAILV2_NETWORK_RULE(
94 "org.openecomp.resource.vfc.rules.nodes.heat.network.contrailV2.NetworkRules"),
96 * Contrailv 2 virtual machine interface tosca node type.
98 CONTRAILV2_VIRTUAL_MACHINE_INTERFACE(
99 "org.openecomp.resource.cp.nodes.heat.contrailV2.VirtualMachineInterface"),
101 * Abstract substitute tosca node type.
103 ABSTRACT_SUBSTITUTE("org.openecomp.resource.abstract.nodes.AbstractSubstitute"),
105 * Contrail compute tosca node type.
107 CONTRAIL_COMPUTE(ToscaConstants.NODES_PREFIX + "contrail.Compute"),
109 * Contrail port tosca node type.
111 CONTRAIL_PORT("org.openecomp.resource.cp.nodes.heat.network.contrail.Port"),
113 * Contrail abstract substitute tosca node type.
115 CONTRAIL_ABSTRACT_SUBSTITUTE("org.openecomp.resource.abstract."
116 + "nodes.contrail.AbstractSubstitute"),;
118 private static final Map<String, ToscaNodeType> mMap =
119 Collections.unmodifiableMap(initializeMapping());
120 private String displayName;
122 ToscaNodeType(String displayName) {
123 this.displayName = displayName;
127 * Initialize mapping map.
131 public static Map<String, ToscaNodeType> initializeMapping() {
132 Map<String, ToscaNodeType> toscaMap = new HashMap<>();
133 for (ToscaNodeType v : ToscaNodeType.values()) {
134 toscaMap.put(v.displayName, v);
140 * Gets tosca node type by display name.
142 * @param displayName the display name
143 * @return the tosca node type by display name
145 public static ToscaNodeType getToscaNodeTypeByDisplayName(String displayName) {
146 if (mMap.containsKey(displayName)) {
147 return mMap.get(displayName);
155 * @return the display name
157 public String getDisplayName() {