BUG-50 : added tests for IRO and RRO subobjects. 40/2340/1
authorDana Kutenicsova <dkutenic@cisco.com>
Sun, 3 Nov 2013 19:04:19 +0000 (20:04 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Sun, 3 Nov 2013 19:04:19 +0000 (20:04 +0100)
Change-Id: I6865fad3427daea4a49580d32ec01defd27391dc
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractRROWithSubobjectsParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROIpPrefixSubobjectParser.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java
pcep/impl/src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin
pcep/impl/src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionProviderContext.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectHandlerRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/osgi/OSGiPCEPExtensionProviderContext.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectHandlerRegistry.java

index decb257e1b9aeaeb5ef6fef4af1c0bd437a1b1c9..9032c94e7c5eef8146ee923e9c9afee927a7e76f 100644 (file)
@@ -99,7 +99,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.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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcerrMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcinitiateMessage;
@@ -125,9 +124,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.rsvp.error.spec.tlv.RsvpErrorSpec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.stateful.capability.tlv.Stateful;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.symbolic.path.name.tlv.SymbolicPathName;
-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;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.UnnumberedSubobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.subobject.type.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.subobject.type.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.subobject.type.Label;
@@ -184,10 +180,18 @@ public final class Activator implements PCEPExtensionProviderActivator {
                context.registerRROSubobjectParser(RROPathKeySubobjectParser.TYPE, new RROPathKeySubobjectParser());
                context.registerRROSubobjectParser(RROPathKeySubobjectParser.TYPE128, new RROPathKeySubobjectParser());
 
-               context.registerRROSubobjectSerializer(IpPrefixSubobject.class, new RROIpPrefixSubobjectParser());
-               context.registerRROSubobjectSerializer(LabelSubobject.class, new RROLabelSubobjectParser(labelReg));
-               context.registerRROSubobjectSerializer(UnnumberedSubobject.class, new RROUnnumberedInterfaceSubobjectParser());
-               context.registerRROSubobjectSerializer(PathKeySubobject.class, new RROPathKeySubobjectParser());
+               context.registerRROSubobjectSerializer(
+                               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.subobject.type.IpPrefix.class,
+                               new RROIpPrefixSubobjectParser());
+               context.registerRROSubobjectSerializer(
+                               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.subobject.type.Label.class,
+                               new RROLabelSubobjectParser(labelReg));
+               context.registerRROSubobjectSerializer(
+                               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.subobject.type.Unnumbered.class,
+                               new RROUnnumberedInterfaceSubobjectParser());
+               context.registerRROSubobjectSerializer(
+                               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.subobjects.subobject.type.PathKey.class,
+                               new RROPathKeySubobjectParser());
 
                final XROSubobjectHandlerRegistry xroSubReg = context.getXROSubobjectHandlerRegistry();
                context.registerXROSubobjectParser(XROIpPrefixSubobjectParser.TYPE, new XROIpPrefixSubobjectParser());
index 49fbf188d5639f96a766296772e6d465e70a27da..788d7b11ad2f63ee44355e135789c42d389cda46 100644 (file)
@@ -30,11 +30,9 @@ public abstract class AbstractRROWithSubobjectsParser implements ObjectParser, O
        private static final int SUB_LENGTH_F_LENGTH = 1;
        private static final int SUB_HEADER_LENGTH = SUB_TYPE_FLAG_F_LENGTH + SUB_LENGTH_F_LENGTH;
 
-       public static final int TYPE_FLAG_F_OFFSET = 0;
-       public static final int LENGTH_F_OFFSET = TYPE_FLAG_F_OFFSET + SUB_TYPE_FLAG_F_LENGTH;
-       public static final int SO_CONTENTS_OFFSET = LENGTH_F_OFFSET + SUB_LENGTH_F_LENGTH;
-
-       protected static final int PADDED_TO = 4;
+       private static final int TYPE_FLAG_F_OFFSET = 0;
+       private static final int LENGTH_F_OFFSET = TYPE_FLAG_F_OFFSET + SUB_TYPE_FLAG_F_LENGTH;
+       private static final int SO_CONTENTS_OFFSET = LENGTH_F_OFFSET + SUB_LENGTH_F_LENGTH;
 
        private final RROSubobjectHandlerRegistry subobjReg;
 
@@ -88,7 +86,7 @@ public abstract class AbstractRROWithSubobjectsParser implements ObjectParser, O
 
                for (final Subobjects subobject : subobjects) {
 
-                       final RROSubobjectSerializer serializer = this.subobjReg.getSubobjectSerializer(subobject);
+                       final RROSubobjectSerializer serializer = this.subobjReg.getSubobjectSerializer(subobject.getSubobjectType());
 
                        final byte[] valueBytes = serializer.serializeSubobject(subobject);
 
index 8a70dec5c40d0d55488d2174fa7342368a621bf4..e49a57b24064ef10c3a1733b0370997345f57664 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+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.reported.route.object.Subobjects;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.SubobjectsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.IpPrefixSubobject;
@@ -25,7 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import com.google.common.primitives.UnsignedBytes;
 
 /**
- * Parser for {@link org.opendaylight.protocol.pcep.subobject.RROIPAddressSubobject RROIPAddressSubobject<IPv4Prefix>}
+ * Parser for {@link ReportedRouteObject}
  */
 public class RROIpPrefixSubobjectParser implements RROSubobjectParser, RROSubobjectSerializer {
 
index 2a8b63a7c90a8653f965b6d78f3f181ab15140bf..4c1b66750bce0cd43aac2a276281e7a8b1bc77e2 100644 (file)
@@ -14,7 +14,6 @@ import java.io.IOException;
 import java.math.BigInteger;
 import java.util.List;
 
-import org.apache.commons.codec.binary.Hex;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.concepts.Ipv4Util;
@@ -29,6 +28,7 @@ import org.opendaylight.protocol.pcep.impl.object.PCEPErrorObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPExcludeRouteObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPExplicitRouteObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPGlobalConstraintsObjectParser;
+import org.opendaylight.protocol.pcep.impl.object.PCEPIncludeRouteObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPLoadBalancingObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPLspObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPLspaObjectParser;
@@ -37,6 +37,7 @@ import org.opendaylight.protocol.pcep.impl.object.PCEPNoPathObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPNotificationObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPObjectiveFunctionObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPOpenObjectParser;
+import org.opendaylight.protocol.pcep.impl.object.PCEPReportedRouteObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPRequestParameterObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPSrpObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPSvecObjectParser;
@@ -53,6 +54,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.OperationalStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PlspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion;
+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.RequestId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpIdNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.message.c.close.message.CCloseBuilder;
@@ -61,6 +63,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.exclude.route.object.Subobjects;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.SubobjectsBuilder;
 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.IncludeRouteBuilder;
 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.lsp.db.version.tlv.LspDbVersion;
@@ -82,6 +85,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.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.RpBuilder;
 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.ReportedRouteBuilder;
 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;
@@ -192,7 +196,7 @@ public class PCEPObjectParserTest {
        }
 
        @Test
-       public void testEROObject() throws Exception {
+       public void testERObject() throws Exception {
                final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(PCEPExtensionProviderContextImpl.create().getEROSubobjectHandlerRegistry());
                final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPExplicitRouteObject1PackOfSubobjects.bin");
 
@@ -209,39 +213,63 @@ public class PCEPObjectParserTest {
                builder.setSubobjects(subs);
 
                assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result));
-               System.out.println(new String(Hex.encodeHex(parser.serializeObject(builder.build()))));
                assertArrayEquals(result, parser.serializeObject(builder.build()));
        }
 
-       //
-       // @Test
-       // public void testIRObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
-       // final byte[] bytesFromFile =
-       // ByteArray.fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin");
-       //
-       // final PCEPIncludeRouteObject specObj = (PCEPIncludeRouteObject)
-       // PCEPObjectFactory.parseObjects(bytesFromFile).get(0);
-       //
-       // assertEquals(8, specObj.getSubobjects().size());
-       //
-       // final byte[] bytesActual = PCEPObjectFactory.put(Arrays.asList((PCEPObject) specObj));
-       // assertArrayEquals(bytesFromFile, bytesActual);
-       // }
-       //
-       // @Test
-       // public void tesRRObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
-       // final byte[] bytesFromFile =
-       // ByteArray.fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin");
-       //
-       // final PCEPReportedRouteObject specObj = (PCEPReportedRouteObject)
-       // PCEPObjectFactory.parseObjects(bytesFromFile).get(0);
-       //
-       // assertEquals(6, specObj.getSubobjects().size());
-       //
-       // final byte[] bytesActual = PCEPObjectFactory.put(Arrays.asList((PCEPObject) specObj));
-       // assertArrayEquals(bytesFromFile, bytesActual);
-       // }
-       //
+       @Test
+       public void testIRObject() throws Exception {
+               final PCEPIncludeRouteObjectParser parser = new PCEPIncludeRouteObjectParser(PCEPExtensionProviderContextImpl.create().getEROSubobjectHandlerRegistry());
+               final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin");
+               final byte[] ip6PrefixBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+                               (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+
+               final IncludeRouteBuilder builder = new IncludeRouteBuilder();
+               builder.setProcessingRule(false);
+               builder.setIgnore(false);
+               final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.Subobjects> subs = Lists.newArrayList();
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.SubobjectsBuilder().setSubobjectType(
+                               new AsNumberBuilder().setAsNumber(new AsNumber(0x10L)).build()).build());
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.SubobjectsBuilder().setSubobjectType(
+                               new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("18.52.80.0/21"))).build()).build());
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.SubobjectsBuilder().setSubobjectType(
+                               new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv6Util.prefixForBytes(ip6PrefixBytes, 22))).build()).build());
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.SubobjectsBuilder().setSubobjectType(
+                               new UnnumberedBuilder().setRouterId(0x1245678L).setInterfaceId(0x9abcdef0L).build()).build());
+               builder.setSubobjects(subs);
+
+               assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result));
+               // FIXME: fix Ipv6Serializers (getType)
+               // assertArrayEquals(result, parser.serializeObject(builder.build()));
+       }
+
+       @Test
+       public void testRRObject() throws Exception {
+               final PCEPReportedRouteObjectParser parser = new PCEPReportedRouteObjectParser(PCEPExtensionProviderContextImpl.create().getRROSubobjectHandlerRegistry());
+               final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin");
+               final byte[] ip6PrefixBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+                               (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+
+               final ReportedRouteBuilder builder = new ReportedRouteBuilder();
+               builder.setProcessingRule(false);
+               builder.setIgnore(false);
+               final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.Subobjects> subs = Lists.newArrayList();
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.SubobjectsBuilder().setSubobjectType(
+                               new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.subobject.type.IpPrefixBuilder().setIpPrefix(
+                                               new IpPrefix(new Ipv4Prefix("255.255.255.255/32"))).build()).setProtectionAvailable(false).setProtectionInUse(false).build());
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.SubobjectsBuilder().setSubobjectType(
+                               new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.subobject.type.IpPrefixBuilder().setIpPrefix(
+                                               new IpPrefix(Ipv6Util.prefixForBytes(ip6PrefixBytes, 22))).build()).setProtectionAvailable(false).setProtectionInUse(
+                               false).build());
+               subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.SubobjectsBuilder().setSubobjectType(
+                               new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.subobject.type.UnnumberedBuilder().setRouterId(
+                                               0x1245678L).setInterfaceId(0x9abcdef0L).build()).setProtectionAvailable(false).setProtectionInUse(false).build());
+               builder.setSubobjects(subs);
+
+               final ReportedRouteObject t = parser.parseObject(new ObjectHeaderImpl(false, false), result);
+               assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result));
+               // FIXME: fix Ipv6Serializers (getType)
+               // assertArrayEquals(result, parser.serializeObject(builder.build()));
+       }
 
        @Test
        public void testBandwidthObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
index 575c129ac1d9686d564c0317973f37835c97d063..d8bcbfae9ef14b8a30a59ef68be6a551e6c3e05c 100644 (file)
Binary files a/pcep/impl/src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin and b/pcep/impl/src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin differ
index 90a45bc98b11e69a68e3f2c84d68319a04bd1885..fcd275ea45d0d0f1c339cb43c5320a4ea4cfadde 100644 (file)
Binary files a/pcep/impl/src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin and b/pcep/impl/src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin differ
index 0abe69011c1db73b0f39ec43971e31d435f545dc..9e78e5115ac152a85475a14053d6bc322a7f5067 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.pcep.spi;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
 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.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.CSubobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.SubobjectType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
 
@@ -33,7 +32,9 @@ public interface PCEPExtensionProviderContext extends PCEPExtensionConsumerConte
 
        public AutoCloseable registerRROSubobjectParser(int subobjectType, RROSubobjectParser parser);
 
-       public AutoCloseable registerRROSubobjectSerializer(Class<? extends CSubobject> subobjectClass, RROSubobjectSerializer serializer);
+       public AutoCloseable registerRROSubobjectSerializer(
+                       Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.SubobjectType> subobjectClass,
+                       RROSubobjectSerializer serializer);
 
        public AutoCloseable registerTlvSerializer(Class<? extends Tlv> tlvClass, TlvSerializer serializer);
 
index 53602058d6fff2a7518207fcae55e7e3fece5784..28fa344c0c9fee18e2dd4f7191be8273a5e160cc 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.protocol.pcep.spi;
 
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.Subobjects;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.SubobjectType;
 
 public interface RROSubobjectHandlerRegistry {
        public RROSubobjectParser getSubobjectParser(int subobjectType);
-       public RROSubobjectSerializer getSubobjectSerializer(Subobjects subobject);
+
+       public RROSubobjectSerializer getSubobjectSerializer(SubobjectType subobject);
 }
index 5d7a73faf2ad9d3aaefb6d7cdae126730e5b1ad2..ea09c496723452e0eda1ffd5dac7e59c0ded3b90 100644 (file)
@@ -25,7 +25,6 @@ import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
 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.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.CSubobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.SubobjectType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
 import org.osgi.framework.BundleContext;
@@ -91,7 +90,8 @@ class OSGiPCEPExtensionProviderContext extends OSGiPCEPExtensionConsumerContext
        }
 
        @Override
-       public AutoCloseable registerRROSubobjectSerializer(final Class<? extends CSubobject> subobjectClass,
+       public AutoCloseable registerRROSubobjectSerializer(
+                       final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.SubobjectType> subobjectClass,
                        final RROSubobjectSerializer serializer) {
                // TODO Auto-generated method stub
                return null;
index 710865c9fca254010b7b3af43b443905b7692da2..6aa4b87f21b491b22920beb3d9f47ebfa80dfdd4 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
 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.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.CSubobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.SubobjectType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
 
@@ -168,7 +167,8 @@ public final class PCEPExtensionProviderContextImpl implements PCEPExtensionProv
        }
 
        @Override
-       public AutoCloseable registerRROSubobjectSerializer(final Class<? extends CSubobject> subobjectClass,
+       public AutoCloseable registerRROSubobjectSerializer(
+                       final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.SubobjectType> subobjectClass,
                        final RROSubobjectSerializer serializer) {
                return this.rroSubReg.registerSubobjectSerializer(subobjectClass, serializer);
        }
index e96788e87de5b69cfdaaeda20f42c32e4b8a9aff..5412c89941f2c9263a6bf8fce2914dbd2d8931ed 100644 (file)
@@ -12,8 +12,7 @@ import org.opendaylight.protocol.pcep.spi.RROSubobjectHandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
 import org.opendaylight.protocol.util.Util;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.Subobjects;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.CSubobject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.SubobjectType;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 import com.google.common.base.Preconditions;
@@ -32,13 +31,13 @@ public final class SimpleRROSubobjectHandlerRegistry implements RROSubobjectHand
                return this.handlers.getParser(subobjectType);
        }
 
-       public AutoCloseable registerSubobjectSerializer(final Class<? extends CSubobject> subobjectClass,
+       public AutoCloseable registerSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
                        final RROSubobjectSerializer serializer) {
                return this.handlers.registerSerializer(subobjectClass, serializer);
        }
 
        @Override
-       public RROSubobjectSerializer getSubobjectSerializer(final Subobjects subobject) {
+       public RROSubobjectSerializer getSubobjectSerializer(final SubobjectType subobject) {
                return this.handlers.getSerializer(subobject.getImplementedInterface());
        }
 }