Search in sources :

Example 11 with LspDbVersion

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion in project bgpcep by opendaylight.

the class PCEPStatefulPeerProposal method setPeerProposal.

void setPeerProposal(final NodeId nodeId, final TlvsBuilder openTlvsBuilder, final byte[] speakerId) {
    if (isSynOptimizationEnabled(openTlvsBuilder)) {
        Optional<LspDbVersion> result = Optional.absent();
        try (ReadOnlyTransaction rTx = this.dataBroker.newReadOnlyTransaction()) {
            final ListenableFuture<Optional<LspDbVersion>> future = rTx.read(LogicalDatastoreType.OPERATIONAL, this.topologyId.child(Node.class, new NodeKey(nodeId)).augmentation(Node1.class).child(PathComputationClient.class).augmentation(PathComputationClient1.class).child(LspDbVersion.class));
            try {
                result = future.get();
            } catch (final InterruptedException | ExecutionException e) {
                LOG.warn("Failed to read toplogy {}.", InstanceIdentifier.keyOf(PCEPStatefulPeerProposal.this.topologyId), e);
            }
        }
        if (speakerId == null && !result.isPresent()) {
            return;
        }
        final Tlvs3Builder syncBuilder = new Tlvs3Builder();
        if (result.isPresent()) {
            syncBuilder.setLspDbVersion(result.get());
        }
        if (speakerId != null) {
            syncBuilder.setSpeakerEntityId(new SpeakerEntityIdBuilder().setSpeakerEntityIdValue(speakerId).build());
        }
        openTlvsBuilder.addAugmentation(Tlvs3.class, syncBuilder.build()).build();
    }
}
Also used : Optional(com.google.common.base.Optional) PathComputationClient(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClient) SpeakerEntityIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.speaker.entity.id.tlv.SpeakerEntityIdBuilder) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Tlvs3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder) Tlvs3(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3) LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) ExecutionException(java.util.concurrent.ExecutionException) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)

Aggregations

LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)11 LspDbVersionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder)6 Test (org.junit.Test)5 PCEPSession (org.opendaylight.protocol.pcep.PCEPSession)4 Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder)3 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)3 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)3 ByteBuf (io.netty.buffer.ByteBuf)2 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3)2 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)2 SymbolicPathNameBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.symbolic.path.name.tlv.SymbolicPathNameBuilder)2 Optional (com.google.common.base.Optional)1 BigInteger (java.math.BigInteger)1 Collections (java.util.Collections)1 ExecutionException (java.util.concurrent.ExecutionException)1 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 StatefulActivator (org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator)1 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)1 SyncOptimizationsActivator (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator)1 SyncOptimizationsLspObjectParser (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsLspObjectParser)1