SrRangeTlv: inner area parsing/serializing 24/29924/2
authorIveta Halanova <ihalanov@cisco.com>
Thu, 19 Nov 2015 14:27:31 +0000 (15:27 +0100)
committerIveta Halanova <ihalanov@cisco.com>
Wed, 25 Nov 2015 09:55:24 +0000 (10:55 +0100)
Inner area should be handled just in case of OSPF protocol.

Change-Id: I8468dfe0aeff6ed6c4ee7945f489b22bf8874075
Signed-off-by: Iveta Halanova <ihalanov@cisco.com>
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/attribute/sr/RangeTlvParser.java
bgp/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAttributeParserTest.java

index 5eb7699b54192b3351e8105f42c7e4d89c95b93b..42828961c54c75f82d20f74dfd2bff5aab5c5694 100644 (file)
@@ -47,7 +47,11 @@ public final class RangeTlvParser {
     public static SrRange parseSrRange(final ByteBuf buffer, final ProtocolId protocolId) {
         final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
         final SrRangeBuilder range = new SrRangeBuilder();
-        range.setInterArea(flags.get(INNER_AREA));
+        if (protocolId.equals(ProtocolId.Ospf)) {
+            range.setInterArea(flags.get(INNER_AREA));
+        } else {
+            range.setInterArea(Boolean.FALSE);
+        }
         buffer.skipBytes(RESERVED);
         range.setRangeSize(buffer.readUnsignedShort());
         range.setSubTlvs(parseRangeSubTlvs(buffer, protocolId));
index af062e14f9393bb5da6941df16098fc34a09304a..55dee23120313d00666f37e210543f671df834e4 100644 (file)
@@ -118,7 +118,7 @@ public class LinkstateAttributeParserTest {
         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,
         4, (byte)0x86, 0,8, (byte)0xf0, 0, 0,0, 1,2,3,4, // prefix-sid tlv
-        4, (byte)0x87, 0,0x0c, (byte)0x80, 0, 0, 5, 4, (byte)0x89, 0, 4, 1,2,3,4, // range tlv
+        4, (byte)0x87, 0,0x0c, 0, 0, 0, 5, 4, (byte)0x89, 0, 4, 1,2,3,4, // range tlv
         4, (byte)0x88, 0, 4, 1, (byte)0xf0, 0, 0 // binding sid tlv
         };
 
@@ -264,6 +264,7 @@ public class LinkstateAttributeParserTest {
         assertNotNull(ls);
 
         assertNotNull(ls.getSrRange());
+        assertFalse(ls.getSrRange().isInterArea());
         assertEquals(1, ls.getSrRange().getSubTlvs().size());
         assertNotNull(ls.getSrBindingSidLabel());
         assertTrue(ls.getIgpBits().getUpDown().isUpDown());