aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ConfigConstants.java2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java74
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java3
4 files changed, 82 insertions, 5 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java
index d8e090261c..952a9cf9c9 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java
@@ -33,7 +33,9 @@ public class ToscaNodeType {
config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_VFC);
public static final String CP_NODE_TYPE_PREFIX =
config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_CP);
- public static final String NETWORK_NODE_TYPE_PREFIX =
+ public static String EXTERNAL_CP_NODE_TYPE_PREFIX =
+ config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_EXTERNAL_CP);
+ public static String NETWORK_NODE_TYPE_PREFIX =
config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_NETWORK);
public static final String ABSTRACT_NODE_TYPE_PREFIX =
config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_ABSTARCT);
@@ -77,6 +79,10 @@ public class ToscaNodeType {
public static final String NETWORK_SUB_INTERFACE = CP_NODE_TYPE_PREFIX + "network.SubInterface";
public static final String CONTRAILV2_VLAN_SUB_INTERFACE = CP_NODE_TYPE_PREFIX
+ "heat.network.contrailV2.VLANSubInterface";
+ //Port Mirroring external node types
+ public static String EXTERNAL_CP = EXTERNAL_CP_NODE_TYPE_PREFIX + "extCP";
+ public static String EXTERNAL_CONTRAIL_PORT = EXTERNAL_CP_NODE_TYPE_PREFIX + "extContrailCP";
+ public static String EXTERNAL_NEUTRON_PORT = EXTERNAL_CP_NODE_TYPE_PREFIX + "extNeutronCP";
public static final String ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "AbstractSubstitute";
public static final String VFC_ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "VFC";
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ConfigConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ConfigConstants.java
index 0e4bc22c37..91103c55df 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ConfigConstants.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ConfigConstants.java
@@ -36,6 +36,8 @@ public class ConfigConstants {
public static final String PREFIX_NODE_TYPE_VFC = PREFIX + ".nodeType.vfc";
public static final String PREFIX_NODE_TYPE_NETWORK = PREFIX + ".nodeType.network";
public static final String PREFIX_NODE_TYPE_CP = PREFIX + ".nodeType.connectionPoint";
+ public static final String PREFIX_NODE_TYPE_EXTERNAL_CP = PREFIX + ".nodeType"
+ + ".external.connectionPoint";
public static final String PREFIX_NODE_TYPE_ABSTARCT = PREFIX + ".nodeType.abstract";
public static final String PREFIX_NODE_TYPE_RULE = PREFIX + ".nodeType.rule";
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
index 0effd40519..d223b5f01e 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
@@ -37,6 +37,7 @@ import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType;
import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType;
import org.openecomp.sdc.tosca.datatypes.model.AttributeDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityAssignment;
import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
import org.openecomp.sdc.tosca.datatypes.model.CapabilityType;
import org.openecomp.sdc.tosca.datatypes.model.Constraint;
@@ -157,6 +158,47 @@ public class DataModelUtil {
}
/**
+ * Add substitution mapping capability.
+ *
+ * @param serviceTemplate the service template
+ * @param substitutionMappingCapabilityId the substitution mapping capability id
+ * @param substitutionMappingCapabilityList the substitution mapping capability list
+ */
+ public static void addSubstitutionMappingCapability(ServiceTemplate serviceTemplate,
+ String substitutionMappingCapabilityId,
+ List<String> substitutionMappingCapabilityList) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
+ if (serviceTemplate == null) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.ADD_ENTITIES_TO_TOSCA, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_ADD_ACTION);
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Substitution Mapping Capabilities",
+ "Service Template").build());
+ }
+
+ if (serviceTemplate.getTopology_template() == null) {
+ serviceTemplate.setTopology_template(new TopologyTemplate());
+ }
+ if (serviceTemplate.getTopology_template().getSubstitution_mappings() == null) {
+ serviceTemplate.getTopology_template().setSubstitution_mappings(new SubstitutionMapping());
+ }
+ if (serviceTemplate.getTopology_template().getSubstitution_mappings().getCapabilities()
+ == null) {
+ serviceTemplate.getTopology_template().getSubstitution_mappings()
+ .setCapabilities(new HashMap<>());
+ }
+
+ serviceTemplate.getTopology_template().getSubstitution_mappings().getCapabilities()
+ .putIfAbsent(substitutionMappingCapabilityId, substitutionMappingCapabilityList);
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
+ }
+
+ /**
* Add node template.
*
* @param serviceTemplate the service template
@@ -1445,11 +1487,11 @@ public class DataModelUtil {
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
clonedObjectValue = objectInputStream.readObject();
} catch (NotSerializableException ex) {
- logger.debug(ex.getMessage(), ex);
- return getClonedObject(obj, obj.getClass());
+ logger.debug(ex.getMessage(), ex);
+ return getClonedObject(obj, obj.getClass());
} catch (IOException | ClassNotFoundException ex) {
- logger.debug(ex.getMessage(), ex);
- return null;
+ logger.debug(ex.getMessage(), ex);
+ return null;
}
return clonedObjectValue;
}
@@ -1510,6 +1552,30 @@ public class DataModelUtil {
return substitutionMapping;
}
+ /**
+ * Add node template capability.
+ *
+ * @param nodeTemplate the node template
+ * @param capabilityId the capability id
+ * @param capabilityProperties the capability properties
+ * @param capabilityAttributes the capability attributes
+ */
+ public static void addNodeTemplateCapability(NodeTemplate nodeTemplate, String capabilityId,
+ Map<String, Object> capabilityProperties,
+ Map<String, Object> capabilityAttributes) {
+ List<Map<String, CapabilityAssignment>> capabilities = nodeTemplate.getCapabilities();
+ if (Objects.isNull(capabilities)) {
+ capabilities = new ArrayList<>();
+ }
+ CapabilityAssignment capabilityAssignment = new CapabilityAssignment();
+ capabilityAssignment.setProperties(capabilityProperties);
+ capabilityAssignment.setAttributes(capabilityAttributes);
+ Map<String, CapabilityAssignment> nodeTemplateCapability = new HashMap<>();
+ nodeTemplateCapability.put(capabilityId, capabilityAssignment);
+ capabilities.add(nodeTemplateCapability);
+ nodeTemplate.setCapabilities(capabilities);
+ }
+
private static Map<String, List<String>> manageRequirementMapping(
List<Map<String, RequirementDefinition>> requirementList,
Map<String, List<String>> requirementSubstitutionMapping) {
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java
index cf0c763846..4d45e8fbf1 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java
@@ -40,6 +40,7 @@ public class ToscaConstants {
public static final String SCALABLE_CAPABILITY_ID = "scalable";
public static final String ATTACHMENT_CAPABILITY_ID = "attachment";
public static final String FEATURE_CAPABILITY_ID = "feature";
+ public static final String PORT_MIRRORING_CAPABILITY_ID = "port_mirroring";
//General
public static final String TOSCA_DEFINITIONS_VERSION = "tosca_simple_yaml_1_0_0";
@@ -62,6 +63,8 @@ public class ToscaConstants {
public static final String PORT_FIXED_IPS = "fixed_ips";
public static final String PORT_ALLOWED_ADDRESS_PAIRS = "allowed_address_pairs";
+ public static final String PORT_NETWORK_ROLE_PROPERTY_NAME = "network_role";
+ public static final String PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME = "connection_point";
public static final String MAC_ADDRESS = "mac_address";
public static final String COMPUTE_IMAGE = "image";