use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersionBuilder in project bgpcep by opendaylight.
the class StateSynchronizationAvoidanceProcedureTest method testStateSynchronizationPerformed.
@Test
public void testStateSynchronizationPerformed() throws Exception {
PCEPSession session = getPCEPSession(getOpen(null), getOpen(null));
listener.onSessionUp(session);
// report LSP + LSP-DB version number
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(Uint32.ONE)).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(Uint32.ONE)).build()).setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName("test".getBytes())).build()).addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.ONE).build()).build()).build()).setPlspId(new PlspId(Uint32.ONE)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.empty(), createPath(Collections.emptyList()));
listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
assertFalse(pcc.nonnullReportedLsp().isEmpty());
return pcc;
});
listener.onSessionDown(session, new IllegalArgumentException("Simulate Exception"));
listener = getSessionListener();
// session up - expect sync (LSP-DBs do not match)
final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(Uint64.TWO).build();
session = getPCEPSession(getOpen(localDbVersion), getOpen(null));
listener.onSessionUp(session);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
// check node - not synchronized
assertEquals(PccSyncState.InitialResync, pcc.getStateSync());
// check reported LSP - persisted from previous session
assertFalse(pcc.nonnullReportedLsp().isEmpty());
return pcc;
});
// sync rpt + LSP-DB
final Pcrpt syncMsg = MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.TWO).build()).build()).build()), true, false), Optional.empty(), createPath(Collections.emptyList()));
listener.onMessage(session, syncMsg);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP is empty, LSP state from previous session was purged
assertNull(pcc.getReportedLsp());
return pcc;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersionBuilder in project bgpcep by opendaylight.
the class StateSynchronizationAvoidanceProcedureTest method testNodePersisted.
@Test
public void testNodePersisted() throws ExecutionException, InterruptedException {
final PCEPSession session = getPCEPSession(getOpen(null), getOpen(null));
listener.onSessionUp(session);
// report LSP + LSP-DB version number
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(Uint32.ONE)).build()).addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.ONE).build()).build()).build()).setPlspId(new PlspId(Uint32.ONE)).setSync(false).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(Uint32.ONE)), null);
listener.onMessage(session, pcRpt);
// check topology
readDataOperational(getDataBroker(), pathComputationClientIId.builder().augmentation(PathComputationClient1.class).child(LspDbVersion.class).build(), dbVersion -> {
assertEquals(1L, dbVersion.getLspDbVersionValue().longValue());
return dbVersion;
});
// drop session
listener.onSessionDown(session, new IllegalStateException());
readDataOperational(getDataBroker(), TOPO_IID, topology -> {
assertFalse(topology.getNode().isEmpty());
return topology;
});
// check topology - node is persisted
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersionBuilder in project bgpcep by opendaylight.
the class PCEPTriggeredReSynchronizationProcedureTest method getSyncMsg.
private static 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(Uint32.ONE));
return MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.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.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersionBuilder in project bgpcep by opendaylight.
the class StateSynchronizationAvoidanceProcedureTest method testStateSynchronizationSkipped.
@Test
public void testStateSynchronizationSkipped() throws Exception {
// session up - sync skipped (LSP-DBs match)
final LspDbVersion lspDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(Uint64.ONE).build();
final PCEPSession session = getPCEPSession(getOpen(lspDbVersion), getOpen(lspDbVersion));
listener.onSessionUp(session);
// check node - synchronized
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
return pcc;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersionBuilder in project bgpcep by opendaylight.
the class PCCServerPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(final InetSocketAddress address, final TlvsBuilder openBuilder) {
requireNonNull(address);
final LspDbVersionBuilder lspDbVersionBuilder = new LspDbVersionBuilder();
if (this.isAfterReconnection) {
lspDbVersionBuilder.setLspDbVersionValue(this.dbVersion);
} else {
this.isAfterReconnection = true;
}
openBuilder.addAugmentation(new Tlvs3Builder().setLspDbVersion(lspDbVersionBuilder.build()).build());
}
Aggregations