Merge "Add configuration for extensions"
authorDana Kutenicsova <dkutenic@cisco.com>
Wed, 20 Nov 2013 09:16:32 +0000 (09:16 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 20 Nov 2013 09:16:32 +0000 (09:16 +0000)
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/AbstractMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPUpdateRequestMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PcinitiateMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractXROWithSubobjectsParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPLspObjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPOpenObjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/EROExplicitExclusionRouteSubobjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROIpPrefixSubobjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/XROPathKeySubobjectParser.java

index 6f6c15e2d55c16eabafc009f1fc037e029f9eb99..66dd3fcf8e9020433467cdb3159f341045d1afd6 100644 (file)
@@ -30,30 +30,30 @@ import com.google.common.primitives.UnsignedBytes;
 
 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;
 
@@ -145,7 +145,7 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
                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(
index d8f636938a84bed0a35f3ce039f7146081545312..32c617792dcb0b721d4b5a766a626c79dec5ce83 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.mes
 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;
@@ -39,7 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import com.google.common.collect.Lists;
 
 /**
- * Parser for {@link PcupdMessage}
+ * Parser for {@link Pcupd}
  */
 public class PCEPUpdateRequestMessageParser extends AbstractMessageParser {
 
index 544b1dc0596bacf4055f4f4a9788c0a7153ccae0..b31b969c19e2f1d970919e58783f2926ecd4863e 100644 (file)
@@ -105,7 +105,8 @@ public class PcinitiateMessageParser 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) {
index b432a748885cc85f17f73e2b20abfe5f9160d16d..a60b2141d932de98bb87599c9041028aca95656d 100644 (file)
@@ -90,8 +90,7 @@ public abstract class AbstractXROWithSubobjectsParser implements ObjectParser, O
 
                        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);
 
index 695591c6ffeca5c3e80c5b7926ff50112cd2f643..9c328257ea6b6f0b3b82224423dd6821623066a1 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 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;
@@ -29,7 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 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> {
 
index 581a90cfb31cdcbde5be9c40890f7ecf0e5a8948..4271137ca866a07ddd69d9cd4be654da5db3e695 100644 (file)
@@ -15,7 +15,6 @@ 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.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;
@@ -30,7 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import com.google.common.primitives.UnsignedBytes;
 
 /**
- * Parser for {@link OpenObject}
+ * Parser for {@link Open}
  */
 
 public class PCEPOpenObjectParser extends AbstractObjectWithTlvsParser<TlvsBuilder> {
index 81f039861b84fd6b591472ce1973f6b97ad5a48d..5143844d91faf4d98a1114bb806fc9dd577b67f7 100644 (file)
@@ -133,8 +133,8 @@ public class EROExplicitExclusionRouteSubobjectParser implements EROSubobjectPar
 
                        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;
index 6683049dd31a95ba35599ecb7fd0d261c8db6062..8ebf7b2a79e9bba9d6d6045919aedf5eac9d9649 100644 (file)
@@ -17,7 +17,6 @@ import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
 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;
@@ -26,7 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import com.google.common.primitives.UnsignedBytes;
 
 /**
- * Parser for {@link ReportedRouteObject}
+ * Parser for {@link IpPrefix}
  */
 public class RROIpPrefixSubobjectParser implements RROSubobjectParser, RROSubobjectSerializer {
 
index 171725fe8b882939250b64719adba814b3ea8791..58396fd709615b153ad70851c133c57e3b1fbb57 100644 (file)
@@ -14,14 +14,13 @@ import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
 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 {