use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt in project bgpcep by opendaylight.
the class IncrementalSynchronizationProcedureTest method testStateSynchronizationPerformed.
@Test
public void testStateSynchronizationPerformed() throws Exception {
PCEPSession session = getPCEPSession(getOpen(null), getOpen(null));
this.listener.onSessionUp(session);
// report LSP + LSP-DB version number
final Pcrpt pcRpt = getPcrpt(1L, "test");
this.listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertFalse(pcc.getReportedLsp().isEmpty());
return pcc;
});
this.listener.onSessionDown(session, new IllegalArgumentException());
this.listener = (Stateful07TopologySessionListener) getSessionListener();
// session up - expect sync (LSP-DBs do not match)
final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build();
session = getPCEPSession(getOpen(localDbVersion), getOpen(null));
this.listener.onSessionUp(session);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - IncrementalSync state
assertEquals(PccSyncState.IncrementalSync, pcc.getStateSync());
// check reported LSP - persisted from previous session
assertFalse(pcc.getReportedLsp().isEmpty());
return pcc;
});
// report LSP2 + LSP-DB version number 2
final Pcrpt pcRpt2 = getPcrpt(2L, "testsecond");
this.listener.onMessage(session, pcRpt2);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.IncrementalSync, pcc.getStateSync());
// check reported LSP is not empty
assertEquals(2, pcc.getReportedLsp().size());
return pcc;
});
// sync rpt + LSP-DB
final Pcrpt syncMsg = getSyncPcrt();
this.listener.onMessage(session, syncMsg);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP is empty, LSP state from previous session was purged
assertEquals(2, pcc.getReportedLsp().size());
return pcc;
});
// report LSP3 + LSP-DB version number 4
final Pcrpt pcRpt3 = getPcrpt(3L, "testthird");
this.listener.onMessage(session, pcRpt3);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
assertEquals(3, pcc.getReportedLsp().size());
return pcc;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt in project bgpcep by opendaylight.
the class PCEPTriggeredReSynchronizationProcedureTest method testTriggeredResynchronization.
@Test
public void testTriggeredResynchronization() throws Exception {
// session up - sync skipped (LSP-DBs match)
this.session = getPCEPSession(getOpen(), getOpen());
this.listener.onSessionUp(this.session);
// report LSP + LSP-DB version number
final Pcrpt pcRpt = getPcrt();
this.listener.onMessage(this.session, pcRpt);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
assertFalse(pcc.getReportedLsp().isEmpty());
return pcc;
});
// PCEP Trigger Full Resync
this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).build());
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertEquals(PccSyncState.PcepTriggeredResync, pcc.getStateSync());
return pcc;
});
// end of sync
final Pcrpt syncMsg = getSyncMsg();
this.listener.onMessage(this.session, syncMsg);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
return pcc;
});
this.listener.onMessage(this.session, pcRpt);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertEquals(1, pcc.getReportedLsp().size());
return pcc;
});
// Trigger Full Resync
this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).build());
this.listener.onMessage(this.session, pcRpt);
// end of sync
this.listener.onMessage(this.session, syncMsg);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP is not empty, Stale LSP state were purged
assertEquals(1, pcc.getReportedLsp().size());
return pcc;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt in project bgpcep by opendaylight.
the class PCEPTriggeredReSynchronizationProcedureTest method getSyncMsg.
private Pcrpt getSyncMsg() {
final SrpBuilder srpBuilder = new SrpBuilder();
// not sue whether use 0 instead of nextRequest() or do not insert srp == SRP-ID-number = 0
srpBuilder.setOperationId(new SrpIdNumber(1L));
return MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(3L)).build()).build()).build()), true, false), Optional.of(srpBuilder.build()), createPath(Collections.emptyList()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt in project bgpcep by opendaylight.
the class PCEPTriggeredReSynchronizationProcedureTest method testTriggeredResynchronizationLsp.
@Test
public void testTriggeredResynchronizationLsp() throws Exception {
// session up - sync skipped (LSP-DBs match)
this.session = getPCEPSession(getOpen(), getOpen());
this.listener.onSessionUp(this.session);
// report LSP + LSP-DB version number
final Pcrpt pcRpt = getPcrt();
this.listener.onMessage(this.session, pcRpt);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
final List<ReportedLsp> reportedLspPcc = pcc.getReportedLsp();
assertFalse(reportedLspPcc.isEmpty());
return pcc;
});
// Trigger Full Resync
this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).setName("test").build());
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertEquals(PccSyncState.PcepTriggeredResync, pcc.getStateSync());
assertFalse(pcc.getReportedLsp().isEmpty());
return pcc;
});
this.listener.onMessage(this.session, pcRpt);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertFalse(pcc.getReportedLsp().isEmpty());
return pcc;
});
// sync rpt + LSP-DB
final Pcrpt syncMsg = getSyncMsg();
this.listener.onMessage(this.session, syncMsg);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP
assertEquals(1, pcc.getReportedLsp().size());
return pcc;
});
// Trigger Full Resync
this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).setName("test").build());
this.listener.onMessage(this.session, syncMsg);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP
assertEquals(0, pcc.getReportedLsp().size());
return pcc;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt in project bgpcep by opendaylight.
the class PCETriggeredInitialSyncProcedureTest method testPcepTriggeredInitialSyncPerformed.
/**
* Test Triggered Initial Sync procedure.
*/
@Test
public void testPcepTriggeredInitialSyncPerformed() throws Exception {
this.listener = (Stateful07TopologySessionListener) getSessionListener();
// session up - expect triggered sync (LSP-DBs do not match)
final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.ONE).build();
final LspDbVersion localDbVersion2 = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build();
final PCEPSession session = getPCEPSession(getOpen(localDbVersion, Boolean.FALSE), getOpen(localDbVersion2, Boolean.FALSE));
this.listener.onSessionUp(session);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - not synchronized and TriggeredInitialSync state
assertEquals(PccSyncState.TriggeredInitialSync, pcc.getStateSync());
return pcc;
});
// sync rpt + LSP-DB
final Pcrpt syncMsg = getsyncMsg();
this.listener.onMessage(session, syncMsg);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP is empty, LSP state from previous session was purged
assertTrue(pcc.getReportedLsp().isEmpty());
return pcc;
});
// report LSP + LSP-DB version number
final Pcrpt pcRpt = getPcrpt();
this.listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
assertFalse(pcc.getReportedLsp().isEmpty());
return pcc;
});
}
Aggregations