Search in sources :

Example 1 with LicenseDemand

use of org.onap.so.client.oof.beans.LicenseDemand in project so by onap.

the class OofHomingV2 method buildLicenseDemand.

/**
 * Builds a single license demand object
 */
private LicenseDemand buildLicenseDemand(String id, ModelInfoMetadata metadata) {
    logger.debug("Building demand for service or resource: " + id);
    LicenseDemand demand = new LicenseDemand();
    if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
        demand.setServiceResourceId(id);
        demand.setResourceModuleName(metadata.getModelInstanceName());
        demand.setResourceModelInfo(buildModelInfo(metadata));
    } else {
        throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
    }
    return demand;
}
Also used : LicenseDemand(org.onap.so.client.oof.beans.LicenseDemand) BpmnError(org.camunda.bpm.engine.delegate.BpmnError)

Example 2 with LicenseDemand

use of org.onap.so.client.oof.beans.LicenseDemand in project so by onap.

the class OofHomingV2 method buildLicenseInfo.

/**
 * Builds the license demand list for the homing/licensing request
 */
private LicenseInfo buildLicenseInfo(ServiceInstance serviceInstance) {
    logger.trace("Building license information");
    LicenseInfo licenseInfo = new LicenseInfo();
    List<GenericVnf> vnfList = serviceInstance.getVnfs();
    if (!vnfList.isEmpty()) {
        logger.debug("Adding vnfs to license demands list");
        for (GenericVnf vnf : vnfList) {
            LicenseDemand demand = buildLicenseDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
            licenseInfo.getLicenseDemands().add(demand);
        }
    }
    return licenseInfo;
}
Also used : LicenseInfo(org.onap.so.client.oof.beans.LicenseInfo) LicenseDemand(org.onap.so.client.oof.beans.LicenseDemand) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)

Aggregations

LicenseDemand (org.onap.so.client.oof.beans.LicenseDemand)2 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)1 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)1 LicenseInfo (org.onap.so.client.oof.beans.LicenseInfo)1