use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp in project bgpcep by opendaylight.
the class StatefulSrpObjectParser method parseObject.
@Override
public Srp parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (bytes.readableBytes() < MIN_SIZE) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + bytes.readableBytes() + "; Expected: >=" + MIN_SIZE + ".");
}
final SrpBuilder builder = new SrpBuilder().setIgnore(header.getIgnore()).setProcessingRule(header.getProcessingRule());
parseFlags(builder, bytes);
builder.setOperationId(new SrpIdNumber(ByteBufUtils.readUint32(bytes)));
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
return builder.setTlvs(tlvsBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp in project bgpcep by opendaylight.
the class PCCTriggeredFullDBResyncTest method createTriggerLspResync.
private static Message createTriggerLspResync() {
final SrpBuilder srpBuilder = new SrpBuilder().setOperationId(new SrpIdNumber(Uint32.ONE)).setProcessingRule(Boolean.TRUE);
final Srp srp = srpBuilder.build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(Uint32.ZERO)).setSync(Boolean.TRUE).build();
final UpdatesBuilder rb = new UpdatesBuilder().setSrp(srp).setLsp(lsp).setPath(new PathBuilder().build());
final PcupdMessageBuilder ub = new PcupdMessageBuilder();
ub.setUpdates(Collections.singletonList(rb.build()));
return new PcupdBuilder().setPcupdMessage(ub.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method reportLsp.
private void reportLsp(final PlspId plspId, final SrpIdNumber operationId, final PCCSession session) {
final PCCTunnel tunnel = this.tunnels.get(plspId);
if (tunnel == null) {
return;
}
final Srp srp = new SrpBuilder().setOperationId(operationId).build();
createLspAndSendReport(plspId.getValue(), tunnel, session, Optional.of(Boolean.TRUE), Optional.of(srp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method sendToAll.
private void sendToAll(final PCCTunnel tunnel, final PlspId plspId, final List<Subobject> subobjects, final Srp srp, final Path path, final Lsp lsp) {
for (final PCCSession session : this.sessions.values()) {
final boolean isDelegated = hasDelegation(tunnel, session);
final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.of(subobjects));
final Pcrpt pcRpt = createPcRtpMessage(new LspBuilder(lsp).setPlspId(plspId).setOperational(OperationalStatus.Up).setDelegate(isDelegated).setSync(true).addAugmentation(new Lsp1Builder().setCreate(tunnel.getType() == LspType.PCE_LSP).build()).setTlvs(tlvs).build(), Optional.ofNullable(srp), path);
session.sendReport(pcRpt);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method createLspAndSendReport.
private void createLspAndSendReport(final Uint32 plspId, final PCCTunnel tunnel, final PCCSession session, final Optional<Boolean> isSync, final Optional<Srp> srp) {
final boolean delegation = hasDelegation(tunnel, session);
if (delegation) {
tunnel.cancelTimeouts();
}
final String destinationAddress = getDestinationAddress(tunnel.getLspState().getEro().getSubobject(), this.address);
final Tlvs tlvs = createLspTlvs(plspId, true, destinationAddress, this.address, this.address, Optional.of(tunnel.getPathName()), this.syncOptimization.incrementLspDBVersion());
final boolean sync = isSync.isPresent() ? isSync.get() : this.syncOptimization.isSyncNeedIt();
final Lsp lsp = createLsp(plspId, sync, Optional.ofNullable(tlvs), delegation, false);
final Pcrpt pcrtp = createPcRtpMessage(lsp, srp, tunnel.getLspState());
session.sendReport(pcrtp);
}
Aggregations