use of org.onap.so.db.catalog.beans.VFCInstanceGroup in project so by onap.
the class QueryGroupsTest method createList.
private List<VnfcInstanceGroupCustomization> createList() {
VnfcCustomization vnfcCustomization = new VnfcCustomization();
vnfcCustomization.setModelCustomizationUUID("test");
vnfcCustomization.setModelVersion("test");
vnfcCustomization.setModelInvariantUUID("test");
vnfcCustomization.setModelName("test");
VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
vfcInstanceGroup.setModelName("test");
vfcInstanceGroup.setModelUUID("test");
vfcInstanceGroup.setModelInvariantUUID("test");
vfcInstanceGroup.setModelVersion("test");
VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = new VnfcInstanceGroupCustomization();
vnfcInstanceGroupCustomization.setVnfcCustomizations(Arrays.asList(vnfcCustomization));
vnfcInstanceGroupCustomization.setInstanceGroup(vfcInstanceGroup);
vfcInstanceGroup.setVnfcInstanceGroupCustomizations(Arrays.asList(vnfcInstanceGroupCustomization));
return Arrays.asList(vnfcInstanceGroupCustomization);
}
use of org.onap.so.db.catalog.beans.VFCInstanceGroup in project so by onap.
the class ToscaResourceInstaller method createVNFCInstanceGroup.
protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(IEntityDetails vfcInstanceEntity, IEntityDetails vfEntityDetails, VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure, Set<VnfcCustomization> existingVnfcGroupSet) {
Metadata instanceMetadata = vfcInstanceEntity.getMetadata();
InstanceGroup existingInstanceGroup = instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
VFCInstanceGroup vfcInstanceGroup;
if (existingInstanceGroup == null) {
// Populate InstanceGroup
vfcInstanceGroup = new VFCInstanceGroup();
vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
vfcInstanceGroup.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
vfcInstanceGroup.setToscaNodeType(vfcInstanceEntity.getToscaType());
// Set Role
vfcInstanceGroup.setRole("SUB-INTERFACE");
// Set type
vfcInstanceGroup.setType(InstanceGroupType.VNFC);
} else {
vfcInstanceGroup = (VFCInstanceGroup) existingInstanceGroup;
}
// Populate VNFCInstanceGroupCustomization
VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization();
vfcInstanceGroupCustom.setVnfResourceCust(vnfResourceCustomization);
vnfResourceCustomization.getVnfcInstanceGroupCustomizations().add(vfcInstanceGroupCustom);
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
vfcInstanceGroup.getVnfcInstanceGroupCustomizations().add(vfcInstanceGroupCustom);
vfcInstanceGroupCustom.setDescription(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
String getInputName = null;
Map<String, Property> groupProperties = vfcInstanceEntity.getProperties();
for (String key : groupProperties.keySet()) {
Property property = groupProperties.get(key);
String vfcName = property.getName();
if (vfcName != null) {
if (vfcName.equals("vfc_instance_group_function")) {
String vfcValue = property.getValue().toString();
int getInputIndex = vfcValue.indexOf("{get_input=");
if (getInputIndex > -1) {
getInputName = vfcValue.substring(getInputIndex + 11, vfcValue.length() - 1);
}
}
}
}
List<IEntityDetails> serviceEntityList = getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VF).customizationUUID(vnfResourceCustomization.getModelCustomizationUUID()), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
if (serviceEntityList != null && !serviceEntityList.isEmpty()) {
vfcInstanceGroupCustom.setFunction(getLeafPropertyValue(serviceEntityList.get(0), getInputName));
}
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
List<Input> inputs = vfEntityDetails.getInputs();
createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs, existingVnfcGroupSet);
return vfcInstanceGroupCustom;
}
Aggregations