Update to RFC 8664 (PCEP Segment Routing)
[bgpcep.git] / pcep / segment-routing / src / test / java / org / opendaylight / protocol / pcep / segment / routing / SrRroSubobjectParserTest.java
index 1d6a15c8c83ab50d0b5b8561cc6f7625c7f5d2e5..e2b8b9457f5455c69feb79bb30a0347c7f8fb730 100644 (file)
@@ -20,24 +20,24 @@ import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpAdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacencyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class SrRroSubobjectParserTest {
 
     private static final byte[] SR_RRO_SUBOBJECT_WITH_IPV4_NODEID  = {
-        0x06,0x0c,(byte) 0x10,0x00,
+        0x24,0x0c,(byte) 0x10,0x00,
         0x00,0x01,(byte) 0xe2,0x40,
         0x4A,0x7D,0x2b,0x63,
     };
 
     private static final byte[] SR_RROR_SUBOBJECT_WITH_IPV6_NODEID  = {
-        0x06,0x18,(byte) 0x20,0x00,
+        0x24,0x18,(byte) 0x20,0x00,
         0x00,0x01,(byte) 0xe2,0x40,
         (byte) 0xFE,(byte) 0x80,(byte) 0xCD,0x00,
         0x00,0x00,0x00,0x00,
@@ -46,14 +46,14 @@ public class SrRroSubobjectParserTest {
     };
 
     private static final byte[] SR_RRO_SUBOBJECT_WITH_IPV4_ADJ  = {
-        0x06,0x10,(byte) 0x30,0x00,
+        0x24,0x10,(byte) 0x30,0x00,
         0x00,0x01,(byte) 0xe2,0x40,
         0x4A,0x7D,0x2b,0x63,
         0x4A,0x7D,0x2b,0x64,
     };
 
     private static final byte[] SR_RRO_SUBOBJECT_WITH_IPV6_ADJ  = {
-        0x06,0x28,(byte) 0x40,0x00,
+        0x24,0x28,(byte) 0x40,0x00,
         0x00,0x01,(byte) 0xe2,0x40,
         (byte) 0xFE,(byte) 0x80,(byte) 0xCD,0x00,
         0x00,0x00,0x00,0x00,
@@ -66,7 +66,7 @@ public class SrRroSubobjectParserTest {
     };
 
     private static final byte[] SR_RRO_SUBOBJECT_WIT_UNNUMBERED  = {
-        0x06,0x18,(byte) 0x50,0x00,
+        0x24,0x18,(byte) 0x50,0x00,
         0x00,0x01,(byte) 0xe2,0x40,
         0x00,0x00,0x00,0x01,
         0x00,0x00,0x00,0x02,
@@ -75,18 +75,17 @@ public class SrRroSubobjectParserTest {
     };
 
     private static final byte[] SR_RRO_SUBOBJECT_WITHOUT_NAI  = {
-        0x06,0x08, (byte) 0x10,0xb,
+        0x24,0x08, (byte) 0x10,0xb,
         0x1e,0x24,(byte)-32, 0x00,
     };
 
     private static final byte[] SR_RRO_SUBOBJECT_WITHOUT_SID  = {
-        0x06,0x08,(byte) 0x10,0x04,
+        0x24,0x08,(byte) 0x10,0x04,
         0x4A,0x7D,0x2b,0x63,
     };
 
     private SimplePCEPExtensionProviderContext ctx;
     private SegmentRoutingActivator act;
-    private boolean isIanaAssignedType;
     private SrRroSubobjectParser parser;
 
     @Before
@@ -94,14 +93,13 @@ public class SrRroSubobjectParserTest {
         this.ctx = new SimplePCEPExtensionProviderContext();
         this.act = new SegmentRoutingActivator();
         this.act.start(this.ctx);
-        this.isIanaAssignedType = false;
-        this.parser = new SrRroSubobjectParser(this.isIanaAssignedType);
+        this.parser = new SrRroSubobjectParser();
     }
 
     @Test
     public void testSrRroSubobjectIpv4NodeIdNAI() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Ipv4NodeId)
+                .setNaiType(NaiType.Ipv4NodeId)
                 .setSid(Uint32.valueOf(123456))
                 .setCFlag(false)
                 .setMFlag(false)
@@ -119,7 +117,7 @@ public class SrRroSubobjectParserTest {
     @Test
     public void testSrRroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Ipv6NodeId)
+                .setNaiType(NaiType.Ipv6NodeId)
                 .setCFlag(false)
                 .setMFlag(false)
                 .setSid(Uint32.valueOf(123456))
@@ -137,7 +135,7 @@ public class SrRroSubobjectParserTest {
     @Test
     public void testSrRroSubobjectIpv4AdjacencyNAI() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Ipv4Adjacency)
+                .setNaiType(NaiType.Ipv4Adjacency)
                 .setSid(Uint32.valueOf(123456))
                 .setCFlag(false)
                 .setMFlag(false)
@@ -156,7 +154,7 @@ public class SrRroSubobjectParserTest {
     @Test
     public void testSrRroSubobjectIpv6AdjacencyNAI() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Ipv6Adjacency)
+                .setNaiType(NaiType.Ipv6Adjacency)
                 .setSid(Uint32.valueOf(123456))
                 .setCFlag(false)
                 .setMFlag(false)
@@ -175,7 +173,7 @@ public class SrRroSubobjectParserTest {
     @Test
     public void testSrRroSubobjectUnnumberedNAI() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Unnumbered)
+                .setNaiType(NaiType.Unnumbered)
                 .setSid(Uint32.valueOf(123456))
                 .setCFlag(false)
                 .setMFlag(false)
@@ -195,7 +193,7 @@ public class SrRroSubobjectParserTest {
     @Test
     public void testSrRroSubobjectWithoutNAI() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Ipv4NodeId)
+                .setNaiType(NaiType.Ipv4NodeId)
                 .setSid(Uint32.valueOf(123470))
                 .setCFlag(true)
                 .setMFlag(true);
@@ -211,7 +209,7 @@ public class SrRroSubobjectParserTest {
     @Test
     public void testSrRroSubobjectWithoutBody() throws PCEPDeserializerException {
         final SrRroTypeBuilder builder = new SrRroTypeBuilder()
-                .setSidType(SidType.Ipv4NodeId)
+                .setNaiType(NaiType.Ipv4NodeId)
                 .setCFlag(false)
                 .setMFlag(false)
                 .setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("74.125.43.99")))