use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.
the class PCEPStatefulPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(final InetSocketAddress address, final TlvsBuilder openBuilder) {
// Check if we are dealing with synchronization optimization
final var statefulTlv = openBuilder.augmentation(Tlvs1.class);
if (statefulTlv == null) {
return;
}
final var stateful = statefulTlv.getStateful();
if (stateful == null || stateful.augmentation(Stateful1.class) == null) {
return;
}
final var nodeId = ServerSessionManager.createNodeId(address.getAddress());
final var dbVersion = lspDbVersions.map.get(nodeId);
final var speakerId = speakerIds.map.get(nodeId);
if (speakerId == null && dbVersion == null) {
// Nothing to add
return;
}
final Tlvs3Builder syncBuilder = new Tlvs3Builder();
if (dbVersion != null) {
syncBuilder.setLspDbVersion(dbVersion);
}
if (speakerId != null) {
syncBuilder.setSpeakerEntityId(new SpeakerEntityIdBuilder().setSpeakerEntityIdValue(speakerId).build());
}
openBuilder.addAugmentation(syncBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.
the class CInitiated00StatefulCapabilityTlvParser method serializeFlags.
@Override
protected BitArray serializeFlags(final Stateful sct) {
final BitArray flags = new BitArray(FLAGS_F_LENGTH);
final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
if (sfi != null) {
flags.set(I_FLAG_OFFSET, sfi.isInitiation());
}
flags.set(U_FLAG_OFFSET, sct.isLspUpdateCapability());
return flags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method setStatefulCapabilities.
private synchronized void setStatefulCapabilities(final Stateful stateful) {
this.statefulCapability.set(true);
if (stateful.isLspUpdateCapability() != null) {
this.lspUpdateCapability.set(stateful.isLspUpdateCapability());
}
final Stateful1 stateful1 = stateful.getAugmentation(Stateful1.class);
if (stateful1 != null && stateful1.isInitiation() != null) {
this.initiationCapability.set(stateful1.isInitiation());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.
the class PCCMockCommon method checkSynchronizedSession.
static void checkSynchronizedSession(final int numberOfLsp, final TestingSessionListener pceSessionListener, final BigInteger expectedeInitialDb) throws Exception {
assertTrue(pceSessionListener.isUp());
// Send Open with LspDBV = 1
final int numberOfSyncMessage = 1;
int numberOfLspExpected = numberOfLsp;
if (!expectedeInitialDb.equals(BigInteger.ZERO)) {
checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedeInitialDb));
numberOfLspExpected += numberOfSyncMessage;
}
checkReceivedMessages(pceSessionListener, numberOfLspExpected);
final PCEPSession session = pceSessionListener.getSession();
checkSession(session, DEAD_TIMER, KEEP_ALIVE);
assertTrue(session.getRemoteTlvs().getAugmentation(Tlvs1.class).getStateful().getAugmentation(Stateful1.class).isInitiation());
assertNull(session.getLocalTlvs().getAugmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.
the class PCCMockCommon method checkResyncSession.
static void checkResyncSession(final Optional<Integer> startAtNumberLsp, final int expectedNumberOfLsp, final int expectedTotalMessages, final Uint64 startingDBVersion, final Uint64 expectedDBVersion, final TestingSessionListener pceSessionListener) throws Exception {
assertNotNull(pceSessionListener.getSession());
assertTrue(pceSessionListener.isUp());
final List<Message> messages;
checkReceivedMessages(pceSessionListener, expectedTotalMessages);
if (startAtNumberLsp.isPresent()) {
messages = pceSessionListener.messages().subList(startAtNumberLsp.get(), startAtNumberLsp.get() + expectedNumberOfLsp);
} else {
messages = pceSessionListener.messages();
}
checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedDBVersion));
assertEquals(expectedNumberOfLsp, messages.size());
final PCEPSession session = pceSessionListener.getSession();
checkSession(session, DEAD_TIMER, KEEP_ALIVE);
assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful().augmentation(Stateful1.class).getInitiation());
final Uint64 pceDBVersion = session.getLocalTlvs().augmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue();
assertEquals(startingDBVersion, pceDBVersion);
}
Aggregations