Search in sources :

Example 1 with PCCSession

use of org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method startRedelegationTimer.

private void startRedelegationTimer(final PCCTunnel tunnel, final PlspId plspId, final PCCSession session) {
    final Timeout newRedelegationTimeout = this.timer.newTimeout(timeout -> {
        // remove delegation
        PCCTunnelManagerImpl.this.setDelegation(plspId, null);
        // delegate to another PCE
        int index = session.getId();
        for (int i = 1; i < PCCTunnelManagerImpl.this.sessions.size(); i++) {
            index++;
            if (index == PCCTunnelManagerImpl.this.sessions.size()) {
                index = 0;
            }
            final PCCSession nextSession = PCCTunnelManagerImpl.this.sessions.get(index);
            if (nextSession != null) {
                tunnel.cancelTimeouts();
                final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
                nextSession.sendReport(createPcRtpMessage(createLsp(plspId.getValue(), true, Optional.fromNullable(tlvs), true, false), NO_SRP, tunnel.getLspState()));
                tunnel.setDelegationHolder(nextSession.getId());
                break;
            }
        }
    }, this.redelegationTimeout, TimeUnit.SECONDS);
    tunnel.setRedelegationTimeout(newRedelegationTimeout);
}
Also used : PCCSession(org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession) 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) Timeout(io.netty.util.Timeout)

Example 2 with PCCSession

use of org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method sendToAll.

private void sendToAll(final PCCTunnel tunnel, final PlspId plspId, final List<Subobject> subobjects, final Srp srp, final Path path, final Lsp lsp) {
    for (final PCCSession session : this.sessions.values()) {
        final boolean isDelegated = hasDelegation(tunnel, session);
        final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.of(subobjects));
        final Pcrpt pcRpt = createPcRtpMessage(new LspBuilder(lsp).setPlspId(plspId).setOperational(OperationalStatus.Up).setDelegate(isDelegated).setSync(true).addAugmentation(Lsp1.class, new Lsp1Builder().setCreate(tunnel.getType() == LspType.PCE_LSP).build()).setTlvs(tlvs).build(), Optional.fromNullable(srp), path);
        session.sendReport(pcRpt);
    }
}
Also used : PCCSession(org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession) 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) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) 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) Lsp1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1)

Aggregations

PCCSession (org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession)2 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)2 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)2 Timeout (io.netty.util.Timeout)1 Lsp1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1)1 Lsp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1Builder)1 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)1 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)1