Search in sources :

Example 1 with Pnf

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

the class GenericPnfDispatcher 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;
    if (delegateExecution.getVariable(PNF_NAME) == null || String.valueOf(delegateExecution.getVariable(PNF_NAME)).trim().isEmpty()) {
        pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
    } else {
        pnfName = String.valueOf(delegateExecution.getVariable(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 dispatcher request for PNF.");
}
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 2 with Pnf

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

the class ServicePluginFactory method getTpInfoFromLocalTp.

private void getTpInfoFromLocalTp(Map<String, Object> tpInfo, Optional<Pnf> optLocalPnf) {
    if (optLocalPnf.isPresent()) {
        Pnf localPnf = optLocalPnf.get();
        for (Relationship rel : localPnf.getRelationshipList().getRelationship()) {
            if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
                String[] networkRef = rel.getRelatedLink().substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
                if (networkRef.length == 6) {
                    tpInfo.put("local-access-provider-id", networkRef[1]);
                    tpInfo.put("local-access-client-id", networkRef[3]);
                    tpInfo.put("local-access-topology-id", networkRef[5]);
                }
            }
        }
    }
}
Also used : Relationship(org.onap.aai.domain.yang.Relationship) Pnf(org.onap.aai.domain.yang.Pnf)

Example 3 with Pnf

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

the class ServicePluginFactory method getTPInfo.

private Map<String, Object> getTPInfo(AAIResourcesClient client, AAIResourceUri localTP, AAIResourceUri remoteTP) {
    Map<String, Object> tpInfo = new HashMap<>();
    if (localTP != null && remoteTP != null) {
        // give local tp
        String tpUrl = localTP.build().toString();
        String localNodeId = tpUrl.split("/")[4];
        tpInfo.put("local-access-node-id", localNodeId);
        logger.info("Get info for local TP :{}", localNodeId);
        Optional<Pnf> optLocalPnf = client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(localNodeId)));
        getTpInfoFromLocalTp(tpInfo, optLocalPnf);
        String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
        if (ltpIdStr.contains("-")) {
            tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
        }
        // give remote tp
        tpUrl = remoteTP.build().toString();
        PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
        String remoteNodeId = tpUrl.split("/")[4];
        tpInfo.put("remote-access-node-id", remoteNodeId);
        logger.info("Get info for remote TP:{}", remoteNodeId);
        String[] networkRefRemote = intfRemote.getNetworkRef().split("-");
        Optional<Pnf> optRemotePnf = client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(remoteNodeId)));
        getTpInfoFromRemoteTp(tpInfo, networkRefRemote, optRemotePnf);
        String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
        if (ltpIdStrR.contains("-")) {
            tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
        }
    }
    return tpInfo;
}
Also used : PInterface(org.onap.aai.domain.yang.PInterface) HashMap(java.util.HashMap) Pnf(org.onap.aai.domain.yang.Pnf)

Example 4 with Pnf

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

the class ServicePluginFactory method getTpInfoFromRemoteTp.

private void getTpInfoFromRemoteTp(Map<String, Object> tpInfo, String[] networkRefRemote, Optional<Pnf> optRemotePnf) {
    if (optRemotePnf.isPresent()) {
        Pnf remotePnf = optRemotePnf.get();
        for (Relationship rel : remotePnf.getRelationshipList().getRelationship()) {
            if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
                String[] networkRef = rel.getRelatedLink().substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
                if (networkRef.length == 6) {
                    tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
                    tpInfo.put("remote-access-client-id", networkRefRemote[3]);
                    tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
                }
            }
        }
    }
}
Also used : Relationship(org.onap.aai.domain.yang.Relationship) Pnf(org.onap.aai.domain.yang.Pnf)

Example 5 with Pnf

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

the class CreatePnfEntryInAaiDelegate method execute.

@Override
public void execute(DelegateExecution execution) throws Exception {
    String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
    String pnfUuid = (String) execution.getVariable(PNF_UUID);
    Pnf pnf = new Pnf();
    pnf.setPnfId(pnfUuid);
    pnf.setPnfName(pnfCorrelationId);
    pnfManagement.createEntry(pnfCorrelationId, pnf);
    logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId, pnfUuid);
}
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