use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.Tlvs 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.Tlvs 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.Tlvs in project bgpcep by opendaylight.
the class AigpAttributeParser method parseAigpTLV.
/**
* Reads data from buffer until reaches TLV of type AIGP TLV.
*
* @param buffer TLVs in ByteBuf format
* @return instance of AigpTlv class or null if buffer contains unknown TLV type
*/
private static AigpTlv parseAigpTLV(final ByteBuf buffer) {
final int tlvType = buffer.readByte();
buffer.skipBytes(TLV_SIZE_IN_BYTES);
if (tlvType != AIGP_TLV_TYPE) {
LOG.warn("AIGP attribute contains unknown TLV type {}.", tlvType);
return null;
}
return new AigpTlvBuilder().setMetric(new AccumulatedIgpMetric(ByteBufUtils.readUint64(buffer))).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.Tlvs 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