Search in sources :

Example 11 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.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(Uint32.valueOf(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(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.rev200720.lsp.object.LspBuilder) Lsp1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Lsp1Builder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Example 12 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.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 Uint32 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.empty());
            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.rev200720.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.rev200720.lsp.object.LspBuilder) Uint32(org.opendaylight.yangtools.yang.common.Uint32) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Example 13 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.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(Uint32.ZERO), new PathBuilder().build(), createLsp(plspId.getValue(), false, Optional.empty(), 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.rev200720.pcrpt.message.pcrpt.message.reports.PathBuilder) Timeout(io.netty.util.Timeout)

Example 14 with PlspId

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

the class PCCTunnelManagerImpl method onSessionDown.

@Override
public synchronized void onSessionDown(final PCCSession session) {
    for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
        final PCCTunnel tunnel = entry.getValue();
        final PlspId plspId = entry.getKey();
        // deal with delegations
        if (hasDelegation(tunnel, session)) {
            startStateTimeout(tunnel, entry.getKey());
            startRedelegationTimer(tunnel, plspId, session);
        }
    }
}
Also used : PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Example 15 with PlspId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.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 Uint32 plspId = entry.getKey().getValue();
        createLspAndSendReport(plspId, tunnel, session, Optional.empty(), Optional.ofNullable(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.rev200720.srp.object.Srp) SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder) Uint32(org.opendaylight.yangtools.yang.common.Uint32) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Aggregations

PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)31 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder)22 Test (org.junit.Test)18 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)14 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)14 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)12 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt)10 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)10 Lsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.Lsp)9 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs)9 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder)8 LspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId)8 Srp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp)7 Collections (java.util.Collections)6 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)6 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber)6 ByteBuf (io.netty.buffer.ByteBuf)5 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)5 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)5 SymbolicPathNameBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder)5