use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt in project bgpcep by opendaylight.
the class MsgBuilderUtil method createPcRtpMessage.
public static Pcrpt createPcRtpMessage(final Lsp lsp, final Optional<Srp> srp, final Path path) {
final PcrptBuilder rptBuilder = new PcrptBuilder();
final PcrptMessageBuilder msgBuilder = new PcrptMessageBuilder();
final ReportsBuilder reportBuilder = new ReportsBuilder();
reportBuilder.setLsp(lsp);
reportBuilder.setSrp(srp.orNull());
reportBuilder.setPath(path);
msgBuilder.setReports(Lists.newArrayList(reportBuilder.build()));
rptBuilder.setPcrptMessage(msgBuilder.build());
return rptBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testReportMsgWithRro.
@Test
public void testReportMsgWithRro() throws PCEPDeserializerException {
final byte[] parseHexBinary = DatatypeConverter.parseHexBinary("2010003c0084a019001100106e79636e7932316372735f7432313231001200100a0" + "000d2004008490a0000d40a0000d4001f0006000005dd700000000710001401080a000706200001080a0000d420" + "000910001400000000000000000000000005050100051000084998968005500008513a43b70810002401080a000" + "0d42020030801010000000001080a00070620000308010100000000");
final Pcrpt msg = (Pcrpt) this.ctx.getMessageHandlerRegistry().parseMessage(10, Unpooled.wrappedBuffer(parseHexBinary), Collections.emptyList());
assertNotNull(msg.getPcrptMessage().getReports().get(0).getPath().getBandwidth().augmentation(Bandwidth1.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method sendEndOfSynchronization.
private void sendEndOfSynchronization(final PCCSession session, final Optional<SrpIdNumber> operationId) {
Srp srp = null;
if (operationId.isPresent()) {
srp = new SrpBuilder().setOperationId(operationId.get()).build();
}
Optional<Tlvs> tlv = Optional.empty();
if (this.syncOptimization.isSyncAvoidanceEnabled()) {
tlv = createLspTlvsEndofSync(this.syncOptimization.incrementLspDBVersion().get());
}
final Pcrpt pcrtp = createPcRtpMessage(createLsp(Uint32.ZERO, false, tlv, true, false), Optional.ofNullable(srp), createPath(Collections.emptyList()));
session.sendReport(pcrtp);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testDelegatedLspsCountWithDelegation.
@Test
public void testDelegatedLspsCountWithDelegation() throws Exception {
listener.onSessionUp(session);
topologyRpcs.addLsp(createAddLspInput());
assertEquals(1, receivedMsgs.size());
assertTrue(receivedMsgs.get(0) instanceof Pcinitiate);
final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final Uint32 srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
// delegate set to true
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(Uint32.ONE)).setSync(FALSE).setRemove(FALSE).setOperational(OperationalStatus.Active).setDelegate(TRUE).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
listener.onMessage(session, pcRpt);
checkEquals(() -> assertEquals(1, listener.listenerState.getDelegatedLspsCount().intValue()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt in project bgpcep by opendaylight.
the class PCETriggeredInitialSyncProcedureTest method testPcepTriggeredInitialSyncPerformed.
/**
* Test Triggered Initial Sync procedure.
*/
@Test
public void testPcepTriggeredInitialSyncPerformed() throws Exception {
final PCEPTopologySessionListener listener = getSessionListener();
// session up - expect triggered sync (LSP-DBs do not match)
final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(Uint64.ONE).build();
final LspDbVersion localDbVersion2 = new LspDbVersionBuilder().setLspDbVersionValue(Uint64.TWO).build();
final PCEPSession session = getPCEPSession(getOpen(localDbVersion, false), getOpen(localDbVersion2, false));
listener.onSessionUp(session);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
// check node - not synchronized and TriggeredInitialSync state
assertEquals(PccSyncState.TriggeredInitialSync, pcc.getStateSync());
return pcc;
});
// sync rpt + LSP-DB
final Pcrpt syncMsg = getsyncMsg();
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;
});
// report LSP + LSP-DB version number
final Pcrpt pcRpt = getPcrpt();
listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
assertFalse(pcc.nonnullReportedLsp().isEmpty());
return pcc;
});
}
Aggregations