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());
}
}
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);
}
Aggregations