BUG-50 : added parsers for Notification and Error Object. 24/2324/1
authorDana Kutenicsova <dkutenic@cisco.com>
Sat, 2 Nov 2013 15:21:05 +0000 (16:21 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Sat, 2 Nov 2013 15:21:05 +0000 (16:21 +0100)
Change-Id: I22587d21ee5140533b0f462a9c98ca8999320f8c
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
14 files changed:
pcep/api/src/main/yang/pcep-types.yang
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractObjectWithTlvsParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPErrorObjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPNotificationObjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tlv/OverloadedDurationTlvParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tlv/ReqMissingTlvParser.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java
pcep/impl/src/test/resources/PCEPErrorObject1.bin
pcep/impl/src/test/resources/PCEPErrorObject2Invalid.bin [deleted file]
pcep/impl/src/test/resources/PCEPErrorObject3.bin
pcep/impl/src/test/resources/PCEPNotificationObject1WithTlv.bin
pcep/impl/src/test/resources/PCEPNotificationObject2WithoutTlv.bin

index ed8b20ba0b21cccc8a36ea8a64a16363f19f0e40..4546bb97800f36e89304ecfd952d3807a55ec1d4 100644 (file)
@@ -144,21 +144,23 @@ module pcep-types {
        grouping overload-duration-tlv {
                description "OVERLOAD-DURATION TLV";
                reference "https://tools.ietf.org/html/rfc5440#section-7.14";
-
-               uses tlv;
-               leaf duration {
-                       type uint32;
-                       units seconds;
+               container overload-duration {
+                       uses tlv;
+                       leaf duration {
+                               type uint32;
+                               units seconds;
+                       }
                }
        }
 
        grouping req-missing-tlv {
                description "REQ-MISSING TLV";
                reference "https://tools.ietf.org/html/rfc5440#section-7.5";
-
-               uses tlv;
-               leaf request-id {
-                       type request-id;
+               container req-missing {
+                       uses tlv;
+                       leaf request-id {
+                               type request-id;
+                       }
                }
        }
        
@@ -704,11 +706,9 @@ module pcep-types {
 
                uses object;
                container "tlvs" {
-                       container overload-duration {
-                               when "../type = 2 and ../value = 1";
+                       when "../type = 2 and ../value = 1";
 
-                               uses overload-duration-tlv;
-                       }
+                       uses overload-duration-tlv;
                }
 
                leaf type {
@@ -728,10 +728,8 @@ module pcep-types {
 
                uses object;
                container "tlvs" {
-                       container req-missing {
-                               when "../type = 7";
-                               uses req-missing-tlv;
-                       }
+                       when "../type = 7";
+                       uses req-missing-tlv;
                }
 
                leaf type {
index 946f80f41b5711127a8dbc6b3530f167cf01f9e1..f8050a0782dc533e8a45d757d0037b2a0c8ef8da 100644 (file)
@@ -104,7 +104,6 @@ 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.OpenMessage;
 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.OrderTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OverloadDurationTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKeyObject;
 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.PcepErrorObject;
@@ -117,13 +116,14 @@ 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.PcupdMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PredundancyGroupIdTlv;
 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.ReqMissingTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RpObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RsvpErrorSpecTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.StatefulCapabilityTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SvecObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SymbolicPathNameTlv;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.AsNumberSubobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.IpPrefixSubobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.LabelSubobject;
@@ -214,8 +214,8 @@ public final class Activator implements PCEPExtensionProviderActivator {
                context.registerTlvParser(PredundancyGroupTlvParser.TYPE, new PredundancyGroupTlvParser());
 
                context.registerTlvSerializer(NoPathVectorTlv.class, new NoPathVectorTlvParser());
-               context.registerTlvSerializer(OverloadDurationTlv.class, new OverloadedDurationTlvParser());
-               context.registerTlvSerializer(ReqMissingTlv.class, new ReqMissingTlvParser());
+               context.registerTlvSerializer(OverloadDuration.class, new OverloadedDurationTlvParser());
+               context.registerTlvSerializer(ReqMissing.class, new ReqMissingTlvParser());
                context.registerTlvSerializer(OfListTlv.class, new OFListTlvParser());
                context.registerTlvSerializer(OrderTlv.class, new OrderTlvParser());
                context.registerTlvSerializer(StatefulCapabilityTlv.class, new PCEStatefulCapabilityTlvParser());
index 4bba7b8315078cffe8b2409cb0b6e50e0ee6277d..05c7ef09098777bca19606eb73dac270ab9829d3 100644 (file)
@@ -50,7 +50,7 @@ public abstract class AbstractObjectWithTlvsParser<BUILDER> implements ObjectPar
                        length = ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, TLV_LENGTH_F_LENGTH));
                        byteOffset += TLV_LENGTH_F_LENGTH;
 
-                       if (TLV_HEADER_LENGTH + length > bytes.length - byteOffset) {
+                       if (TLV_HEADER_LENGTH + length > bytes.length) {
                                throw new PCEPDeserializerException("Wrong length specified. Passed: " + (TLV_HEADER_LENGTH + length) + "; Expected: <= "
                                                + (bytes.length - byteOffset) + ".");
                        }
@@ -59,7 +59,7 @@ public abstract class AbstractObjectWithTlvsParser<BUILDER> implements ObjectPar
 
                        logger.trace("Attempt to parse tlv from bytes: {}", ByteArray.bytesToHexString(tlvBytes));
                        final Tlv tlv = this.tlvReg.getTlvParser(type).parseTlv(tlvBytes);
-                       logger.trace("Tlv was parsed. {}", tlv);
+                       logger.debug("Tlv was parsed. {}", tlv);
 
                        addTlv(builder, tlv);
 
index 46847cad93a64e3df1b52a206c213b7aad0e3200..934f880d4744fb845d3cafc8041884d72dfa117d 100644 (file)
@@ -14,13 +14,14 @@ 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.PcepErrorObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ReqMissingTlv;
 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.pcep.error.object.Tlvs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.TlvsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.tlvs.ReqMissingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.Errors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing;
+
+import com.google.common.primitives.UnsignedBytes;
 
 /**
  * Parser for {@link org.opendaylight.protocol.pcep.object.PCEPErrorObject PCEPErrorObject}
@@ -31,14 +32,14 @@ public class PCEPErrorObjectParser extends AbstractObjectWithTlvsParser<ErrorsBu
 
        public static final int TYPE = 1;
 
-       public static final int FLAGS_F_LENGTH = 1;
-       public static final int ET_F_LENGTH = 1;
-       public static final int EV_F_LENGTH = 1;
+       private static final int FLAGS_F_LENGTH = 1;
+       private static final int ET_F_LENGTH = 1;
+       private static final int EV_F_LENGTH = 1;
 
-       public static final int FLAGS_F_OFFSET = 1; // added reserved field of size 1 byte
-       public static final int ET_F_OFFSET = FLAGS_F_OFFSET + FLAGS_F_LENGTH;
-       public static final int EV_F_OFFSET = ET_F_OFFSET + ET_F_LENGTH;
-       public static final int TLVS_OFFSET = EV_F_OFFSET + EV_F_LENGTH;
+       private static final int FLAGS_F_OFFSET = 1;
+       private static final int ET_F_OFFSET = FLAGS_F_OFFSET + FLAGS_F_LENGTH;
+       private static final int EV_F_OFFSET = ET_F_OFFSET + ET_F_LENGTH;
+       private static final int TLVS_OFFSET = EV_F_OFFSET + EV_F_LENGTH;
 
        public PCEPErrorObjectParser(final TlvHandlerRegistry tlvReg) {
                super(tlvReg);
@@ -52,23 +53,18 @@ public class PCEPErrorObjectParser extends AbstractObjectWithTlvsParser<ErrorsBu
                }
 
                final ErrorsBuilder builder = new ErrorsBuilder();
-
-               parseTlvs(builder, ByteArray.cutBytes(bytes, TLVS_OFFSET));
-
                builder.setIgnore(header.isIgnore());
                builder.setProcessingRule(header.isProcessingRule());
-
-               builder.setType((short) (bytes[ET_F_OFFSET] & 0xFF));
-               builder.setValue((short) (bytes[EV_F_OFFSET] & 0xFF));
-
+               builder.setType((short) UnsignedBytes.toInt(bytes[ET_F_OFFSET]));
+               builder.setValue((short) UnsignedBytes.toInt(bytes[EV_F_OFFSET]));
+               parseTlvs(builder, ByteArray.cutBytes(bytes, TLVS_OFFSET));
                return builder.build();
        }
 
        @Override
        public void addTlv(final ErrorsBuilder builder, final Tlv tlv) {
-               if (tlv instanceof ReqMissingTlv && builder.getType() == 7) {
-                       builder.setTlvs(new TlvsBuilder().setReqMissing(
-                                       new ReqMissingBuilder().setRequestId(((ReqMissingTlv) tlv).getRequestId()).build()).build());
+               if (tlv instanceof ReqMissing && builder.getType() == 7) {
+                       builder.setTlvs(new TlvsBuilder().setReqMissing((ReqMissing) tlv).build());
                }
        }
 
@@ -77,31 +73,26 @@ public class PCEPErrorObjectParser extends AbstractObjectWithTlvsParser<ErrorsBu
                if (!(object instanceof PcepErrorObject)) {
                        throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed PcepErrorObject.");
                }
-
                final PcepErrorObject errObj = (PcepErrorObject) object;
 
                final byte[] tlvs = serializeTlvs(((Errors) errObj).getTlvs());
-               int tlvsLength = 0;
-               if (tlvs != null) {
-                       tlvsLength = tlvs.length;
-               }
-               final byte[] retBytes = new byte[TLVS_OFFSET + tlvsLength + getPadding(TLVS_OFFSET + tlvs.length, PADDED_TO)];
 
-               if (tlvs != null) {
+               final byte[] retBytes = new byte[TLVS_OFFSET + tlvs.length + getPadding(TLVS_OFFSET + tlvs.length, PADDED_TO)];
+               if (tlvs.length != 0) {
                        ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
                }
-
-               retBytes[ET_F_OFFSET] = ByteArray.shortToBytes(errObj.getType())[1];
-               retBytes[EV_F_OFFSET] = ByteArray.shortToBytes(errObj.getValue())[1];
-
+               retBytes[ET_F_OFFSET] = UnsignedBytes.checkedCast(errObj.getType());
+               retBytes[EV_F_OFFSET] = UnsignedBytes.checkedCast(errObj.getValue());
                return retBytes;
        }
 
        public byte[] serializeTlvs(final Tlvs tlvs) {
-               if (tlvs.getReqMissing() != null) {
-                       return serializeTlv(new ReqMissingBuilder().setRequestId(tlvs.getReqMissing().getRequestId()).build());
+               if (tlvs == null) {
+                       return new byte[0];
+               } else if (tlvs.getReqMissing() != null) {
+                       return serializeTlv(tlvs.getReqMissing());
                }
-               return null;
+               return new byte[0];
        }
 
        @Override
index 9ca0dd32cbb019799c5841119cd6c6a991647cd2..fa121cb0af9b3434cc44afb81f6141d47b9e97d2 100644 (file)
@@ -14,13 +14,14 @@ import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.NotificationObject;
 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.OverloadDurationTlv;
 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.notification.object.Tlvs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.notification.object.TlvsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.notification.object.tlvs.OverloadDurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.NotificationsBuilder;
 
+import com.google.common.primitives.UnsignedBytes;
+
 /**
  * Parser for {@link NotificationObject}
  */
@@ -33,17 +34,17 @@ public class PCEPNotificationObjectParser extends AbstractObjectWithTlvsParser<N
        /*
         * lengths of fields
         */
-       public static final int FLAGS_F_LENGTH = 1;
-       public static final int NT_F_LENGTH = 1;
-       public static final int NV_F_LENGTH = 1;
+       private static final int FLAGS_F_LENGTH = 1;
+       private static final int NT_F_LENGTH = 1;
+       private static final int NV_F_LENGTH = 1;
 
        /*
         * offsets of fields
         */
-       public static final int FLAGS_F_OFFSET = 1; // added reserved filed of size 1
-       public static final int NT_F_OFFSET = FLAGS_F_OFFSET + FLAGS_F_LENGTH;
-       public static final int NV_F_OFFSET = NT_F_OFFSET + NT_F_LENGTH;
-       public static final int TLVS_OFFSET = NV_F_OFFSET + NV_F_LENGTH;
+       private static final int FLAGS_F_OFFSET = 1;
+       private static final int NT_F_OFFSET = FLAGS_F_OFFSET + FLAGS_F_LENGTH;
+       private static final int NV_F_OFFSET = NT_F_OFFSET + NT_F_LENGTH;
+       private static final int TLVS_OFFSET = NV_F_OFFSET + NV_F_LENGTH;
 
        public PCEPNotificationObjectParser(final TlvHandlerRegistry tlvReg) {
                super(tlvReg);
@@ -55,25 +56,19 @@ public class PCEPNotificationObjectParser extends AbstractObjectWithTlvsParser<N
                if (bytes == null || bytes.length == 0) {
                        throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
                }
-
                final NotificationsBuilder builder = new NotificationsBuilder();
-
-               parseTlvs(builder, ByteArray.cutBytes(bytes, TLVS_OFFSET));
-
                builder.setIgnore(header.isIgnore());
                builder.setProcessingRule(header.isProcessingRule());
-
-               builder.setType((short) (bytes[NT_F_OFFSET] & 0xFF));
-               builder.setValue((short) (bytes[NV_F_OFFSET] & 0xFF));
-
+               builder.setType((short) UnsignedBytes.toInt(bytes[NT_F_OFFSET]));
+               builder.setValue((short) UnsignedBytes.toInt(bytes[NV_F_OFFSET]));
+               parseTlvs(builder, ByteArray.cutBytes(bytes, TLVS_OFFSET));
                return builder.build();
        }
 
        @Override
        public void addTlv(final NotificationsBuilder builder, final Tlv tlv) {
-               if (tlv instanceof OverloadDurationTlv && builder.getType() == 2 && builder.getValue() == 1) {
-                       builder.setTlvs(new TlvsBuilder().setOverloadDuration(
-                                       new OverloadDurationBuilder().setDuration(((OverloadDurationTlv) tlv).getDuration()).build()).build());
+               if (tlv instanceof OverloadDuration && builder.getType() == 2 && builder.getValue() == 1) {
+                       builder.setTlvs(new TlvsBuilder().setOverloadDuration((OverloadDuration) tlv).build());
                }
        }
 
@@ -82,32 +77,26 @@ public class PCEPNotificationObjectParser extends AbstractObjectWithTlvsParser<N
                if (!(object instanceof NotificationObject)) {
                        throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed NotificationObject.");
                }
-
                final NotificationObject notObj = (NotificationObject) object;
 
                final byte[] tlvs = serializeTlvs(notObj.getTlvs());
-               int tlvsLength = 0;
-               if (tlvs != null) {
-                       tlvsLength = tlvs.length;
-               }
-               final byte[] retBytes = new byte[TLVS_OFFSET + tlvsLength + getPadding(TLVS_OFFSET + tlvs.length, PADDED_TO)];
 
-               if (tlvs != null) {
+               final byte[] retBytes = new byte[TLVS_OFFSET + tlvs.length + getPadding(TLVS_OFFSET + tlvs.length, PADDED_TO)];
+               if (tlvs.length != 0) {
                        ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
                }
-
-               retBytes[NT_F_OFFSET] = ByteArray.shortToBytes(notObj.getType())[1];
-               retBytes[NV_F_OFFSET] = ByteArray.shortToBytes(notObj.getValue())[1];
-
+               retBytes[NT_F_OFFSET] = UnsignedBytes.checkedCast(notObj.getType());
+               retBytes[NV_F_OFFSET] = UnsignedBytes.checkedCast(notObj.getValue());
                return retBytes;
        }
 
        public byte[] serializeTlvs(final Tlvs tlvs) {
-               if (tlvs.getOverloadDuration() != null) {
-                       // FIXME : add
-                       // return serializeTlv(new NoPathVectorBuilder().setFlags(tlvs.getNoPathVector()).build());
+               if (tlvs == null) {
+                       return new byte[0];
+               } else if (tlvs.getOverloadDuration() != null) {
+                       return serializeTlv(tlvs.getOverloadDuration());
                }
-               return null;
+               return new byte[0];
        }
 
        @Override
index b1879299895cb72bc87b0ab9e01c6ea11261f7c9..23bf719d466d2d4fd44c6e3c7ad7202e5c4ffbb4 100644 (file)
@@ -11,12 +11,12 @@ import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.TlvParser;
 import org.opendaylight.protocol.pcep.spi.TlvSerializer;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OverloadDurationTlv;
 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.notification.object.tlvs.OverloadDurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDurationBuilder;
 
 /**
- * Parser for {@link OverloadDurationTlv}
+ * Parser for {@link OverloadDuration}
  */
 public class OverloadedDurationTlvParser implements TlvParser, TlvSerializer {
 
@@ -25,9 +25,8 @@ public class OverloadedDurationTlvParser implements TlvParser, TlvSerializer {
        private static final int OVERLOADED_DURATION_LENGTH = 4;
 
        @Override
-       public OverloadDurationTlv parseTlv(final byte[] buffer) throws PCEPDeserializerException {
-               final long l = ByteArray.bytesToInt(ByteArray.subByte(buffer, 0, OVERLOADED_DURATION_LENGTH));
-               return new OverloadDurationBuilder().setDuration(l).build();
+       public OverloadDuration parseTlv(final byte[] buffer) throws PCEPDeserializerException {
+               return new OverloadDurationBuilder().setDuration(ByteArray.bytesToLong(ByteArray.subByte(buffer, 0, OVERLOADED_DURATION_LENGTH))).build();
        }
 
        @Override
@@ -35,7 +34,7 @@ public class OverloadedDurationTlvParser implements TlvParser, TlvSerializer {
                if (tlv == null) {
                        throw new IllegalArgumentException("OverloadedTlv is mandatory.");
                }
-               final OverloadDurationTlv odt = (OverloadDurationTlv) tlv;
+               final OverloadDuration odt = (OverloadDuration) tlv;
                return ByteArray.subByte(ByteArray.longToBytes(odt.getDuration()), OVERLOADED_DURATION_LENGTH, OVERLOADED_DURATION_LENGTH);
        }
 
index 9ef75ce1f639f763afafbc34e5dbfa948eb99da9..2687fe02e439f448030c9090dfc301d061b58b20 100644 (file)
@@ -11,13 +11,13 @@ import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.TlvParser;
 import org.opendaylight.protocol.pcep.spi.TlvSerializer;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ReqMissingTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId;
 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.pcep.error.object.tlvs.ReqMissingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder;
 
 /**
- * Parser {@link ReqMissingTlv}
+ * Parser {@link ReqMissing}
  */
 public class ReqMissingTlvParser implements TlvParser, TlvSerializer {
 
@@ -26,7 +26,7 @@ public class ReqMissingTlvParser implements TlvParser, TlvSerializer {
        private static final int REQ_ID_LENGTH = 4;
 
        @Override
-       public ReqMissingTlv parseTlv(final byte[] buffer) throws PCEPDeserializerException {
+       public ReqMissing parseTlv(final byte[] buffer) throws PCEPDeserializerException {
                return new ReqMissingBuilder().setRequestId(new RequestId(ByteArray.bytesToLong(ByteArray.subByte(buffer, 0, REQ_ID_LENGTH)))).build();
        }
 
@@ -35,7 +35,7 @@ public class ReqMissingTlvParser implements TlvParser, TlvSerializer {
                if (tlv == null) {
                        throw new IllegalArgumentException("ReqMissingTlv is mandatory.");
                }
-               final ReqMissingTlv req = (ReqMissingTlv) tlv;
+               final ReqMissing req = (ReqMissing) tlv;
                return ByteArray.subByte(ByteArray.longToBytes(req.getRequestId().getValue()), REQ_ID_LENGTH, REQ_ID_LENGTH);
        }
 
index 1145f1be2380f207d32b945e89485d08ba8077ac..0f482c4388009786327c4dd4e9dc7714211475c5 100644 (file)
@@ -23,10 +23,12 @@ import org.opendaylight.protocol.pcep.impl.object.PCEPBandwidthObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPClassTypeObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPCloseObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPEndPointsObjectParser;
+import org.opendaylight.protocol.pcep.impl.object.PCEPErrorObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPGlobalConstraintsObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPLoadBalancingObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPLspaObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPMetricObjectParser;
+import org.opendaylight.protocol.pcep.impl.object.PCEPNotificationObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPObjectiveFunctionObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPSrpObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPSvecObjectParser;
@@ -36,6 +38,7 @@ import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClassType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.NotificationObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OfId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpIdNumber;
@@ -45,13 +48,18 @@ 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.lsp.attributes.ClassTypeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.LspaBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.OfBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.TlvsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.EndpointsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.SrpBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.NotificationsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.SvecBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.segment.computation.p2p.LoadBalancingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.segment.computation.p2p.reported.route.BandwidthBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.svec.GcBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.svec.MetricBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.AttributeFilter;
 
 import com.google.common.collect.Lists;
@@ -257,41 +265,29 @@ public class PCEPObjectParserTest {
                assertArrayEquals(result, parser.serializeObject(builder.build()));
        }
 
-       //
-       // /**
-       // * Test of Serialization/Deserialization of PCEPErrorObjectParser.<br/>
-       // * <br/>
-       // * Used resources:<br/>
-       // * - PCEPErrorObject1.bin<br/>
-       // * - PCEPErrorObject3.bin<br/>
-       // *
-       // * @throws PCEPDeserializerException
-       // * @throws IOException
-       // * @throws PCEPDocumentedException
-       // */
-       // @Test
-       // public void testErrorObjectSerDeserWithTlv() throws PCEPDeserializerException, IOException,
-       // PCEPDocumentedException {
-       // serDeserTest("src/test/resources/PCEPErrorObject1.bin", new PCEPErrorObject(PCEPErrors.NON_OR_INVALID_OPEN_MSG));
-       // serDeserTest("src/test/resources/PCEPErrorObject3.bin", new
-       // PCEPErrorObject(PCEPErrors.CAPABILITY_NOT_SUPPORTED));
-       // }
-       //
-       // /**
-       // * Test of validity of PCEPErrorObjectParser. Expect throwed NoSuchElementException.<br/>
-       // * <br/>
-       // * Used resources:<br/>
-       // * - PCEPErrorObject2Invalid.bin<br/>
-       // *
-       // * @throws NoSuchElementException
-       // * @throws IOException
-       // * @throws PCEPDocumentedException
-       // */
-       // @Test(expected = PCEPDeserializerException.class)
-       // public void testUnknownError() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
-       // PCEPObjectFactory.parseObjects(ByteArray.fileToBytes("src/test/resources/PCEPErrorObject2Invalid.bin")).get(0);
-       // }
-       //
+       @Test
+       public void testErrorObjectWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+               final PCEPErrorObjectParser parser = new PCEPErrorObjectParser(this.tlvRegistry);
+               byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPErrorObject1.bin");
+
+               final ErrorsBuilder builder = new ErrorsBuilder();
+               builder.setProcessingRule(true);
+               builder.setIgnore(true);
+               builder.setType((short) 1);
+               builder.setValue((short) 1);
+
+               assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result));
+               assertArrayEquals(result, parser.serializeObject(builder.build()));
+
+               result = ByteArray.fileToBytes("src/test/resources/PCEPErrorObject3.bin");
+
+               builder.setType((short) 7);
+               builder.setValue((short) 0);
+               builder.setTlvs(new TlvsBuilder().setReqMissing(new ReqMissingBuilder().setRequestId(new RequestId(0x00001155L)).build()).build());
+
+               assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result));
+               assertArrayEquals(result, parser.serializeObject(builder.build()));
+       }
 
        @Test
        public void testLspaObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
@@ -381,26 +377,32 @@ public class PCEPObjectParserTest {
        // assertArrayEquals(bytesFromFile, bytesActual);
        // }
 
-       //
-       // /**
-       // * Specific test with/without tlvs (Ser/Deser)<br/>
-       // * Used resources:<br/>
-       // * - PCEPNotificationObject1WithTlv.bin - PCEPNotificationObject2WithoutTlv.bin
-       // *
-       // * @throws PCEPDeserializerException
-       // * @throws IOException
-       // * @throws PCEPDocumentedException
-       // */
-       // @Test
-       // public void testNotifyObjectSerDeserWithTlv() throws PCEPDeserializerException, IOException,
-       // PCEPDocumentedException {
-       // // FINAL LIST<PCEPTLV> TLVS = NEW ARRAYLIST<PCEPTLV>(1);
-       // // TLVS.ADD(NEW OVERLOADEDDURATIONTLV(0XFF0000A2));
-       // // SERDESERTEST("src/test/resources/PCEPNotificationObject1WithTlv.bin", new PCEPNotificationObject((short) 1,
-       // (short) 1, tlvs));
-       // serDeserTest("src/test/resources/PCEPNotificationObject2WithoutTlv.bin", new PCEPNotificationObject((short) 0xFF,
-       // (short) 0xFF));
-       // }
+       @Test
+       public void testNotifyObjectWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+               final PCEPNotificationObjectParser parser = new PCEPNotificationObjectParser(this.tlvRegistry);
+               byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPNotificationObject2WithoutTlv.bin");
+
+               final NotificationsBuilder builder = new NotificationsBuilder();
+               builder.setProcessingRule(true);
+               builder.setIgnore(true);
+               builder.setType((short) 0xff);
+               builder.setValue((short) 0xff);
+
+               assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result));
+               assertArrayEquals(result, parser.serializeObject(builder.build()));
+
+               result = ByteArray.fileToBytes("src/test/resources/PCEPNotificationObject1WithTlv.bin");
+
+               builder.setType((short) 2);
+               builder.setValue((short) 1);
+               builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.notification.object.TlvsBuilder().setOverloadDuration(
+                               new OverloadDurationBuilder().setDuration(0xff0000a2L).build()).build());
+
+               final NotificationObject t = parser.parseObject(new ObjectHeaderImpl(true, true), result);
+               assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result));
+               assertArrayEquals(result, parser.serializeObject(builder.build()));
+       }
+
        //
        // /**
        // * Standard ser deser test<br/>
index 95286efa441135a2db06edee69a92221a91ae93c..7cc2c8321a774ba14af8e9f358763cd67b28474a 100644 (file)
@@ -38,9 +38,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.OfId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OfListTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OrderTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OverloadDurationTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PredundancyGroupIdTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ReqMissingTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RsvpErrorSpecTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.StatefulCapabilityTlv;
@@ -53,13 +51,15 @@ 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.lsp.object.tlvs.LspIdentifiersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.object.tlvs.RsvpErrorSpecBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.object.tlvs.SymbolicPathNameBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.notification.object.tlvs.OverloadDurationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.tlvs.LspDbVersionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.tlvs.OfListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.tlvs.PredundancyGroupIdBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.tlvs.StatefulBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.tlvs.ReqMissingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDurationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure.no.path.tlvs.NoPathVectorBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.tlvs.OrderBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.error.type.RsvpBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rsvp.error.spec.tlv.error.type.UserBuilder;
@@ -76,32 +76,32 @@ public class PCEPTlvParserTest {
 
        private static final byte[] statefulBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02 };
        private static final byte[] DbVersionBytes = { (byte) 0xff, (byte) 0x00, (byte) 0xff, (byte) 0xaa, (byte) 0xb2, (byte) 0xf5,
-               (byte) 0xf2, (byte) 0xcf };
+                       (byte) 0xf2, (byte) 0xcf };
        private static final byte[] noPathVectorBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xa7 };
        private static final byte[] overloadedBytes = { (byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff };
        private static final byte[] symbolicNameBytes = { (byte) 0x4d, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x74, (byte) 0x65,
-               (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x73, (byte) 0x79, (byte) 0x6d,
-               (byte) 0x62, (byte) 0x6f, (byte) 0x6c, (byte) 0x69, (byte) 0x63, (byte) 0x20, (byte) 0x6e, (byte) 0x61, (byte) 0x6d,
-               (byte) 0x65 };
+                       (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x73, (byte) 0x79, (byte) 0x6d,
+                       (byte) 0x62, (byte) 0x6f, (byte) 0x6c, (byte) 0x69, (byte) 0x63, (byte) 0x20, (byte) 0x6e, (byte) 0x61, (byte) 0x6d,
+                       (byte) 0x65 };
        private static final byte[] lspUpdateErrorBytes = { (byte) 0x25, (byte) 0x68, (byte) 0x95, (byte) 0x03 };
        private static final byte[] lspIdentifiers4Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0xFF, (byte) 0xFF,
-               (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
+                       (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
        private static final byte[] lspIdentifiers6Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC,
-               (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
-               (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0xFF, (byte) 0xFF, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
-               (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x01,
-               (byte) 0x23, (byte) 0x45, (byte) 0x67 };
+                       (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
+                       (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0xFF, (byte) 0xFF, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
+                       (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x01,
+                       (byte) 0x23, (byte) 0x45, (byte) 0x67 };
        private static final byte[] rsvpErrorBytes = { (byte) 0x06, (byte) 0x01, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
-               (byte) 0x02, (byte) 0x92, (byte) 0x16, (byte) 0x02 };
+                       (byte) 0x02, (byte) 0x92, (byte) 0x16, (byte) 0x02 };
        private static final byte[] rsvpError6Bytes = { (byte) 0x06, (byte) 0x02, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
-               (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a,
-               (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x02, (byte) 0xd5, (byte) 0xc5, (byte) 0xd9 };
+                       (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a,
+                       (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x02, (byte) 0xd5, (byte) 0xc5, (byte) 0xd9 };
        private static final byte[] userErrorBytes = { (byte) 0xc2, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x30, (byte) 0x39,
-               (byte) 0x05, (byte) 0x09, (byte) 0x00, (byte) 0x26, (byte) 0x75, (byte) 0x73, (byte) 0x65, (byte) 0x72, (byte) 0x20,
-               (byte) 0x64, (byte) 0x65, (byte) 0x73, (byte) 0x63 };
+                       (byte) 0x05, (byte) 0x09, (byte) 0x00, (byte) 0x26, (byte) 0x75, (byte) 0x73, (byte) 0x65, (byte) 0x72, (byte) 0x20,
+                       (byte) 0x64, (byte) 0x65, (byte) 0x73, (byte) 0x63 };
        private static final byte[] reqMissingBytes = { (byte) 0xF7, (byte) 0x82, (byte) 0x35, (byte) 0x17 };
        private static final byte[] orderBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-               (byte) 0x01 };
+                       (byte) 0x01 };
        private static final byte[] ofListBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
        private static final byte[] predundancyBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
 
@@ -133,7 +133,7 @@ public class PCEPTlvParserTest {
        @Test
        public void testOverloadedDurationTlv() throws PCEPDeserializerException {
                final OverloadedDurationTlvParser parser = new OverloadedDurationTlvParser();
-               final OverloadDurationTlv tlv = new OverloadDurationBuilder().setDuration(0x7FFFFFFFL).build();
+               final OverloadDuration tlv = new OverloadDurationBuilder().setDuration(0x7FFFFFFFL).build();
                assertEquals(tlv, parser.parseTlv(overloadedBytes));
                assertArrayEquals(overloadedBytes, parser.serializeTlv(tlv));
        }
@@ -141,7 +141,8 @@ public class PCEPTlvParserTest {
        @Test
        public void testSymbolicNameTlv() throws PCEPDeserializerException {
                final LspSymbolicNameTlvParser parser = new LspSymbolicNameTlvParser();
-               final SymbolicPathNameTlv tlv = new SymbolicPathNameBuilder().setPathName(new SymbolicPathName("Med test of symbolic name".getBytes())).build();
+               final SymbolicPathNameTlv tlv = new SymbolicPathNameBuilder().setPathName(
+                               new SymbolicPathName("Med test of symbolic name".getBytes())).build();
                assertEquals(tlv, parser.parseTlv(symbolicNameBytes));
                assertArrayEquals(symbolicNameBytes, parser.serializeTlv(tlv));
        }
@@ -227,7 +228,7 @@ public class PCEPTlvParserTest {
        @Test
        public void testReqMissingTlv() throws PCEPDeserializerException {
                final ReqMissingTlvParser parser = new ReqMissingTlvParser();
-               final ReqMissingTlv tlv = new ReqMissingBuilder().setRequestId(new RequestId(0xF7823517L)).build();
+               final ReqMissing tlv = new ReqMissingBuilder().setRequestId(new RequestId(0xF7823517L)).build();
                assertEquals(tlv, parser.parseTlv(reqMissingBytes));
                assertArrayEquals(reqMissingBytes, parser.serializeTlv(tlv));
        }
index f7507e2992545b39dffa3f2304422251800507cb..dee9c4c8adafc2e6af2ee0379ef082b7b43cd95f 100644 (file)
Binary files a/pcep/impl/src/test/resources/PCEPErrorObject1.bin and b/pcep/impl/src/test/resources/PCEPErrorObject1.bin differ
diff --git a/pcep/impl/src/test/resources/PCEPErrorObject2Invalid.bin b/pcep/impl/src/test/resources/PCEPErrorObject2Invalid.bin
deleted file mode 100644 (file)
index 6da6e2d..0000000
Binary files a/pcep/impl/src/test/resources/PCEPErrorObject2Invalid.bin and /dev/null differ
index 17e79193caf4bfe21e8a54769624597f647f2d56..a47bbd18d0626bdaacfa7cc589895b351cd8b022 100644 (file)
Binary files a/pcep/impl/src/test/resources/PCEPErrorObject3.bin and b/pcep/impl/src/test/resources/PCEPErrorObject3.bin differ
index 827a69be480f2c83ef9eff8f97655b26c57fe511..7247848c86ee1a1365c65101185db4543cf2fffb 100644 (file)
Binary files a/pcep/impl/src/test/resources/PCEPNotificationObject1WithTlv.bin and b/pcep/impl/src/test/resources/PCEPNotificationObject1WithTlv.bin differ
index 474b6abe01c2bab3d8a48e77b65d51e0b779b07a..0a2d4bbb32ffb3c9d4afe2f5a04463a67653e8af 100644 (file)
Binary files a/pcep/impl/src/test/resources/PCEPNotificationObject2WithoutTlv.bin and b/pcep/impl/src/test/resources/PCEPNotificationObject2WithoutTlv.bin differ