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 Stateful07PCReportMessageParser method parsePath.
private static void parsePath(final List<Object> objects, final PathBuilder builder) {
final List<Metrics> pathMetrics = Lists.newArrayList();
Object obj;
State state = State.INIT;
while (!objects.isEmpty() && !state.equals(State.END)) {
obj = objects.get(0);
state = insertObject(state, obj, builder, pathMetrics);
if (!state.equals(State.END)) {
objects.remove(0);
}
}
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 Stateful07PCUpdateRequestMessageParser method parsePath.
private static void parsePath(final List<Object> objects, final PathBuilder pBuilder) {
final List<Metrics> pathMetrics = Lists.newArrayList();
Object obj;
State state = State.INIT;
while (!objects.isEmpty() && !state.equals(State.END)) {
obj = objects.get(0);
state = insertObject(state, obj, pBuilder, pathMetrics);
if (!state.equals(State.END)) {
objects.remove(0);
}
}
if (!pathMetrics.isEmpty()) {
pBuilder.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 Stateful07PCUpdateRequestMessageParser method validatePath.
private static boolean validatePath(final List<Object> objects, final List<Message> errors, final UpdatesBuilder builder) {
final PathBuilder pBuilder = new PathBuilder();
Object object = objects.remove(0);
if (object instanceof Ero) {
pBuilder.setEro((Ero) object);
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.absent()));
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 PcRptMessageCodec method getValidReports.
@Override
protected Reports getValidReports(final List<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 Stateful07TopologySessionListener method redelegate.
private ListenableFuture<OperationResult> redelegate(final Lsp reportedLsp, final Srp srp, final Lsp lsp, final UpdateLspArgs input) {
// the D bit that was reported decides the type of PCE message sent
requireNonNull(reportedLsp.isDelegate());
final Message msg;
if (reportedLsp.isDelegate()) {
// we already have delegation, send update
final UpdatesBuilder rb = new UpdatesBuilder();
rb.setSrp(srp);
rb.setLsp(lsp);
final PathBuilder pb = new PathBuilder();
pb.fieldsFrom(input.getArguments());
rb.setPath(pb.build());
final PcupdMessageBuilder ub = new PcupdMessageBuilder(MESSAGE_HEADER);
ub.setUpdates(Collections.singletonList(rb.build()));
msg = new PcupdBuilder().setPcupdMessage(ub.build()).build();
} else {
final Lsp1 lspCreateFlag = reportedLsp.getAugmentation(Lsp1.class);
// we only retake delegation for PCE initiated tunnels
if (lspCreateFlag != null && !lspCreateFlag.isCreate()) {
LOG.warn("Unable to retake delegation of PCC-initiated tunnel: {}", reportedLsp);
return OperationResults.createUnsent(PCEPErrors.UPDATE_REQ_FOR_NON_LSP).future();
}
// we want to revoke delegation, different type of message
// is sent because of specification by Siva
// this message is also sent, when input delegate bit is set to 0
// generating an error in PCC
final List<Requests> reqs = new ArrayList<>();
reqs.add(new RequestsBuilder().setSrp(srp).setLsp(lsp).build());
final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder();
ib.setRequests(reqs);
msg = new PcinitiateBuilder().setPcinitiateMessage(ib.build()).build();
}
return sendMessage(msg, srp.getOperationId(), input.getArguments().getMetadata());
}
Aggregations