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 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.segment.routing.rev200720.Tlvs1 in project bgpcep by opendaylight.
the class PCCMockCommon method checkSequequenceDBVersionSync.
protected static void checkSequequenceDBVersionSync(final TestingSessionListener pceSessionListener, final Uint64 expectedDbVersion) {
for (final Message msg : pceSessionListener.messages()) {
final List<Reports> pcrt = ((Pcrpt) msg).getPcrptMessage().getReports();
for (final Reports report : pcrt) {
final Lsp lsp = report.getLsp();
if (lsp.getPlspId().getValue().toJava() == 0) {
assertEquals(false, lsp.getSync());
} else {
assertEquals(true, lsp.getSync());
}
final Uint64 actuaLspDBVersion = lsp.getTlvs().augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1.class).getLspDbVersion().getLspDbVersionValue();
assertEquals(expectedDbVersion, actuaLspDBVersion);
}
}
}
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 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);
}
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 PCEPTopologySessionListener 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.augmentation(Tlvs1.class) != null) {
final Stateful stateful = tlvs.augmentation(Tlvs1.class).getStateful();
if (stateful != null) {
setStatefulCapabilities(stateful);
pccBuilder.setReportedLsp(Collections.emptyMap());
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(new StatefulTlv1Builder(tlvs.augmentation(Tlvs1.class)).build()).build());
} else {
LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
}
} else {
LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
}
}
Aggregations