Search in sources :

Example 41 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel 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.rev171025.PlspId)

Example 42 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method reportToAll.

protected void reportToAll(final Updates update, final PCCSession session) {
    final PlspId plspId = update.getLsp().getPlspId();
    final PCCTunnel tunnel = this.tunnels.get(plspId);
    final long srpId = update.getSrp().getOperationId().getValue();
    if (tunnel != null) {
        if (hasDelegation(tunnel, session)) {
            final Srp srp = createSrp(update.getSrp().getOperationId().getValue());
            final Path path = updToRptPath(update.getPath());
            final List<Subobject> subobjects = update.getPath().getEro().getSubobject();
            final Lsp lsp = update.getLsp();
            sendToAll(tunnel, plspId, subobjects, srp, path, lsp);
            // update tunnel state
            tunnel.setLspState(path);
        } else {
            session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UPDATE_REQ_FOR_NON_LSP, srpId));
        }
    } else {
        session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UNKNOWN_PLSP_ID, srpId));
    }
}
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) MsgBuilderUtil.updToRptPath(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.updToRptPath) MsgBuilderUtil.reqToRptPath(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.reqToRptPath) MsgBuilderUtil.createPath(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createPath) Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject) MsgBuilderUtil.createLsp(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLsp) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 43 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel 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 44 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel 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 45 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel 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)

Aggregations

BigInteger (java.math.BigInteger)45 ArrayList (java.util.ArrayList)43 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)27 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)23 ExecutionException (java.util.concurrent.ExecutionException)19 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)17 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)17 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)17 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)16 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)15 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)14 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)12 List (java.util.List)12 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)12 Test (org.junit.Test)8 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)8 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)7 IfTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder)7 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)7