use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId in project bgpcep by opendaylight.
the class Util method validateMonitoringMetrics.
public static MetricPce validateMonitoringMetrics(final List<Object> objects) throws PCEPDeserializerException {
final MetricPceBuilder metricPceBuilder = new MetricPceBuilder();
if (!(objects.get(0) instanceof PceId)) {
throw new PCEPDeserializerException("metric-pce-list must start with PCE-ID object.");
}
metricPceBuilder.setPceId((PceId) (objects.get(0)));
objects.remove(0);
State state = State.START;
while (!objects.isEmpty() && !state.equals(State.END)) {
final Object obj = objects.get(0);
state = insertObject(metricPceBuilder, state, obj);
if (!state.equals(State.END)) {
objects.remove(0);
}
}
return metricPceBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId in project bgpcep by opendaylight.
the class PCEPReplyMessageParser method handleEro.
private Result handleEro(final Ero ero, final List<Object> objects) {
objects.remove(0);
final SuccessBuilder builder = new SuccessBuilder();
final List<Paths> paths = new ArrayList<>();
final PathsBuilder pBuilder = new PathsBuilder();
pBuilder.setEro(ero);
while (!objects.isEmpty() && !(objects.get(0) instanceof PceId)) {
final List<VendorInformationObject> vendorInfoObjects = addVendorInformationObjects(objects);
if (!vendorInfoObjects.isEmpty()) {
builder.setVendorInformationObject(vendorInfoObjects);
}
this.parsePath(pBuilder, objects);
paths.add(pBuilder.build());
}
builder.setPaths(paths);
return new SuccessCaseBuilder().setSuccess(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId in project bgpcep by opendaylight.
the class PCEPReplyMessageParser method handleNoPath.
private Result handleNoPath(final NoPath noPath, final List<Object> objects) {
objects.remove(0);
final FailureCaseBuilder builder = new FailureCaseBuilder();
builder.setNoPath(noPath);
while (!objects.isEmpty() && !(objects.get(0) instanceof PceId)) {
this.parseAttributes(builder, objects);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method getMonitoring.
protected MonitoringRequest getMonitoring(final List<Object> objects) {
final MonitoringRequestBuilder builder = new MonitoringRequestBuilder();
if (!objects.isEmpty() && objects.get(0) instanceof Monitoring) {
builder.setMonitoring((Monitoring) objects.get(0));
objects.remove(0);
} else {
return null;
}
if (!objects.isEmpty() && objects.get(0) instanceof PccIdReq) {
builder.setPccIdReq((PccIdReq) objects.get(0));
objects.remove(0);
}
final List<PceIdList> pceIdList = new ArrayList<>();
while (!objects.isEmpty() && objects.get(0) instanceof PceId) {
pceIdList.add(new PceIdListBuilder().setPceId((PceId) objects.get(0)).build());
objects.remove(0);
}
if (!pceIdList.isEmpty()) {
builder.setPceIdList(pceIdList);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId in project bgpcep by opendaylight.
the class XROPathKey128SubobjectParser method parseSubobject.
@Override
public Subobject parseSubobject(final ByteBuf buffer, final boolean mandatory) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT128_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; Expected: >" + CONTENT128_LENGTH + ".");
}
final int pathKey = buffer.readUnsignedShort();
final byte[] pceId = ByteArray.readBytes(buffer, PCE128_ID_F_LENGTH);
final SubobjectBuilder builder = new SubobjectBuilder();
final PathKeyBuilder pBuilder = new PathKeyBuilder();
pBuilder.setPceId(new PceId(pceId));
pBuilder.setPathKey(new PathKey(pathKey));
builder.setMandatory(mandatory);
builder.setSubobjectType(new PathKeyCaseBuilder().setPathKey(pBuilder.build()).build());
return builder.build();
}
Aggregations