Bug-5978: Unrecognized attribute flagged Well Known 94/39794/1
authorAjay <ajayl.bro@gmail.com>
Tue, 31 May 2016 19:06:38 +0000 (19:06 +0000)
committerMilos Fabian <milfabia@cisco.com>
Thu, 2 Jun 2016 18:44:24 +0000 (18:44 +0000)
- set optional bit when serializing unrecognized attributes
- updated unit-test

Change-Id: I6148596b4fb660835e485473d33cc8e961e49a20
Signed-off-by: Ajay <ajayl.bro@gmail.com>
(cherry picked from commit 6ceae5695cb4df811029ebd4936a949043fa8c9b)

bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/UnrecognizedAttributesSerializer.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/UnrecognizedAttributesSerializerTest.java

index 1175f0885870ef0b38a9036186104e7fe6f892bc..df05c64253b2c44add82d733c6882f5e16ea528b 100755 (executable)
@@ -32,7 +32,7 @@ public class UnrecognizedAttributesSerializer implements AttributeSerializer {
         }
         for (final UnrecognizedAttributes unrecognizedAttr: unrecognizedAttrs) {
             LOG.trace("Serializing unrecognized attribute of type {}", unrecognizedAttr.getType());
-            int flags = 0;
+            int flags = AttributeUtil.OPTIONAL;
             if (unrecognizedAttr.isPartial()) {
                 flags |= AttributeUtil.PARTIAL;
             }
index cb41d57c5a02658004c82bae03ec961b486a68ea..35f861d81aadc1c0d6f2f5b93ced7af358d2eef0 100755 (executable)
@@ -29,8 +29,8 @@ public class UnrecognizedAttributesSerializerTest {
     public void testUnrecognizedAttributesSerializer() {
         final byte[] unrecognizedValue1 = { (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35 };
         final byte[] unrecognizedValue2 = { (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75 };
-        final byte[] unrecognizedBytes = { 0x60, 0x65, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35,
-                                           0x60, 0x66, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75 };
+        final byte[] unrecognizedBytes = { (byte)0xe0, 0x65, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35,
+                                           (byte)0xe0, 0x66, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75 };
         final List<UnrecognizedAttributes> unrecognizedAttrs = new ArrayList<>();
         final UnrecognizedAttributes unrecognizedAttribute1 = new UnrecognizedAttributesBuilder().setPartial(true).setTransitive(true).setType((short) 101).setValue(unrecognizedValue1).build();
         unrecognizedAttrs.add(unrecognizedAttribute1);