Reordered serialization of prefix attributes. 36/19136/2
authorDana Kutenicsova <dkutenic@cisco.com>
Mon, 27 Apr 2015 09:16:05 +0000 (11:16 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Mon, 27 Apr 2015 10:37:11 +0000 (12:37 +0200)
TLV types serialized must be in ascending order.

Change-Id: I02009ff56b857e58f2efbaa1846bf69fa1277a82
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/attribute/PrefixAttributesParser.java
bgp/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAttributeParserTest.java

index 0f5cec9e5ec667f73b6dd9117f05e7147a926022..30905e683894cfdf268ff5a25c13bfe0b2fd41f0 100644 (file)
@@ -162,10 +162,10 @@ public final class PrefixAttributesParser {
             }
             TlvUtil.writeTLV(EXTENDED_ROUTE_TAG, extendedBuf, byteAggregator);
         }
-        serializeForwardingAddress(prefixAtrributes.getOspfForwardingAddress(), byteAggregator);
         if (prefixAtrributes.getPrefixMetric() != null) {
             TlvUtil.writeTLV(PREFIX_METRIC, Unpooled.copyInt(prefixAtrributes.getPrefixMetric().getValue().intValue()), byteAggregator);
         }
+        serializeForwardingAddress(prefixAtrributes.getOspfForwardingAddress(), byteAggregator);
         if (prefixAtrributes.getSrPrefix() != null) {
             final ByteBuf b = Unpooled.buffer();
             SrPrefixAttributesParser.serializeSrPrefix(prefixAtrributes.getSrPrefix(), b);
index 955dcca32a212f0ab8c01e5e1fa367cf7d2a234e..3e74b98e0fd6b5068b5eb2ec9e07c3babdc0ecde 100644 (file)
@@ -74,8 +74,8 @@ public class LinkstateAttributeParserTest {
         0x29, 0x29, 0x29, 0x29};
 
     private static final byte[] P4_ATTR = { 0x04, (byte) 0x80, 0, 0x01, (byte) 0x80, 0x04, (byte) 0x81, 0, 0x08, 0x12, 0x34, 0x56, 0x78,
-        0x10, 0x30, 0x50, 0x70, 0x04, (byte) 0x82, 0, 0x08, 0x12, 0x34, 0x56, 0x78, 0x10, 0x30, 0x50, 0x70, 0x04, (byte) 0x84, 0, 0x04, 0x0a, 0x19, 0x02, 0x1b,
-        0x04, (byte) 0x83, 0, 0x04, 0, 0, 0, 0x0a, 0x04, (byte) 0x88, 0, 0x01, 0x0a };
+        0x10, 0x30, 0x50, 0x70, 0x04, (byte) 0x82, 0, 0x08, 0x12, 0x34, 0x56, 0x78, 0x10, 0x30, 0x50, 0x70,
+        0x04, (byte) 0x83, 0, 0x04, 0, 0, 0, 0x0a, 0x04, (byte) 0x84, 0, 0x04, 0x0a, 0x19, 0x02, 0x1b, 0x04, (byte) 0x88, 0, 0x01, 0x0a };
 
     private final LinkstateAttributeParser parser = new LinkstateAttributeParser(false);