use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder in project bgpcep by opendaylight.
the class PcRptMessageCodec method getValidReports.
@Override
protected Reports getValidReports(final Queue<Object> objects, final List<Message> errors) {
final Optional<Object> find = Iterables.tryFind(objects, Predicates.instanceOf(BandwidthUsage.class));
final Object object;
if (find.isPresent()) {
object = find.get();
objects.remove(object);
} else {
object = null;
}
final Reports validReports = super.getValidReports(objects, errors);
if (object != null && validReports != null) {
final Path path = validReports.getPath();
if (path != null) {
return new ReportsBuilder(validReports).setPath(new PathBuilder(path).setBandwidth(setBandwidthUsage(path.getBandwidth(), (BandwidthUsage) object)).build()).build();
}
}
return validReports;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder in project bgpcep by opendaylight.
the class StatefulPCReportMessageParser method parsePath.
private static void parsePath(final Queue<Object> objects, final PathBuilder builder) {
final List<Metrics> pathMetrics = new ArrayList<>();
State state = State.INIT;
for (Object obj = objects.peek(); obj != null; obj = objects.peek()) {
state = insertObject(state, obj, builder, pathMetrics);
if (state == State.END) {
break;
}
objects.remove();
}
if (!pathMetrics.isEmpty()) {
builder.setMetrics(pathMetrics);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder in project bgpcep by opendaylight.
the class StatefulPCReportMessageParser method validatePath.
private static boolean validatePath(final Queue<Object> objects, final List<Message> errors, final ReportsBuilder builder) {
final PathBuilder pBuilder = new PathBuilder();
Object object = objects.remove();
if (object instanceof Ero) {
pBuilder.setEro((Ero) object);
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.empty()));
return false;
}
parsePath(objects, pBuilder);
builder.setPath(pBuilder.build());
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method startStateTimeout.
private void startStateTimeout(final PCCTunnel tunnel, final PlspId plspId) {
if (this.stateTimeout > -1) {
final Timeout newStateTimeout = this.timer.newTimeout(timeout -> {
if (tunnel.getType() == LspType.PCE_LSP) {
PCCTunnelManagerImpl.this.tunnels.remove(plspId);
// report tunnel removal to all
sendToAll(tunnel, plspId, Collections.emptyList(), createSrp(Uint32.ZERO), new PathBuilder().build(), createLsp(plspId.getValue(), false, Optional.empty(), false, true));
}
}, this.stateTimeout, TimeUnit.SECONDS);
tunnel.setStateTimeout(newStateTimeout);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder in project bgpcep by opendaylight.
the class MessagesUtil method createPcRepMessage.
public static Pcrep createPcRepMessage(final Rp rp, final P2p p2p, final ConstrainedPath cpath) {
/* Prepare Path Object with ERO and Object from the Request */
final ArrayList<Paths> paths = new ArrayList<>();
PathsBuilder pathBuilder = buildPath(cpath);
if (p2p.getLspa() != null) {
pathBuilder.setLspa(p2p.getLspa());
}
if (p2p.getIro() != null) {
pathBuilder.setIro(p2p.getIro());
}
if (p2p.getXro() != null) {
pathBuilder.setXro(p2p.getXro());
}
paths.add(pathBuilder.build());
/* Prepare Reply with Path Object */
final RepliesBuilder replyBuilder = new RepliesBuilder().setRp(rp).setResult(new SuccessCaseBuilder().setSuccess(new SuccessBuilder().setPaths(paths).build()).build());
/* Prepare PcRep Message */
final PcrepMessageBuilder msgBuilder = new PcrepMessageBuilder().setReplies(Lists.newArrayList(replyBuilder.build()));
return new PcrepBuilder().setPcrepMessage(msgBuilder.build()).build();
}
Aggregations