public abstract class AbstractMessageParser implements MessageParser, MessageSerializer {
- private final static int COMMON_OBJECT_HEADER_LENGTH = 4;
+ private static final int COMMON_OBJECT_HEADER_LENGTH = 4;
- private final static int OC_F_LENGTH = 1;
- private final static int OT_FLAGS_MF_LENGTH = 1;
- private final static int OBJ_LENGTH_F_LENGTH = 2;
+ private static final int OC_F_LENGTH = 1;
+ private static final int OT_FLAGS_MF_LENGTH = 1;
+ private static final int OBJ_LENGTH_F_LENGTH = 2;
- private final static int OC_F_OFFSET = 0;
- private final static int OT_FLAGS_MF_OFFSET = OC_F_OFFSET + OC_F_LENGTH;
- private final static int OBJ_LENGTH_F_OFFSET = OT_FLAGS_MF_OFFSET + OT_FLAGS_MF_LENGTH;
+ private static final int OC_F_OFFSET = 0;
+ private static final int OT_FLAGS_MF_OFFSET = OC_F_OFFSET + OC_F_LENGTH;
+ private static final int OBJ_LENGTH_F_OFFSET = OT_FLAGS_MF_OFFSET + OT_FLAGS_MF_LENGTH;
- private final static int OT_SF_LENGTH = 4;
- private final static int FLAGS_SF_LENGTH = 4;
+ private static final int OT_SF_LENGTH = 4;
+ private static final int FLAGS_SF_LENGTH = 4;
/*
* offsets of fields inside of multi-field in bits
*/
- private final static int OT_SF_OFFSET = 0;
- private final static int FLAGS_SF_OFFSET = OT_SF_OFFSET + OT_SF_LENGTH;
+ private static final int OT_SF_OFFSET = 0;
+ private static final int FLAGS_SF_OFFSET = OT_SF_OFFSET + OT_SF_LENGTH;
/*
* flags offsets inside multi-filed
*/
- private final static int P_FLAG_OFFSET = 6;
- private final static int I_FLAG_OFFSET = 7;
+ private static final int P_FLAG_OFFSET = 6;
+ private static final int I_FLAG_OFFSET = 7;
private final ObjectHandlerRegistry registry;
return objs;
}
- protected PcerrMessage createErrorMsg(PCEPErrors e) {
+ protected PcerrMessage createErrorMsg(final PCEPErrors e) {
final PCEPErrorMapping maping = PCEPErrorMapping.getInstance();
return new PcerrBuilder().setPcerrMessage(
new PcerrMessageBuilder().setErrors(
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcupdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcupdMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.Iro;
import com.google.common.collect.Lists;
/**
- * Parser for {@link PcupdMessage}
+ * Parser for {@link Pcupd}
*/
public class PCEPUpdateRequestMessageParser extends AbstractMessageParser {
Requests req = null;
while (!objects.isEmpty()) {
try {
- if ((req = this.getValidRequest(objects)) == null) {
+ req = this.getValidRequest(objects);
+ if (req == null) {
break;
}
} catch (final PCEPDocumentedException e) {
final XROSubobjectSerializer serializer = this.subobjReg.getSubobjectSerializer(subobject.getSubobjectType());
- final byte typeBytes = (byte) (ByteArray.cutBytes(ByteArray.intToBytes(serializer.getType()), (Integer.SIZE / 8) - 1)[0] | (subobject.isMandatory() ? 1 << 7
- : 0));
+ final byte typeBytes = (byte) (UnsignedBytes.checkedCast(serializer.getType()) | (subobject.isMandatory() ? 1 << 7 : 0));
final byte[] valueBytes = serializer.serializeSubobject(subobject);
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LspObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OperationalStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathName;
/**
- * Parser for {@link LspObject}
+ * Parser for {@link Lsp}
*/
public class PCEPLspObjectParser extends AbstractObjectWithTlvsParser<TlvsBuilder> {
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OpenObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersion;
import com.google.common.primitives.UnsignedBytes;
/**
- * Parser for {@link OpenObject}
+ * Parser for {@link Open}
*/
public class PCEPOpenObjectParser extends AbstractObjectWithTlvsParser<TlvsBuilder> {
final byte[] bytes = new byte[SUB_HEADER_LENGTH + valueBytes.length];
- final byte typeBytes = (byte) (ByteArray.cutBytes(ByteArray.intToBytes(serializer.getType()), (Integer.SIZE / 8) - 1)[0] | (subobject.isMandatory() ? 1 << 7
- : 0));
+ final byte typeBytes = (byte) (UnsignedBytes.checkedCast(serializer.getType()) | (subobject.isMandatory() ? 1 << 7 : 0));
+
final byte lengthBytes = UnsignedBytes.checkedCast(valueBytes.length);
bytes[0] = typeBytes;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ReportedRouteObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.Subobjects;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.IpPrefixSubobject;
import com.google.common.primitives.UnsignedBytes;
/**
- * Parser for {@link ReportedRouteObject}
+ * Parser for {@link IpPrefix}
*/
public class RROIpPrefixSubobjectParser implements RROSubobjectParser, RROSubobjectSerializer {
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKeySubobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PceId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.Subobjects;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobjects.subobject.type.path.key.PathKeyBuilder;
/**
- * Parser for {@link PathKeySubobject}
+ * Parser for {@link PathKeyt}
*/
public class XROPathKeySubobjectParser implements XROSubobjectParser, XROSubobjectSerializer {