+ /**
+ * Merge a Map of String values with a Map of TOSCA Property Objects to create a combined Map. If there are
+ * duplicate keys then the TOSCA Property value takes precedence.
+ *
+ * @param stringProps
+ * initial Map of String property values (e.g. from the TOSCA YAML metadata section)
+ * @param toscaProps
+ * Map of TOSCA Property Type Object values to merge in (or overwrite)
+ * @return a Map of the property values converted to String
+ */
+ public Map<String, String> mergeProperties(Map<String, String> stringProps, Map<String, Property> toscaProps) {
+ Map<String, String> props = new HashMap<>(stringProps);
+ toscaProps.forEach((key, toscaProp) -> props.put(key,
+ toscaProp.getValue() == null ? "" : toscaProp.getValue().toString()));
+ return props;
+ }
+
+ public Resource createInstanceGroupModel(Map<String, String> properties) {
+ Resource groupModel = new InstanceGroup();
+ groupModel.populateModelIdentificationInformation(properties);
+ return groupModel;
+ }
+
+ /**
+ * @param model
+ * @param relation
+ */
+ public void addRelatedModel(final Model model, final Model relation) {
+ if (relation instanceof Resource) {
+ model.addResource((Resource) relation);
+ } else {
+ model.addWidget((Widget) relation);
+ }
+ }
+
+ public String normaliseNodeTypeName(NodeTemplate nodeType) {
+ String nodeTypeName = nodeType.getType();
+ Metadata metadata = nodeType.getMetaData();
+ if (metadata != null && hasAllottedResource(metadata.getAllProperties())) {
+ if (nodeType.getType().contains("org.openecomp.resource.vf.")) {
+ nodeTypeName = "org.openecomp.resource.vf.allottedResource";
+ }
+ if (nodeType.getType().contains("org.openecomp.resource.vfc.")) {
+ nodeTypeName = "org.openecomp.resource.vfc.AllottedResource";
+ }
+ }
+ return nodeTypeName;
+ }
+
+ public boolean hasAllottedResource(Map<String, String> metadata) {
+ return ALLOTTED_RESOURCE.equals(metadata.get(CATEGORY));
+ }
+
+ public boolean hasSubCategoryTunnelXConnect(Map<String, String> metadata) {
+ return TUNNEL_XCONNECT.equals(metadata.get(SUBCATEGORY));
+ }
+
+ /**
+ * Process TOSCA Group information for VF Modules.
+ *
+ * @param resources
+ * @param model
+ * @param serviceNode
+ */
+ public void processVfModules(List<Resource> resources, Model resourceModel, NodeTemplate serviceNode) {