Search in sources :

Example 6 with PathComputationClientBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.tunnel.pcep.supporting.node.attributes.PathComputationClientBuilder in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener method onSessionUp.

@Override
protected void onSessionUp(final PCEPSession session, final PathComputationClientBuilder pccBuilder) {
    final InetAddress peerAddress = session.getRemoteAddress();
    final Tlvs tlvs = session.getRemoteTlvs();
    if (tlvs != null && tlvs.getAugmentation(Tlvs1.class) != null) {
        final Stateful stateful = tlvs.getAugmentation(Tlvs1.class).getStateful();
        if (stateful != null) {
            setStatefulCapabilities(stateful);
            pccBuilder.setReportedLsp(Collections.emptyList());
            if (isSynchronized()) {
                pccBuilder.setStateSync(PccSyncState.Synchronized);
            } else if (isTriggeredInitialSynchro()) {
                pccBuilder.setStateSync(PccSyncState.TriggeredInitialSync);
            } else if (isIncrementalSynchro()) {
                pccBuilder.setStateSync(PccSyncState.IncrementalSync);
            } else {
                pccBuilder.setStateSync(PccSyncState.InitialResync);
            }
            pccBuilder.setStatefulTlv(new StatefulTlvBuilder().addAugmentation(StatefulTlv1.class, new StatefulTlv1Builder(tlvs.getAugmentation(Tlvs1.class)).build()).build());
        } else {
            LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
        }
    } else {
        LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
    }
}
Also used : Stateful(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.stateful.capability.tlv.Stateful) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs) StatefulTlv1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.StatefulTlv1Builder) InetAddress(java.net.InetAddress) Tlvs1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1) StatefulTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.StatefulTlvBuilder)

Example 7 with PathComputationClientBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.tunnel.pcep.supporting.node.attributes.PathComputationClientBuilder in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener method manageNextReport.

private boolean manageNextReport(final Reports report, final MessageContext ctx) {
    final Lsp lsp = report.getLsp();
    final PlspId plspid = lsp.getPlspId();
    final Srp srp = report.getSrp();
    if (!lsp.isSync() && (plspid == null || plspid.getValue() == 0)) {
        purgeStaleLsps(ctx);
        if (isTriggeredSyncInProcess()) {
            if (srp == null) {
                return false;
            }
            final SrpIdNumber id = srp.getOperationId();
            if (id.getValue() == 0) {
                return false;
            }
            final PCEPRequest req = removeRequest(id);
            ctx.resolveRequest(req);
        }
        stateSynchronizationAchieved(ctx);
        return true;
    }
    final ReportedLspBuilder rlb = new ReportedLspBuilder();
    boolean solicited = false;
    solicited = isSolicited(srp, lsp, ctx, rlb);
    // if remove flag is set in SRP object, remove the tunnel immediately
    if (solicited && srp.getAugmentation(Srp1.class) != null) {
        final Srp1 initiatedSrp = srp.getAugmentation(Srp1.class);
        if (initiatedSrp.isRemove()) {
            super.removeLsp(ctx, plspid);
            return false;
        }
    }
    rlb.setPath(Collections.singletonList(buildPath(report, srp, lsp)));
    String name = lookupLspName(plspid);
    if (lsp.getTlvs() != null && lsp.getTlvs().getSymbolicPathName() != null) {
        name = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(lsp.getTlvs().getSymbolicPathName().getPathName().getValue())).toString();
    }
    // get LspDB from LSP and write it to pcc's node
    final LspDbVersion lspDbVersion = geLspDbVersionTlv(lsp);
    if (lspDbVersion != null) {
        updatePccNode(ctx, new PathComputationClientBuilder().addAugmentation(PathComputationClient1.class, new PathComputationClient1Builder().setLspDbVersion(lspDbVersion).build()).build());
    }
    updateLsp(ctx, plspid, name, rlb, solicited, lsp.isRemove());
    unmarkStaleLsp(plspid);
    LOG.debug("LSP {} updated", lsp);
    return true;
}
Also used : Srp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.Srp) Srp1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber) ReportedLspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLspBuilder) LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion) PathComputationClientBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClientBuilder) PathComputationClient1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.PathComputationClient1Builder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 8 with PathComputationClientBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.tunnel.pcep.supporting.node.attributes.PathComputationClientBuilder in project bgpcep by opendaylight.

the class AbstractTopologySessionListener method stateSynchronizationAchieved.

/**
 * Indicate that the peer has completed state synchronization.
 *
 * @param ctx Message context
 */
protected final synchronized void stateSynchronizationAchieved(final MessageContext ctx) {
    if (this.synced.getAndSet(true)) {
        LOG.debug("State synchronization achieved while synchronizing, not updating state");
        return;
    }
    if (this.triggeredResyncInProcess) {
        this.triggeredResyncInProcess = false;
    }
    updatePccNode(ctx, new PathComputationClientBuilder().setStateSync(PccSyncState.Synchronized).build());
    // The node has completed synchronization, cleanup metadata no longer reported back
    this.nodeState.cleanupExcept(this.lsps.values());
    LOG.debug("Session {} achieved synchronized state", this.session);
}
Also used : PathComputationClientBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClientBuilder)

Aggregations

PathComputationClientBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClientBuilder)5 InetAddress (java.net.InetAddress)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 Node1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.Node1Builder)2 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)2 ReportedLspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLspBuilder)2 SupportingNode1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.SupportingNode1Builder)2 PathComputationClientBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.tunnel.pcep.supporting.node.attributes.PathComputationClientBuilder)2 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)2 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)2 SupportingNodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder)2 SupportingNodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 PCEPCloseTermination (org.opendaylight.protocol.pcep.PCEPCloseTermination)1 PathComputationClient1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.PathComputationClient1Builder)1 LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)1 Bandwidth (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth)1 Srp1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1)1 Path1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Path1Builder)1