use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1 in project bgpcep by opendaylight.
the class PCCMockCommon method checkResyncSession.
static void checkResyncSession(final Optional<Integer> startAtNumberLsp, final int expectedNumberOfLsp, final int expectedTotalMessages, final BigInteger startingDBVersion, final BigInteger 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().getAugmentation(Tlvs1.class).getStateful().getAugmentation(Stateful1.class).isInitiation());
final BigInteger pceDBVersion = session.getLocalTlvs().getAugmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue();
assertEquals(startingDBVersion, pceDBVersion);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1 in project bgpcep by opendaylight.
the class SyncOptimizationsLspObjectParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder syncOptTlvsBuilder = new Tlvs1Builder();
if (tbuilder.augmentation(Tlvs1.class) != null) {
final Tlvs1 t = tbuilder.augmentation(Tlvs1.class);
if (t.getLspDbVersion() != null) {
syncOptTlvsBuilder.setLspDbVersion(t.getLspDbVersion());
}
}
if (tlv instanceof LspDbVersion) {
syncOptTlvsBuilder.setLspDbVersion((LspDbVersion) tlv);
}
tbuilder.addAugmentation(syncOptTlvsBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1 in project bgpcep by opendaylight.
the class StatefulOpenObjectParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder statefulBuilder = new Tlvs1Builder();
if (tbuilder.augmentation(Tlvs1.class) != null) {
final Tlvs1 t = tbuilder.augmentation(Tlvs1.class);
if (t.getStateful() != null) {
statefulBuilder.setStateful(t.getStateful());
}
}
if (tlv instanceof Stateful) {
statefulBuilder.setStateful((Stateful) tlv);
}
tbuilder.addAugmentation(statefulBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1 in project bgpcep by opendaylight.
the class PCCMockCommon method checkSession.
static void checkSession(final PCEPSession session, final int expectedDeadTimer, final int expectedKeepAlive) {
assertNotNull(session);
assertEquals(expectedDeadTimer, session.getPeerPref().getDeadtimer().shortValue());
assertEquals(expectedKeepAlive, session.getPeerPref().getKeepalive().shortValue());
final Stateful1 stateful = session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful().augmentation(Stateful1.class);
assertTrue(stateful.getInitiation());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1 in project bgpcep by opendaylight.
the class PCCMockCommon method checkSynchronizedSession.
static void checkSynchronizedSession(final int numberOfLsp, final TestingSessionListener pceSessionListener, final Uint64 expectedeInitialDb) throws Exception {
assertTrue(pceSessionListener.isUp());
// Send Open with LspDBV = 1
final int numberOfSyncMessage = 1;
int numberOfLspExpected = numberOfLsp;
if (!expectedeInitialDb.equals(Uint64.ZERO)) {
checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedeInitialDb));
numberOfLspExpected += numberOfSyncMessage;
}
checkReceivedMessages(pceSessionListener, numberOfLspExpected);
final PCEPSession session = pceSessionListener.getSession();
checkSession(session, DEAD_TIMER, KEEP_ALIVE);
assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful().augmentation(Stateful1.class).getInitiation());
assertNull(session.getLocalTlvs().augmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue());
}
Aggregations