use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType in project bgpcep by opendaylight.
the class WavebandSwitchingLabelParser method serializeLabel.
@Override
public final void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject instanceof WavebandSwitchingLabelCase, "Unknown Label Subobject instance. Passed {}. Needed WavebandSwitchingLabelCase.", subobject.getClass());
final WavebandSwitchingLabel obj = ((WavebandSwitchingLabelCase) subobject).getWavebandSwitchingLabel();
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
Preconditions.checkArgument(obj.getWavebandId() != null, "WavebandId is mandatory.");
writeUnsignedInt(obj.getWavebandId(), body);
Preconditions.checkArgument(obj.getStartLabel() != null, "StartLabel is mandatory.");
writeUnsignedInt(obj.getStartLabel(), body);
Preconditions.checkArgument(obj.getEndLabel() != null, "EndLabel is mandatory.");
writeUnsignedInt(obj.getEndLabel(), body);
LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType in project bgpcep by opendaylight.
the class WavebandSwitchingLabelParser method parseLabel.
@Override
public LabelType parseLabel(final ByteBuf buffer) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; Expected: " + CONTENT_LENGTH + ".");
}
final WavebandSwitchingLabelBuilder builder = new WavebandSwitchingLabelBuilder();
builder.setWavebandId(buffer.readUnsignedInt());
builder.setStartLabel(buffer.readUnsignedInt());
builder.setEndLabel(buffer.readUnsignedInt());
return new WavebandSwitchingLabelCaseBuilder().setWavebandSwitchingLabel(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType in project bgpcep by opendaylight.
the class WavebandSwitchingLabelParser method serializeLabel.
@Override
public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject instanceof WavebandSwitchingLabelCase, "Unknown Label Subobject instance. Passed {}. Needed WavebandSwitchingLabelCase.", subobject.getClass());
final WavebandSwitchingLabel obj = ((WavebandSwitchingLabelCase) subobject).getWavebandSwitchingLabel();
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
Preconditions.checkArgument(obj.getWavebandId() != null, "WavebandId is mandatory.");
writeUnsignedInt(obj.getWavebandId(), body);
Preconditions.checkArgument(obj.getStartLabel() != null, "StartLabel is mandatory.");
writeUnsignedInt(obj.getStartLabel(), body);
Preconditions.checkArgument(obj.getEndLabel() != null, "EndLabel is mandatory.");
writeUnsignedInt(obj.getEndLabel(), body);
LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
Aggregations