diff options
author | 2019-08-07 19:59:04 +0000 | |
---|---|---|
committer | 2019-08-09 13:52:24 -0400 | |
commit | 3f336cecddbc7adf45489e0d4a0b1b19deeee1ef (patch) | |
tree | 9964976ded424f3d93f3e5e133d1965c2ea57e0d /ueb-listener/src/main | |
parent | c0c9d433434dde14d68c5a8b5816b5371677dc24 (diff) |
Use getEntity to populate Complex Resource-Related tables
Changes made:
Clean up in SdncBaseModel for unused methods.
Fixes in SdncGroupModel.
Convert SdncNodeModel to entity.
Corrected logging in SdncVFCModel.
Corresponding Group-related and logging fixes in SdncVFModel.
Corresponding SdncBaseModel changes for getEntity migration.
Corresponding junit changes for getEntity migration.
Issue-ID: CCSDK-1578
Change-Id: Ic7f7ec38325aeddcad2d86c8f8425ec825512714
Signed-off-by: lalena.aria <lalena.aria@att.com>
Diffstat (limited to 'ueb-listener/src/main')
6 files changed, 190 insertions, 294 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java index 84918ab10..d3fef173f 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java @@ -77,10 +77,6 @@ public class SdncBaseModel { protected NodeTemplate nodeTemplate = null; protected IEntityDetails entityDetails = null; - public SdncBaseModel(DBResourceManager jdbcDataSource) { - this.jdbcDataSource = jdbcDataSource; - } - public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, DBResourceManager jdbcDataSource) { this (sdcCsarHelper, nodeTemplate); this.sdcCsarHelper = sdcCsarHelper; @@ -159,28 +155,7 @@ public class SdncBaseModel { addParameter(PARAM_UUID_KEY, UUID); addParameter(PARAM_VERSION_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION)); } - - public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { - this (sdcCsarHelper, group); - this.sdcCsarHelper = sdcCsarHelper; - this.config = config; - this.jdbcDataSource = jdbcDataSource; - } - - public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group) { - - params = new HashMap<String, String>(); - this.sdcCsarHelper = sdcCsarHelper; - attributeValueParams = new HashMap<String, String>(); - // extract group metadata - Metadata metadata = group.getMetadata(); - //customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID); - returning null - customizationUUID = extractValue (metadata, "vfModuleModelCustomizationUUID"); - addParameter(PARAM_INVARIANT_UUID_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); - addParameter(PARAM_UUID_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); - addParameter(PARAM_VERSION_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)); - } /* This is the generic approach Shoujit attempted for 18.06 but can't be implemented without parser API to * get properties with substring match on the name @@ -238,7 +213,7 @@ public class SdncBaseModel { addParameter("resource_type", metadataType, attributeParams); addParameter("resource_customization_uuid", getCustomizationUUID(), attributeParams); - LOG.info("Call insertToscaData for ATTRIBUTE_VALUE_PAIR where resource_uuid = " + getUUID() + " and attriubute_name = " + paramName); + LOG.info("Call insertToscaData for ATTRIBUTE_VALUE_PAIR where resource_uuid = " + getUUID() + " and attribute_name = \"" + paramName + "\""); try { insertToscaData(buildSql("ATTRIBUTE_VALUE_PAIR", "resource_uuid", getUUID(), model_yaml, attributeParams), null); } catch (IOException e) { @@ -248,13 +223,13 @@ public class SdncBaseModel { } } - protected void insertGroupData (NodeTemplate nodeTemplate, NodeTemplate targetNode, String groupType) throws IOException { + protected void insertEntityGroupData (IEntityDetails entityDetails, IEntityDetails targetNode, String groupType) throws IOException { // Get the Groups on a node - Convert to use getEntity in 19.08 EntityQuery entityQuery = EntityQuery.newBuilder(groupType).build(); String customizationUuid = getCustomizationUUIDNoQuotes(); - SdcTypes nodeTemplateSdcType = SdcTypes.valueOf(extractValue(nodeTemplate.getMetaData(), SdcPropertyNames.PROPERTY_NAME_TYPE)); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(nodeTemplateSdcType) + SdcTypes entitySdcType = SdcTypes.valueOf(extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_TYPE)); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(entitySdcType) .customizationUUID(customizationUuid).build(); List<IEntityDetails> groupList = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); if (groupList == null) { @@ -268,21 +243,22 @@ public class SdncBaseModel { // ATTRIBUTE_VALUE_PAIR (group properties): group_type, group_role, group_function // RESOURCE_GROUP_TO_TARGET_NODE_MAPPING: group_uuid, parent_uuid (CR node UUID), target_node_uuid, target_type, table_name - SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, nodeTemplate, config, jdbcDataSource); - groupModel.insertGroupData(nodeTemplate); + SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, entityDetails, config, jdbcDataSource); + String resourceUuid = getUUID(); + groupModel.insertGroupData(resourceUuid); // insert RESOURCE_GROUP_TO_TARGET_NODE_MAPPING try { Map<String, String> mappingCleanupParams = new HashMap<String, String>(); addParameter("group_uuid", groupModel.getUUID(), mappingCleanupParams); - addParameter("parent_uuid", extractValue(nodeTemplate.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); - addParameter("target_node_uuid", extractValue(targetNode.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); + addParameter("parent_uuid", extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); + addParameter("target_node_uuid", extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); cleanupExistingToscaData("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", mappingCleanupParams); Map<String, String> mappingParams = new HashMap<String, String>(); - addParameter("parent_uuid", extractValue(nodeTemplate.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); - addParameter("target_node_uuid", extractValue(targetNode.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); - String targetType = extractValue(targetNode.getMetaData(), PARAM_TYPE_KEY); + addParameter("parent_uuid", extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); + addParameter("target_node_uuid", extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); + String targetType = extractValue(targetNode.getMetadata(), PARAM_TYPE_KEY); addParameter("target_type", targetType, mappingParams); String tableName = ""; switch (targetType) { @@ -310,7 +286,7 @@ public class SdncBaseModel { TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(queryType).customizationUUID(nodeTemplateCustomizationUuid).build(); List<IEntityDetails> policyEntities = sdcCsarHelper.getEntity(policyEntityQuery, topologyTemplateQuery, false); if (policyEntities == null || policyEntities.isEmpty()) { - LOG.info("insertPolicyData: Could not find policy data for: " + nodeTemplateCustomizationUuid); + LOG.debug("insertPolicyData: Could not find policy data for: " + nodeTemplateCustomizationUuid); return; } @@ -339,7 +315,7 @@ public class SdncBaseModel { List<IEntityDetails> policyEntities = sdcCsarHelper.getEntity(policyEntityQuery, topologyTemplateQuery, false); if (policyEntities == null || policyEntities.isEmpty()) { - LOG.info("insertPolicyData: Could not find policy data for Service/VF: " + resourceUuid); + LOG.debug("insertPolicyData: Could not find policy data for Service/VF: " + resourceUuid); return; } @@ -352,7 +328,7 @@ public class SdncBaseModel { insertResourcePolicyData(policyEntity, resourceUuid); List<IEntityDetails> targetEntities = policyEntity.getTargetEntities(); if (targetEntities == null || targetEntities.isEmpty()) { - LOG.info("insertPolicyData: Could not find targetEntites for policy: " + policyUuid); + LOG.debug("insertPolicyData: Could not find targetEntites for policy: " + policyUuid); continue; } @@ -483,7 +459,7 @@ public class SdncBaseModel { try { cleanupExistingToscaData("NODE_CAPABILITY", cleanupParams); // will also delete NODE_CAPABILITY_PROPERTY with same capability_id - LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = " + capability.getName()); + LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = \"" + capability.getName() + "\""); insertToscaData(buildSql("NODE_CAPABILITY", "capability_provider_uuid", capabilityProviderUuid, model_yaml, nodeCapabilityParams), null); // Get capabilityId for capability just inserted @@ -545,7 +521,7 @@ public class SdncBaseModel { try { cleanupExistingToscaData("NODE_CAPABILITY", cleanupParams); // will also delete NODE_CAPABILITY_PROPERTY with same capability_id - LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = " + capability.getName()); + LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = \"" + capability.getName()+ "\""); insertToscaData(buildSql("NODE_CAPABILITY", "capability_provider_uuid", capabilityProviderUuid, model_yaml, nodeCapabilityParams), null); // Get capabilityId for capability just inserted @@ -578,7 +554,7 @@ public class SdncBaseModel { try { // Data from NODE_CAPABILITY_PROPERTY is cleaned up via cascade delete on NODE_CAPABILITY - LOG.info("Call insertToscaData for NODE_CAPABILITY_PROPERTY where capability_id = " + capabilityId + " and property_name = " + property.getName() + ", property_value: " + property.getValue().toString()); + LOG.info("Call insertToscaData for NODE_CAPABILITY_PROPERTY where capability_id = \"" + capabilityId + "\" and capability_property_name = \"" + property.getName() + "\" and capability_property_type = \"" + property.getValue().toString() + "\""); insertToscaData(buildSql("NODE_CAPABILITY_PROPERTY", "capability_id", capabilityId, model_yaml, nodeCapabilityPropertyParams), null); } catch (IOException e) { LOG.error("Could not insert Tosca CSAR data into the NODE_CAPABILITY_PROPERTY table"); @@ -605,12 +581,6 @@ public class SdncBaseModel { } } - public static void addIntParameter (String name, String value, Map<String, String> params) { - if (value != null && !value.isEmpty()) { - params.put(name, value); - } - } - public static void addParameter (String name, String value, Map<String, String> params) { if (value != null && !value.isEmpty()) { // remove any quotes within the string @@ -682,7 +652,7 @@ public class SdncBaseModel { if (entityDetails.getProperties().containsKey(path)) { Property property = entityDetails.getProperties().get(path); - if (property != null && property.getLeafPropertyValue(name) != null) { + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { value = property.getLeafPropertyValue(name).get(0); } } @@ -693,34 +663,49 @@ public class SdncBaseModel { return ""; } } - - protected String extractValue (Property property, String name) { + + protected String extractValue (IEntityDetails entityDetails, String path1, String path2, String name) { String value = ""; - if (!property.getLeafPropertyValue(name).isEmpty()) { - value = property.getLeafPropertyValue(name).get(0); - } - + value = extractNestedValue (entityDetails, path1, path2, name); + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { return value; } else { return ""; } } - - protected String extractBooleanValue (Property property, String name) { + + protected String extractBooleanValue (IEntityDetails entityDetails, String path1, String path2, String name) { String value = ""; - if (!property.getLeafPropertyValue(name).isEmpty()) { - value = property.getLeafPropertyValue(name).get(0); - } + value = extractNestedValue (entityDetails, path1, path2, name); - if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + if (value != null && !value.isEmpty()) { return value.contains("true") ? "Y" : "N"; } else { return ""; } } + + protected String extractNestedValue (IEntityDetails entityDetails, String path1, String path2, String name) { + String value = ""; + + if (entityDetails.getProperties().containsKey(path1)) { + Property path1Property = entityDetails.getProperties().get(path1); + if (path1Property != null) { + Map<String, Object> path1PropertyValue = (Map<String, Object>) path1Property.getValue(); + if (path1PropertyValue.containsKey(path2)) { + Map<String, Object> path2PropertyValue = (Map<String, Object>) path1PropertyValue.get(path2); + if (path2PropertyValue != null && path2PropertyValue.containsKey(name)) { + value = path2PropertyValue.get(name).toString(); + } + } + } + } + + return value; + } protected String extractIntegerValue (Property property, String name) { String value = ""; @@ -735,35 +720,48 @@ public class SdncBaseModel { return ""; } } + + protected String extractGetInputValue (IEntityDetails group, IEntityDetails entityDetails, String name) { - protected String extractGetInputValue (Group group, NodeTemplate nodeTemplate, String name) { - - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, extractGetInputName (group, name)); - if (value != null) { - return value; + // Extract the property on entityDetails after getting the property name from the group + String getInputName = extractGetInputName (group, name); + String entityPropertyValue = ""; + + if (entityDetails.getProperties().containsKey(getInputName)) { + Property entityProperty = entityDetails.getProperties().get(getInputName); + entityPropertyValue = entityProperty.getValue().toString(); + } + + if (!entityPropertyValue.isEmpty()) { + return entityPropertyValue; } else { return ""; } } - protected String extractGetInputName (Group group, String name) { + protected String extractGetInputName (IEntityDetails group, String name) { String getInputName = name; - String groupProperty = sdcCsarHelper.getGroupPropertyLeafValue(group, name); - if (groupProperty != null) { - int getInputIndex = groupProperty.indexOf("{get_input="); + String groupPropertyValue = ""; + if (group.getProperties().containsKey(name)) { + Property groupProperty = group.getProperties().get(name); + groupPropertyValue = groupProperty.getValue().toString(); + } + if (!groupPropertyValue.isEmpty()) { + int getInputIndex = groupPropertyValue.indexOf("{get_input="); if (getInputIndex > -1) { - getInputName = groupProperty.substring(getInputIndex+11, groupProperty.length()-1); + getInputName = groupPropertyValue.substring(getInputIndex+11, groupPropertyValue.length()-1); } } return getInputName; } - - protected String extractGetInputValue (Policy policy, NodeTemplate nodeTemplate, String name) { - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, extractGetInputName (policy, name)); + // Remove this after migrate SdncVFModel to getEntity + protected String extractGetInputValue (Group group, NodeTemplate nodeTemplate, String name) { + + String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, extractGetInputName (group, name)); if (value != null) { return value; } else { @@ -771,13 +769,12 @@ public class SdncBaseModel { } } - protected String extractGetInputName (Policy policy, String name) { + // Remove this after migrate SdncVFModel to getEntity + protected String extractGetInputName (Group group, String name) { String getInputName = name; - //String groupProperty = sdcCsarHelper.getPolicyPropertyLeafValue(policy, name); - Map<String, Object> propMap = policy.getPolicyProperties(); - String groupProperty = nullCheck(propMap.get(name)); - if (!groupProperty.isEmpty()) { + String groupProperty = sdcCsarHelper.getGroupPropertyLeafValue(group, name); + if (groupProperty != null) { int getInputIndex = groupProperty.indexOf("{get_input="); if (getInputIndex > -1) { getInputName = groupProperty.substring(getInputIndex+11, groupProperty.length()-1); @@ -787,36 +784,7 @@ public class SdncBaseModel { return getInputName; } - - protected String extractValue (Policy policy, String name) { - - Map<String, Object> propMap = policy.getPolicyProperties(); - if (propMap == null) { - return ""; - } else { - return nullCheck(propMap.get(name)); - } - } - - protected static String extractValueStatic (Policy policy, String name) { - - Map<String, Object> propMap = policy.getPolicyProperties(); - if (propMap == null) { - return ""; - } else { - return nullCheckStatic(propMap.get(name)); - } - } - - public static String extractValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) { - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); - if (value != null) { - return value; - } else { - return ""; - } - } - + protected String extractValue (CapabilityAssignment capability, String name) { String value = sdcCsarHelper.getCapabilityPropertyLeafValue(capability, name); if (value != null) { @@ -855,8 +823,10 @@ public class SdncBaseModel { String value = null; if (entityDetails.getProperties().containsKey(path)) { Property property = entityDetails.getProperties().get(path); - if (property != null && property.getLeafPropertyValue(name) != null) { - value = property.getLeafPropertyValue(name).get(0); + if (property != null) { + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { + value = property.getLeafPropertyValue(name).get(0); + } } } @@ -867,15 +837,6 @@ public class SdncBaseModel { } } - public static String extractBooleanValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) { - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - protected Object extractObjectValue (NodeTemplate nodeTemplate, String name) { Object value = sdcCsarHelper.getNodeTemplatePropertyValueAsObject(nodeTemplate, name); if (value != null) { @@ -885,60 +846,6 @@ public class SdncBaseModel { } } - protected String extractValue (Group group, String name) { - String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name); - if (value != null) { - return value; - } else { - return ""; - } - } - - protected String extractBooleanValue (Group group, String name) { - String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - - protected String extractInputDefaultValue (String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null) { - return value; - } else { - return ""; - } - } - - protected String extractBooleanInputDefaultValue (String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - - public static String extractInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null) { - return value; - } else { - return ""; - } - } - - public static String extractBooleanInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - public static String extractSubstitutionMappingTypeName (ISdcCsarHelper sdcCsarHelper) { String value = sdcCsarHelper.getServiceSubstitutionMappingsTypeName(); if (value != null) { @@ -1060,21 +967,6 @@ public class SdncBaseModel { } - protected static void insertToscaData(DBResourceManager jdbcDataSource, String toscaDataString, ArrayList<String> arguments) throws IOException - { - LOG.debug("insertToscaData: " + toscaDataString); - - try { - - jdbcDataSource.writeData(toscaDataString, arguments, null); - - } catch (SQLException e) { - LOG.error("Could not insert Tosca data into the database"); - throw new IOException (e); - } - - } - protected void cleanUpExistingToscaData(String tableName, String keyName, String keyValue) throws IOException { @@ -1188,7 +1080,7 @@ public class SdncBaseModel { rowCount ++; } if (rowCount != 0) { - LOG.info("checkForExistingToscaData in " + tableName + ": Data FOUND"); + LOG.debug("checkForExistingToscaData in " + tableName + ": Data FOUND"); dataExists = true; } @@ -1233,6 +1125,7 @@ public class SdncBaseModel { return data; } + protected void addParamsToMap (Map<String, String> fromMap, Map<String, String> toMap) { for (String key : fromMap.keySet()) { if (!toMap.containsKey(key)) { @@ -1249,12 +1142,4 @@ public class SdncBaseModel { return stringValue; } - protected static String nullCheckStatic (Object extractedObject) { - String stringValue = ""; - if (extractedObject != null) { - return extractedObject.toString(); - } - return stringValue; - } - } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java index 268590feb..622936652 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java @@ -27,8 +27,6 @@ import java.io.IOException; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.toscaparser.api.Group; -import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +38,7 @@ public class SdncGroupModel extends SdncBaseModel { private static final String groupType = "group_type"; - public SdncGroupModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails group, NodeTemplate nodeTemplate, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { + public SdncGroupModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails group, IEntityDetails entityDetails, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { super(sdcCsarHelper, group); @@ -60,24 +58,20 @@ public class SdncGroupModel extends SdncBaseModel { addParameter("vfc_parent_port_role", extractValue(group, "vfc_parent_port_role"), attributeValueParams); addParameter("subinterface_role", extractValue(group, "subinterface_role"), attributeValueParams); - // relevant complex group properties are extracted and inserted into ATTRIBUTE_VALUE_PAIR - String extractedGroupType = extractValue (group, groupType); - String extractedGroupRole = extractValue (group, "group_role"); - String extractedGroupFunction = extractValue (group, "group_function"); - addParameter(groupType, extractedGroupType, attributeValueParams); - addParameter("group_role", extractedGroupRole, attributeValueParams); - addParameter("group_function", extractedGroupFunction, attributeValueParams); + // relevant complex group properties are extracted and inserted into ATTRIBUTE_VALUE_PAIR + addParameter(extractGetInputName (group, groupType), extractGetInputValue(group, entityDetails, groupType), attributeValueParams); + addParameter(extractGetInputName (group, "group_role"), extractGetInputValue(group, entityDetails, "group_role"), attributeValueParams); + addParameter(extractGetInputName (group, "group_function"), extractGetInputValue(group, entityDetails, "group_function"), attributeValueParams); } - public void insertGroupData(NodeTemplate resourceNodeTemplate) throws IOException { + public void insertGroupData(String resourceUuid) throws IOException { try { // insert into RESOURCE_GROUP/ATTRIBUTE_VALUE_PAIR - String resourceNodeUuid = "\"" + extractValue (resourceNodeTemplate.getMetaData(), "UUID") + "\""; - cleanUpExistingToscaData("RESOURCE_GROUP", "resource_uuid", resourceNodeUuid, "group_uuid", getUUID()) ; - LOG.info("Call insertToscaData for RESOURCE_GROUP where group_uuid = " + getUUID() + " and resource_uuid = " + resourceNodeUuid); - insertToscaData(buildSql("RESOURCE_GROUP", "resource_uuid", resourceNodeUuid, model_yaml, params), null); + cleanUpExistingToscaData("RESOURCE_GROUP", "resource_uuid", resourceUuid, "group_uuid", getUUID()) ; + LOG.info("Call insertToscaData for RESOURCE_GROUP where group_uuid = " + getUUID() + " and resource_uuid = " + resourceUuid); + insertToscaData(buildSql("RESOURCE_GROUP", "resource_uuid", resourceUuid, model_yaml, params), null); insertRelevantAttributeData("group"); } catch (IOException e) { diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java index 4870f29e3..cf81b3cae 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java @@ -24,11 +24,13 @@ package org.onap.ccsdk.sli.northbound.uebclient; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; -import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.Property; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,59 +45,53 @@ public class SdncNodeModel extends SdncBaseModel { private String [] bindingUuids = null; // Using ASDC TOSCA Parser 17.07 - public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, DBResourceManager jdbcDataSource) { + public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails nodeEntity, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { - super(sdcCsarHelper, nodeTemplate, jdbcDataSource); + super(sdcCsarHelper, nodeEntity, jdbcDataSource, config); - // extract inpuecompGeneratedNamingts - String ecompGeneratedNaming = extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING); - addParameter("ecomp_generated_naming",ecompGeneratedNaming); - addParameter("naming_policy", extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY)); - // extract properties - addParameter("network_type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); - addParameter("network_role", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); - addParameter("network_scope", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); - addParameter("network_technology", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + addParameter("ecomp_generated_naming", extractBooleanValue (nodeEntity, "exVL_naming", "ecomp_generated_naming")); // should be extractBooleanValue? + addParameter("naming_policy", extractValue (nodeEntity, "exVL_naming", "naming_policy")); + + addParameter("network_type", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + addParameter("network_role", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + addParameter("network_scope", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + addParameter("network_technology", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); // extract properties - network_assignments - addParameter("is_shared_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISSHAREDNETWORK)); - addParameter("is_external_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISEXTERNALNETWORK)); - String trunkNetworkIndicator = extractBooleanValue(nodeTemplate, "network_assignments#is_trunked"); + addParameter("is_shared_network", extractBooleanValue (nodeEntity, "network_assignments", "is_shared_network")); + addParameter("is_external_network", extractBooleanValue (nodeEntity, "network_assignments", "is_external_network")); + String trunkNetworkIndicator = extractBooleanValue(nodeEntity, "network_assignments", "is_trunked"); addParameter("trunk_network_indicator", trunkNetworkIndicator); // extract properties - network_assignments - ipv4_subnet_default_assignment - String useIpv4 = extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#use_ipv4"); + String useIpv4 = extractBooleanValue(nodeEntity, "network_assignments", "use_ipv4"); addParameter("use_ipv4", useIpv4); - addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#dhcp_enabled")); - if (useIpv4.contains("Y")) { - addParameter("ipv4_ip_version", "ipv4"); - } - addParameter("ipv4_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#cidr_mask")); - addParameter("eipam_v4_address_plan", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#ip_network_address_plan")); + addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "dhcp_enabled")); + addParameter("ipv4_ip_version", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "ip_version")); + addParameter("ipv4_cidr_mask", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "cidr_mask")); + addParameter("eipam_v4_address_plan", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "ip_network_address_plan")); // extract properties - network_assignments - ipv6_subnet_default_assignment - String useIpv6 = extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#use_ipv6"); + String useIpv6 = extractBooleanValue(nodeEntity, "network_assignments", "use_ipv6"); addParameter("use_ipv6", useIpv6); - addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#dhcp_enabled")); - if (useIpv6.contains("Y")) { - addParameter("ipv6_ip_version", "ipv6"); - } - addParameter("ipv6_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#cidr_mask")); - addParameter("eipam_v6_address_plan", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#ip_network_address_plan")); + addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "dhcp_enabled")); + addParameter("ipv6_ip_version", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "ip_version")); + addParameter("ipv6_cidr_mask", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "cidr_mask")); + addParameter("eipam_v6_address_plan", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "ip_network_address_plan")); // extract properties - provider_network - addParameter("is_provider_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK)); - addParameter("physical_network_name", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_PHYSICALNETWORKNAME)); + addParameter("is_provider_network", extractBooleanValue (nodeEntity, "provider_network", "is_provider_network")); + addParameter("physical_network_name", extractValue(nodeEntity, "provider_network", "physical_network_name")); // extract properties - network_flows - addParameter("is_bound_to_vpn", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_ISBOUNDTOVPN)); + addParameter("is_bound_to_vpn", extractBooleanValue (nodeEntity, "network_flows", "is_bound_to_vpn")); // extract properties - network_flows - vpn_bindings - String vpnBindingString = extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_VPNBINDING); + String vpnBindingString = extractValue (nodeEntity, "network_flows", "vpn_binding"); bindingUuids = vpnBindingString.split(","); -} + } public String getServiceUUID() { return serviceUUID; @@ -113,13 +109,24 @@ public class SdncNodeModel extends SdncBaseModel { params.put("ecomp_generated_naming", "\"" + ecompGeneratedNaming + "\""); } } + public void setComplexResourceUUID(String complexResourceUuid) { + if (complexResourceUuid != null && !complexResourceUuid.isEmpty()) { + params.put("complex_resource_uuid", complexResourceUuid); + } + } + + public void setComplexResourceCustomizationUUID(String complexResourceCustomizationUuid) { + if (complexResourceCustomizationUuid != null && !complexResourceCustomizationUuid.isEmpty()) { + params.put("complex_resource_customization_uuid", complexResourceCustomizationUuid); + } + } public void insertNetworkModelData () throws IOException { try { // Clean up NETWORK_MODEL data for this customization_uuid and service_uuid? cleanUpExistingToscaData("NETWORK_MODEL", "customization_uuid", getCustomizationUUID()); cleanUpExistingToscaData("VPN_BINDINGS", "network_customization_uuid", getCustomizationUUID()); - LOG.info("Call insertToscaData for NETWORK_MODEL customizationUUID = " + getCustomizationUUID()); + LOG.info("Call insertToscaData for NETWORK_MODEL where customization_uuid = " + getCustomizationUUID()); insertToscaData(getSql(model_yaml), null); insertToscaData(getVpnBindingsSql(), null); } catch (IOException e) { @@ -127,48 +134,47 @@ public class SdncNodeModel extends SdncBaseModel { throw new IOException (e); } } - + public void insertRelatedNetworkRoleData () throws IOException { - Object propertyValue = sdcCsarHelper.getNodeTemplatePropertyValueAsObject(nodeTemplate, "network_assignments#related_networks"); - ArrayList<Map<String, String>> relatedNetworkList = (ArrayList)propertyValue; - - String networkModelCustomizationUUID = getCustomizationUUID(); + if (entityDetails.getProperties().containsKey("related_networks")) { + + Property relatedNetworksProperty = entityDetails.getProperties().get("related_networks"); + List<String> relatedNetworkRoles = relatedNetworksProperty.getLeafPropertyValue("related_network_role"); + + String networkModelCustomizationUUID = getCustomizationUUID(); - if (relatedNetworkList != null) { - - try { - cleanUpExistingToscaData("RELATED_NETWORK_ROLE", "network_model_customization_uuid", networkModelCustomizationUUID); - } catch (IOException e) { - LOG.error("Could not clean up Tosca CSAR data in the RELATED_NETWORK_ROLE table"); - throw new IOException (e); - } - - for (Map<String, String> relatedNetworkValue : relatedNetworkList) { - LOG.debug("Node Template [" + nodeTemplate.getName() + "], property [" + "related_network_role" + "] property value: " + relatedNetworkValue.get("related_network_role")); + try { + cleanUpExistingToscaData("RELATED_NETWORK_ROLE", "network_model_customization_uuid", networkModelCustomizationUUID); + } catch (IOException e) { + LOG.error("Could not clean up Tosca CSAR data in the RELATED_NETWORK_ROLE table"); + throw new IOException (e); + } + + for (String relatedNetworkRole : relatedNetworkRoles) { + + LOG.debug("Node Template [" + entityDetails.getName() + "], property [" + "related_network_role" + "] property value: " + relatedNetworkRole); - String relatedNetworkRoleValue = relatedNetworkValue.get("related_network_role"); - try { // Table cleanup RELATED_NETWORK_ROLE occurs per network // If related_network_role for this service already exist in RELATED_NETWORK_ROLE, don't attempt insertion Map<String, String> relatedNetworkRoleParamsCheck = new HashMap<String, String>(); - addParameter("related_network_role", relatedNetworkRoleValue, relatedNetworkRoleParamsCheck); + addParameter("related_network_role", relatedNetworkRole, relatedNetworkRoleParamsCheck); addParameter("network_model_customization_uuid", networkModelCustomizationUUID, relatedNetworkRoleParamsCheck); if (checkForExistingToscaData("RELATED_NETWORK_ROLE", relatedNetworkRoleParamsCheck) == false) { relatedNetworkRoleParamsCheck.remove("related_network_role"); LOG.info("Call insertToscaData for RELATED_NETWORK_ROLE where network_model_customization_uuid = " + networkModelCustomizationUUID); - insertToscaData(buildSql("RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRoleValue + "\"", model_yaml, relatedNetworkRoleParamsCheck), null); + insertToscaData(buildSql("RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRole + "\"", model_yaml, relatedNetworkRoleParamsCheck), null); } } catch (IOException e) { LOG.debug("Could not insert Tosca CSAR data into the RELATED_NETWORK_ROLE table"); throw new IOException (e); } - } - } - else { - LOG.debug("Node Template [" + nodeTemplate.getName() + "], property [" + "related_networks" + "] property value: " + null); - } + } + } + else { + LOG.debug("Node Template [" + entityDetails.getName() + "], property [" + "related_networks" + "] property value: " + null); + } } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java index d39622621..d7418824b 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java @@ -703,18 +703,22 @@ public class SdncUebCallback implements INotificationCallback { } - // Ingest Network (VL) Data - 1707 - List<NodeTemplate> vlNodeTemplatesList = sdcCsarHelper.getServiceVlList(); + // Ingest Network (VL) Data - 1707 / migrate to getEntity - 1908 + EntityQuery vlEntityQuery = EntityQuery.newBuilder(SdcTypes.VL).build(); + TopologyTemplateQuery vlTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List<IEntityDetails> vlEntities = sdcCsarHelper.getEntity(vlEntityQuery, vlTopologyTemplateQuery, false); // false to not recurse + if (vlEntities != null && !vlEntities.isEmpty()) { + for (IEntityDetails vlEntity : vlEntities){ - for (NodeTemplate nodeTemplate : vlNodeTemplatesList) { - SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, nodeTemplate, jdbcDataSource); - nodeModel.setServiceUUID(serviceModel.getServiceUUID()); + try { + SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, vlEntity, jdbcDataSource, config); + nodeModel.setServiceUUID(serviceModel.getServiceUUID()); - try { - nodeModel.insertNetworkModelData(); - nodeModel.insertRelatedNetworkRoleData(); - } catch (IOException e) { - deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + nodeModel.insertNetworkModelData(); + nodeModel.insertRelatedNetworkRoleData(); + } catch (IOException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } } } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java index bd71c0240..fc288aaa9 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java @@ -94,7 +94,7 @@ public class SdncVFCModel extends SdncBaseModel { TopologyTemplateQuery topologyTemplateQueryVFC = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(vfcCustomizationUuid).build(); List<IEntityDetails> cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVFC, true); if (cpEntities == null || cpEntities.isEmpty()) { - LOG.info("insertVFCtoNetworkRoleMappingData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); + LOG.debug("insertVFCtoNetworkRoleMappingData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); return; } @@ -282,7 +282,7 @@ public class SdncVFCModel extends SdncBaseModel { TopologyTemplateQuery topologyTemplateQueryVFC = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(vfcCustomizationUuid).build(); List<IEntityDetails> cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVFC, true); if (cpEntities == null || cpEntities.isEmpty()) { - LOG.info("insertVFCRelatedNetworkRoleData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); + LOG.debug("insertVFCRelatedNetworkRoleData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); return; } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java index 2b2d078f7..dd93f45db 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java @@ -54,7 +54,14 @@ public class SdncVFModel extends SdncBaseModel { public SdncVFModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { super(sdcCsarHelper, nodeTemplate, jdbcDataSource, config); - + + // Since SdncVFModel is not yet converted for getEntity, find the entity for this nodeTemplate + EntityQuery vfEntityQuery = EntityQuery.newBuilder(SdcTypes.VF).customizationUUID(getCustomizationUUIDNoQuotes()).build(); + TopologyTemplateQuery vfTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List<IEntityDetails> vfEntities = sdcCsarHelper.getEntity(vfEntityQuery, vfTopologyTemplateQuery, true); + if (vfEntities != null && !vfEntities.isEmpty()) { + entityDetails = vfEntities.get(0); + } // extract metadata Metadata metadata = nodeTemplate.getMetaData(); addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME)); @@ -158,7 +165,7 @@ public class SdncVFModel extends SdncBaseModel { try { cleanUpExistingToscaData("VF_MODULE_MODEL", "customization_uuid", vfModuleModel.getCustomizationUUID()); cleanUpExistingToscaData("VF_MODULE_TO_VFC_MAPPING", "vf_module_customization_uuid", vfModuleModel.getCustomizationUUID()); - LOG.info("Call insertToscaData for VF_MODULE_MODEL where vf_module_customization_uuid = " + vfModuleModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_MODULE_MODEL where customization_uuid = " + vfModuleModel.getCustomizationUUID()); insertToscaData(vfModuleModel.buildSql("VF_MODULE_MODEL", model_yaml), null); } catch (IOException e) { LOG.error("Could not insert Tosca CSAR data into the VF_MODULE_MODEL table "); @@ -175,7 +182,7 @@ public class SdncVFModel extends SdncBaseModel { .build(); List<IEntityDetails> vfModulesNonCatalog = sdcCsarHelper.getEntity(entityQuery2, topologyTemplateQuery2, false); if (vfModulesNonCatalog == null || vfModulesNonCatalog.isEmpty()) { - LOG.info("insertVFModuleData: Could not find the non-catelog VF Module for: " + vfModuleModel.getCustomizationUUID() + ". Unable to insert members into VF_MODULE_TO_VFC_MAPPING"); + LOG.debug("insertVFModuleData: Could not find the non-catelog VF Module for: " + vfModuleModel.getCustomizationUUID() + ". Unable to insert members into VF_MODULE_TO_VFC_MAPPING"); continue; } @@ -217,7 +224,7 @@ public class SdncVFModel extends SdncBaseModel { .build(); List<IEntityDetails> nestedCvfcs = sdcCsarHelper.getEntity(entityQuery3, topologyTemplateQuery3, true); // true allows for nested search if (nestedCvfcs == null || nestedCvfcs.isEmpty()) { - LOG.info("insertVFModuleData: Could not find the nested CVFCs for: " + cvfcCustomizationUuid); + LOG.debug("insertVFModuleData: Could not find the nested CVFCs for: " + cvfcCustomizationUuid); continue; } @@ -284,7 +291,7 @@ public class SdncVFModel extends SdncBaseModel { TopologyTemplateQuery topologyTemplateQueryVF = TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(getCustomizationUUIDNoQuotes()).build(); List<IEntityDetails> cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVF, true); if (cpEntities == null || cpEntities.isEmpty()) { - LOG.info("insertVFtoNetworkRoleMappingData: Could not find CPs for VF: " + getCustomizationUUIDNoQuotes()); + LOG.debug("insertVFtoNetworkRoleMappingData: Could not find CPs for VF: " + getCustomizationUUIDNoQuotes()); return; } @@ -343,7 +350,7 @@ public class SdncVFModel extends SdncBaseModel { .build(); List<IEntityDetails> cvfcEntities = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, true); // true allows for nested search if (cvfcEntities == null || cvfcEntities.isEmpty()) { - LOG.info("insertVFCDataEntity: Could not find the CVFCs for: " + vfCustomizationUid); + LOG.debug("insertVFCDataEntity: Could not find the CVFCs for: " + vfCustomizationUid); } for (IEntityDetails cvfcEntity: cvfcEntities) { @@ -382,8 +389,8 @@ public class SdncVFModel extends SdncBaseModel { for (IEntityDetails group : vfcInstanceGroupListForVf){ - SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, nodeTemplate, config, jdbcDataSource); - groupModel.insertGroupData(nodeTemplate); + SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, entityDetails, config, jdbcDataSource); + groupModel.insertGroupData(getUUID()); // For each group, populate NODE_CAPABILITY/NODE_CAPABILITY_PROPERTY insertNodeCapabilitiesEntityData(group.getCapabilities()); @@ -419,7 +426,7 @@ public class SdncVFModel extends SdncBaseModel { break; } addParameter("table_name", tableName, mappingParams); - LOG.info("Call insertToscaData for RESOURCE_GROUP_TO_TARGET_NODE_MAPPING where group_uuid = " + groupModel.getUUID() + " and target_node_uuid = " + targetNodeUuid); + LOG.info("Call insertToscaData for RESOURCE_GROUP_TO_TARGET_NODE_MAPPING where group_uuid = " + groupModel.getUUID() + " and target_node_uuid = \"" + targetNodeUuid + "\""); insertToscaData(buildSql("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", "group_uuid", groupModel.getUUID(), model_yaml, mappingParams), null); } catch (IOException e) { LOG.error("Could not insert Tosca CSAR data into the RESOURCE_GROUP_TO_TARGET_NODE_MAPPING"); |