use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder in project bgpcep by opendaylight.
the class XROIpv4PrefixSubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean mandatory) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
builder.setMandatory(mandatory);
if (buffer.readableBytes() != CONTENT4_LENGTH) {
throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
}
final int length = buffer.getUnsignedByte(PREFIX4_F_OFFSET);
final IpPrefixBuilder prefix = new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv4Util.prefixForBytes(ByteArray.readBytes(buffer, Ipv4Util.IP4_LENGTH), length)));
builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(prefix.build()).build());
buffer.skipBytes(PREFIX_F_LENGTH);
builder.setAttribute(ExcludeRouteSubobjects.Attribute.forValue(buffer.readUnsignedByte()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder in project bgpcep by opendaylight.
the class EROPathKey128SubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean loose) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT128_LENGTH) {
throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; " + "Expected: >" + CONTENT128_LENGTH + ".");
}
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
builder.setLoose(loose);
builder.setSubobjectType(new PathKeyCaseBuilder().setPathKey(parsePathKey(PCE128_ID_F_LENGTH, buffer)).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder in project bgpcep by opendaylight.
the class EROPathKey32SubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean loose) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT_LENGTH) {
throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; " + "Expected: >" + CONTENT_LENGTH + ".");
}
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
builder.setLoose(loose);
builder.setSubobjectType(new PathKeyCaseBuilder().setPathKey(parsePathKey(PCE_ID_F_LENGTH, buffer)).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder in project bgpcep by opendaylight.
the class SEROBasicProtectionSubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean loose) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
builder.setLoose(loose);
// skip reserved
buffer.readByte();
final short cType = buffer.readUnsignedByte();
final ProtectionSubobject prot = parseCommonProtectionBody(cType, buffer);
if (cType == CTYPE) {
builder.setSubobjectType(new BasicProtectionCaseBuilder().setBasicProtection(new BasicProtectionBuilder().setProtectionSubobject(prot).build()).build());
} else if (cType == SERODynamicProtectionSubobjectParser.CTYPE) {
builder.setSubobjectType(new DynamicControlProtectionCaseBuilder().setDynamicControlProtection(new DynamicControlProtectionBuilder().setProtectionSubobject(prot).build()).build());
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder in project bgpcep by opendaylight.
the class XROPathKey32SubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean mandatory) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT_LENGTH) {
throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; " + "Expected: >" + CONTENT_LENGTH + ".");
}
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
builder.setMandatory(mandatory);
builder.setSubobjectType(new PathKeyCaseBuilder().setPathKey(parsePathKey(PCE_ID_F_LENGTH, buffer)).build());
return builder.build();
}
Aggregations