use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.
the class PCEPReplyMessageParser method serializeFailure.
private void serializeFailure(final FailureCase f, final ByteBuf buffer) {
if (f == null) {
return;
}
serializeObject(f.getNoPath(), buffer);
serializeObject(f.getLspa(), buffer);
serializeObject(f.getBandwidth(), buffer);
if (f.getMetrics() != null) {
for (final Metrics m : f.getMetrics()) {
serializeObject(m.getMetric(), buffer);
}
}
serializeObject(f.getIro(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method getValidSvec.
private static Svec getValidSvec(final SvecBuilder builder, final List<Object> objects) {
Preconditions.checkArgument(objects != null && !objects.isEmpty(), "Passed list can't be null or empty.");
if (objects.get(0) instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.Svec) {
builder.setSvec((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.Svec) objects.get(0));
objects.remove(0);
} else {
return null;
}
final List<Metrics> metrics = new ArrayList<>();
final List<VendorInformationObject> viObjects = new ArrayList<>();
Object obj = null;
SvecState state = SvecState.INIT;
while (!objects.isEmpty() && !state.equals(SvecState.END)) {
obj = objects.get(0);
state = insertObject(state, obj, builder, metrics, viObjects);
if (!state.equals(SvecState.END)) {
objects.remove(0);
}
}
if (!viObjects.isEmpty()) {
builder.setVendorInformationObject(viObjects);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method insertObject.
private static State insertObject(final State state, final List<Object> objects, final List<VendorInformationObject> viObjects, final P2pBuilder builder, final List<Metrics> metrics, final List<Message> errors, final Rp rp) {
final Object obj = objects.get(0);
switch(state) {
case INIT:
if (obj instanceof Rro) {
builder.setRro((Rro) obj);
objects.remove(0);
final Object nextObj = objects.get(0);
if (nextObj instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidth) {
builder.setReoptimizationBandwidth((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidth) nextObj);
}
return State.REPORTED_IN;
}
case REPORTED_IN:
if (obj instanceof VendorInformationObject) {
viObjects.add((VendorInformationObject) obj);
return State.REPORTED_IN;
}
case VENDOR_INFO_LIST:
if (obj instanceof LoadBalancing) {
builder.setLoadBalancing((LoadBalancing) obj);
return State.LOAD_BIN;
}
case LOAD_BIN:
if (obj instanceof Lspa) {
builder.setLspa((Lspa) obj);
return State.LSPA_IN;
}
case LSPA_IN:
if (obj instanceof Bandwidth) {
builder.setBandwidth((Bandwidth) obj);
return State.BANDWIDTH_IN;
}
case BANDWIDTH_IN:
if (obj instanceof Metric) {
metrics.add(new MetricsBuilder().setMetric((Metric) obj).build());
return State.BANDWIDTH_IN;
}
case METRIC_IN:
if (obj instanceof Iro) {
builder.setIro((Iro) obj);
return State.IRO_IN;
}
case IRO_IN:
if (obj instanceof Rro) {
builder.setRro((Rro) obj);
return State.RRO_IN;
}
case RRO_IN:
if (obj instanceof Xro) {
builder.setXro((Xro) obj);
return State.XRO_IN;
}
case XRO_IN:
if (obj instanceof Of) {
builder.setOf((Of) obj);
return State.OF_IN;
}
case OF_IN:
if (obj instanceof ClassType) {
final ClassType classType = (ClassType) obj;
if (!classType.isProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.of(rp)));
} else {
builder.setClassType(classType);
}
return State.CT_IN;
}
case CT_IN:
case END:
return State.END;
default:
return state;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.
the class Stateful07PCReportMessageParser method serializeReport.
private void serializeReport(final Reports report, final ByteBuf buffer) {
if (report.getSrp() != null) {
serializeObject(report.getSrp(), buffer);
}
serializeObject(report.getLsp(), buffer);
final Path p = report.getPath();
if (p != null) {
serializeObject(p.getEro(), buffer);
serializeObject(p.getLspa(), buffer);
serializeObject(p.getBandwidth(), buffer);
serializeObject(p.getReoptimizationBandwidth(), buffer);
if (p.getMetrics() != null) {
for (final Metrics m : p.getMetrics()) {
serializeObject(m.getMetric(), buffer);
}
}
serializeObject(p.getIro(), buffer);
serializeObject(p.getRro(), buffer);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.
the class Stateful07PCUpdateRequestMessageParser method serializeUpdate.
protected void serializeUpdate(final Updates update, final ByteBuf buffer) {
serializeObject(update.getSrp(), buffer);
serializeObject(update.getLsp(), buffer);
final Path p = update.getPath();
if (p != null) {
serializeObject(p.getEro(), buffer);
serializeObject(p.getLspa(), buffer);
serializeObject(p.getBandwidth(), buffer);
serializeObject(p.getReoptimizationBandwidth(), buffer);
if (p.getMetrics() != null) {
for (final Metrics m : p.getMetrics()) {
serializeObject(m.getMetric(), buffer);
}
}
serializeObject(p.getIro(), buffer);
}
}
Aggregations