Search in sources :

Example 11 with Pnf

use of org.onap.aai.domain.yang.Pnf in project so by onap.

the class PrepareConfigDeployDelegate method setIpAddress.

private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties, DelegateExecution delegateExecution) {
    /**
     * Retrieve PNF entry from AAI.
     */
    try {
        String pnfName = (String) delegateExecution.getVariable(PNF_CORRELATION_ID);
        Optional<Pnf> pnfOptional = pnfManagement.getEntryFor(pnfName);
        if (pnfOptional.isPresent()) {
            Pnf pnf = pnfOptional.get();
            /**
             * PRH patches the AAI with oam address. Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy
             * request.
             */
            configDeployProperties.setPnfIpV4Address(pnf.getIpaddressV4Oam());
            configDeployProperties.setPnfIpV6Address(pnf.getIpaddressV6Oam());
        } else {
            exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "AAI entry for PNF: " + pnfName + " does not exist");
        }
    } catch (IOException e) {
        logger.warn(e.getMessage(), e);
        exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to fetch from AAI" + e.getMessage());
    }
}
Also used : ConfigDeployRequestPnf(org.onap.so.client.cds.beans.ConfigDeployRequestPnf) Pnf(org.onap.aai.domain.yang.Pnf) ConfigDeployPropertiesForPnf(org.onap.so.client.cds.beans.ConfigDeployPropertiesForPnf) IOException(java.io.IOException)

Example 12 with Pnf

use of org.onap.aai.domain.yang.Pnf in project so by onap.

the class UpdatePnfEntryInAai method execute.

@Override
public void execute(DelegateExecution execution) throws Exception {
    String pnfCorrelationId = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
    Optional<Pnf> pnfAaiEntry = pnfManagement.getEntryFor(pnfCorrelationId);
    if (!pnfAaiEntry.isPresent()) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 404, "AAI entry for PNF: " + PNF_CORRELATION_ID + " does not exist");
    }
    Pnf pnf = pnfAaiEntry.get();
    String pnfSoftwareVersion = String.valueOf(execution.getVariable(PRC_TARGET_SOFTWARE_VERSION));
    pnf.setSwVersion(pnfSoftwareVersion);
    pnfManagement.updateEntry(pnfCorrelationId, pnf);
    logger.debug("AAI entry is updated for pnf correlation id: {}, pnf uuid: {} with swVersion: {}", pnf.getPnfName(), pnfCorrelationId, pnfSoftwareVersion);
}
Also used : Pnf(org.onap.aai.domain.yang.Pnf)

Aggregations

Pnf (org.onap.aai.domain.yang.Pnf)12 IOException (java.io.IOException)2 Map (java.util.Map)2 Relationship (org.onap.aai.domain.yang.Relationship)2 ConfigDeployPropertiesForPnf (org.onap.so.client.cds.beans.ConfigDeployPropertiesForPnf)2 ConfigDeployRequestPnf (org.onap.so.client.cds.beans.ConfigDeployRequestPnf)2 PnfResourceCustomization (org.onap.so.db.catalog.beans.PnfResourceCustomization)2 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)2 HashMap (java.util.HashMap)1 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)1 Test (org.junit.Test)1 PInterface (org.onap.aai.domain.yang.PInterface)1