Search in sources :

Example 21 with ReportedLsp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp in project bgpcep by opendaylight.

the class PCEPTopologySessionListener method ensureLspOperational.

@Override
public synchronized ListenableFuture<OperationResult> ensureLspOperational(final EnsureLspOperationalInput input) {
    checkArgument(input != null && input.getName() != null && input.getNode() != null, MISSING_XML_TAG);
    final Arguments args = input.getArguments();
    checkArgument(args != null, MISSING_XML_TAG);
    final OperationalStatus op;
    final Arguments1 aa = args.augmentation(Arguments1.class);
    if (aa != null) {
        op = aa.getOperational();
    } else {
        op = null;
    }
    // Make sure the LSP exists
    final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
    LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
    final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
    return f == null ? OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future() : listenableFuture(f, input, op);
}
Also used : ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp) Optional(java.util.Optional) Arguments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments) OperationalStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.OperationalStatus) Arguments1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Arguments1)

Example 22 with ReportedLsp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp in project bgpcep by opendaylight.

the class PCEPTopologySessionListener method validateReportedLsp.

@Override
protected Lsp validateReportedLsp(final Optional<ReportedLsp> rep, final LspId input) {
    if (!rep.isPresent()) {
        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
        return null;
    }
    // it doesn't matter how many lsps there are in the path list, we only need data that is the same in each path
    final Path1 ra = rep.get().getPath().values().iterator().next().augmentation(Path1.class);
    checkState(ra != null, "Reported LSP reported null from data-store.");
    final Lsp reportedLsp = ra.getLsp();
    checkState(reportedLsp != null, "Reported LSP does not contain LSP object.");
    return reportedLsp;
}
Also used : Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.Lsp) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp) Path1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Path1)

Example 23 with ReportedLsp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp in project bgpcep by opendaylight.

the class PCEPTopologySessionListener method loadLspData.

/**
 * Recover lspData and mark any LSPs in the LSP database that were previously reported by the PCC as stale.
 */
@Override
protected synchronized void loadLspData(final Node node, final Map<String, ReportedLsp> lspData, final Map<PlspId, String> lsps, final boolean incrementalSynchro) {
    // load node's lsps from DS
    final PathComputationClient pcc = node.augmentation(Node1.class).getPathComputationClient();
    for (final ReportedLsp reportedLsp : pcc.nonnullReportedLsp().values()) {
        final String lspName = reportedLsp.getName();
        lspData.put(lspName, reportedLsp);
        if (!reportedLsp.getPath().isEmpty()) {
            final Path1 path1 = reportedLsp.getPath().values().iterator().next().augmentation(Path1.class);
            if (path1 != null) {
                final PlspId plspId = path1.getLsp().getPlspId();
                if (!incrementalSynchro) {
                    staleLsps.add(plspId);
                }
                lsps.put(plspId, lspName);
            }
        }
    }
}
Also used : Node1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.Node1) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp) PathComputationClient(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.PathComputationClient) Path1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Path1) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Aggregations

ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp)9 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)6 Path (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path)6 Collections (java.util.Collections)5 Path1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Path1)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)3 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.Requests)3 RequestsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.RequestsBuilder)3 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder)3 ReportedLspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLspBuilder)3 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)3 Optional (com.google.common.base.Optional)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 Bandwidth (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth)2 NetworkTopologyRef (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef)2 PcinitiateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.PcinitiateBuilder)2