Search in sources :

Example 6 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method reportMissedLsp.

/**
 * Reports Missed Lsp when DbVersion doesnt match.
 */
private void reportMissedLsp(final PCCSession session) {
    for (long missedLsp = this.syncOptimization.getRemoteLspDbVersionValue().longValue() + 1; missedLsp <= this.syncOptimization.getLocalLspDbVersionValue().longValue(); missedLsp++) {
        final PlspId plspId = new PlspId(missedLsp);
        final PCCTunnel tunnel = this.tunnels.get(plspId);
        createLspAndSendReport(missedLsp, tunnel, session, Optional.absent(), NO_SRP);
    }
}
Also used : PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 7 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method takeDelegation.

protected void takeDelegation(final Requests request, final PCCSession session) {
    final PlspId plspId = request.getLsp().getPlspId();
    final PCCTunnel tunnel = this.tunnels.get(plspId);
    final long srpId = request.getSrp().getOperationId().getValue();
    if (tunnel != null) {
        // check if tunnel has no delegation
        if ((tunnel.getType() == LspType.PCE_LSP) && ((tunnel.getDelegationHolder() == -1) || (tunnel.getDelegationHolder() == session.getId()))) {
            // set delegation
            tunnel.cancelTimeouts();
            setDelegation(plspId, session);
            // send report
            final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
            session.sendReport(createPcRtpMessage(new LspBuilder(request.getLsp()).setSync(true).setOperational(OperationalStatus.Up).setDelegate(true).setTlvs(tlvs).build(), Optional.of(createSrp(srpId)), tunnel.getLspState()));
        } else {
            session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.LSP_NOT_PCE_INITIATED, srpId));
        }
    } else {
        session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UNKNOWN_PLSP_ID, srpId));
    }
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs) MsgBuilderUtil.createLspTlvs(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 8 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method reportAllKnownLsp.

private void reportAllKnownLsp(final Optional<SrpIdNumber> operationId, final PCCSession session) {
    Srp srp = null;
    if (operationId.isPresent()) {
        srp = new SrpBuilder().setOperationId(operationId.get()).build();
    }
    for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
        final PCCTunnel tunnel = entry.getValue();
        final long plspId = entry.getKey().getValue();
        createLspAndSendReport(plspId, tunnel, session, Optional.absent(), Optional.fromNullable(srp));
    }
}
Also used : MsgBuilderUtil.createSrp(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createSrp) Srp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.Srp) SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 9 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method addTunnel.

protected void addTunnel(final Requests request, final PCCSession session) {
    final PlspId plspId = new PlspId(this.plspIDsCounter.incrementAndGet());
    final PCCTunnel tunnel = new PCCTunnel(request.getLsp().getTlvs().getSymbolicPathName().getPathName().getValue(), session.getId(), LspType.PCE_LSP, reqToRptPath(request));
    sendToAll(tunnel, plspId, request.getEro().getSubobject(), createSrp(request.getSrp().getOperationId().getValue()), tunnel.getLspState(), new LspBuilder(request.getLsp()).addAugmentation(Lsp1.class, new Lsp1Builder().setCreate(true).build()).build());
    this.tunnels.put(plspId, tunnel);
}
Also used : LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) Lsp1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1Builder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 10 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method startStateTimeout.

private void startStateTimeout(final PCCTunnel tunnel, final PlspId plspId) {
    if (this.stateTimeout > -1) {
        final Timeout newStateTimeout = this.timer.newTimeout(timeout -> {
            if (tunnel.getType() == LspType.PCE_LSP) {
                PCCTunnelManagerImpl.this.tunnels.remove(plspId);
                // report tunnel removal to all
                sendToAll(tunnel, plspId, Collections.emptyList(), createSrp(0), new PathBuilder().build(), createLsp(plspId.getValue(), false, Optional.absent(), false, true));
            }
        }, this.stateTimeout, TimeUnit.SECONDS);
        tunnel.setStateTimeout(newStateTimeout);
    }
}
Also used : PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.PathBuilder) Timeout(io.netty.util.Timeout)

Aggregations

PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)34 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)26 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder)12 Test (org.junit.Test)11 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)10 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)9 Lsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp)9 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)9 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)8 Srp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.Srp)8 UpdatesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.UpdatesBuilder)6 PathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.updates.PathBuilder)6 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)5 LspIdentifiersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder)5 EroBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder)5 LspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId)5 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)5 Collections (java.util.Collections)4 Lsp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1Builder)4 Pcinitiate (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate)4