use of org.onap.aai.domain.yang.Pnf in project so by onap.
the class NfSoftwareUpgradeDispatcher method execute.
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName());
RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
final String serviceInstanceName = bpmnRequestDetails.getRequestInfo().getInstanceName();
final String pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
final String serviceModelUuid = bpmnRequestDetails.getModelInfo().getModelUuid();
final List<Map<String, Object>> userParams = bpmnRequestDetails.getRequestParameters().getUserParams();
final Pnf pnf = getPnfByPnfName(delegateExecution, pnfName);
final List<PnfResourceCustomization> pnfCustomizations = getPnfResourceCustomizations(delegateExecution, serviceModelUuid);
final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
final String payload = bpmnRequestDetails.getRequestParameters().getPayload();
populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName, pnfName, serviceModelUuid, userParams, payload);
logger.trace("Completed preProcessRequest PnfSoftwareUpgradeServiceRequest Request ");
}
use of org.onap.aai.domain.yang.Pnf in project so by onap.
the class NfSoftwareUpgradeDispatcherTest method mockAai.
private void mockAai() throws IOException {
Pnf pnf = new Pnf();
pnf.setPnfId(TEST_PNF_UUID);
when(pnfManagement.getEntryFor(TEST_PNF_CORRELATION_ID)).thenReturn(Optional.of(pnf));
}
use of org.onap.aai.domain.yang.Pnf in project so by onap.
the class PrepareConfigDeployDelegateTest method mockAai.
private void mockAai() throws IOException {
Pnf pnf = new Pnf();
pnf.setIpaddressV4Oam(TEST_IPV4_ADDRESS);
pnf.setIpaddressV6Oam(TEST_IPV6_ADDRESS);
when(pnfManagement.getEntryFor(TEST_PNF_CORRELATION_ID)).thenReturn(Optional.of(pnf));
}
use of org.onap.aai.domain.yang.Pnf in project so by onap.
the class UpdatePnfEntryInAaiTest method setupPnf.
private void setupPnf() {
try {
Pnf pnf = new Pnf();
pnf.setSwVersion("1");
pnf.setPnfId("testtest");
pnf.setPnfName("testPnfCorrelationId");
doReturn(Optional.of(pnf)).when(pnfManagementTest).getEntryFor(anyString());
} catch (IOException e) {
e.printStackTrace();
}
}
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());
}
}
Aggregations