*/
package org.opendaylight.protocol.pcep.parser.object;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import com.google.common.primitives.UnsignedBytes;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
}
protected List<Subobject> parseSubobjects(final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final List<Subobject> subs = new ArrayList<>();
while (buffer.isReadable()) {
final boolean mandatory =
+ buffer.readableBytes());
}
LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(buffer));
- final Subobject sub = this.subobjReg.parseSubobject(type, buffer.readSlice(length), mandatory);
+ final Subobject sub = subobjReg.parseSubobject(type, buffer.readSlice(length), mandatory);
if (sub == null) {
LOG.warn("Parsing failed for subobject type: {}. Ignoring subobject.", type);
} else {
}
protected final void serializeSubobject(final List<Subobject> subobjects, final ByteBuf buffer) {
- Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(),
- "XRO must contain at least one subobject.");
+ checkArgument(subobjects != null && !subobjects.isEmpty(), "XRO must contain at least one subobject.");
for (final Subobject subobject : subobjects) {
- this.subobjReg.serializeSubobject(subobject, buffer);
+ subobjReg.serializeSubobject(subobject, buffer);
}
}
}