use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPPceIdIPv6ObjectParser method parseObject.
@Override
public Object parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final PceIdBuilder builder = new PceIdBuilder();
builder.setIpAddress(new IpAddress(Ipv6Util.addressForByteBuf(buffer)));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPProcTimeObjectParser method parseObject.
@Override
public Object parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final ProcTimeBuilder builder = new ProcTimeBuilder();
buffer.skipBytes(RESERVED);
final BitArray flagBits = BitArray.valueOf(buffer, FLAGS);
builder.setEstimated(flagBits.get(E_FLAG_POSITION));
builder.setCurrentProcTime(buffer.readUnsignedInt());
builder.setMinProcTime(buffer.readUnsignedInt());
builder.setMaxProcTime(buffer.readUnsignedInt());
builder.setAverageProcTime(buffer.readUnsignedInt());
builder.setVarianceProcTime(buffer.readUnsignedInt());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPRequestParameterObjectParser method parseObject.
@Override
public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
final RpBuilder builder = new RpBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
short priority = 0;
priority |= flags.get(PRI_SF_OFFSET + 2) ? 1 : 0;
priority |= (flags.get(PRI_SF_OFFSET + 1) ? 1 : 0) << 1;
priority |= (flags.get(PRI_SF_OFFSET) ? 1 : 0) << 2;
if (priority != 0) {
builder.setPriority(priority);
}
builder.setFragmentation(flags.get(F_FLAG_OFFSET));
builder.setP2mp(flags.get(N_FLAG_OFFSET));
builder.setEroCompression(flags.get(E_FLAG_OFFSET));
builder.setMakeBeforeBreak(flags.get(M_FLAG_OFFSET));
builder.setOrder(flags.get(D_FLAG_OFFSET));
builder.setPathKey(flags.get(P_FLAG_OFFSET));
builder.setSupplyOf(flags.get(S_FLAG_OFFSET));
builder.setLoose(flags.get(O_FLAG_OFFSET));
builder.setBiDirectional(flags.get(B_FLAG_OFFSET));
builder.setReoptimization(flags.get(R_FLAG_OFFSET));
builder.setRequestId(new RequestId(bytes.readUnsignedInt()));
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
builder.setTlvs(tlvsBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPEndPointsIpv6ObjectParser method parseObject.
@Override
public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final EndpointsObjBuilder builder = new EndpointsObjBuilder();
if (!header.isProcessingRule()) {
LOG.debug("Processed bit not set on Endpoints OBJECT, ignoring it.");
return new UnknownObject(PCEPErrors.P_FLAG_NOT_SET, builder.build());
}
if (bytes.readableBytes() != Ipv6Util.IPV6_LENGTH * 2) {
throw new PCEPDeserializerException("Wrong length of array of bytes.");
}
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
final Ipv6Builder b = new Ipv6Builder();
b.setSourceIpv6Address(Ipv6Util.addressForByteBuf(bytes));
b.setDestinationIpv6Address(Ipv6Util.addressForByteBuf(bytes));
builder.setAddressFamily(new Ipv6CaseBuilder().setIpv6(b.build()).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPExistingBandwidthObjectParser method parseObject.
@Override
public ReoptimizationBandwidth parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (bytes.readableBytes() != PCEPBandwidthObjectParser.BANDWIDTH_F_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + bytes.readableBytes() + "; Expected: " + PCEPBandwidthObjectParser.BANDWIDTH_F_LENGTH + ".");
}
final ReoptimizationBandwidthBuilder builder = new ReoptimizationBandwidthBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setBandwidth(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth(ByteArray.getAllBytes(bytes)));
return builder.build();
}
Aggregations