use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.gc.TlvsBuilder 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();
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.gc.TlvsBuilder in project bgpcep by opendaylight.
the class PCEPSegmentRoutingCapabilityTest method testSegmentRoutingCapability.
@Test
public void testSegmentRoutingCapability() {
final PCEPSegmentRoutingCapability sspf = new PCEPSegmentRoutingCapability(true);
Assert.assertTrue(sspf.isSegmentRoutingCapable());
final TlvsBuilder builder = new TlvsBuilder();
sspf.setCapabilityProposal(null, builder);
Assert.assertEquals(EXPECTED_TLVS, builder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.gc.TlvsBuilder in project bgpcep by opendaylight.
the class PCCServerPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(@Nonnull final InetSocketAddress address, @Nonnull final TlvsBuilder openBuilder) {
requireNonNull(address);
final LspDbVersionBuilder lspDbVersionBuilder = new LspDbVersionBuilder();
if (this.isAfterReconnection) {
lspDbVersionBuilder.setLspDbVersionValue(this.dbVersion);
} else {
this.isAfterReconnection = true;
}
openBuilder.addAugmentation(Tlvs3.class, new Tlvs3Builder().setLspDbVersion(lspDbVersionBuilder.build()).build());
}
Aggregations