Search in sources :

Example 6 with Pnf

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 ");
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) Pnf(org.onap.aai.domain.yang.Pnf) Map(java.util.Map) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 7 with Pnf

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));
}
Also used : Pnf(org.onap.aai.domain.yang.Pnf)

Example 8 with 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));
}
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)

Example 9 with 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();
    }
}
Also used : Pnf(org.onap.aai.domain.yang.Pnf) IOException(java.io.IOException)

Example 10 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)

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