From 3aa86c7ca61f65ed1ba4a3c05d49f527ab7dc141 Mon Sep 17 00:00:00 2001 From: Dana Kutenicsova Date: Sun, 3 Nov 2013 20:04:19 +0100 Subject: [PATCH] BUG-50 : added tests for IRO and RRO subobjects. Change-Id: I6865fad3427daea4a49580d32ec01defd27391dc Signed-off-by: Dana Kutenicsova --- .../protocol/pcep/impl/Activator.java | 20 ++-- .../AbstractRROWithSubobjectsParser.java | 10 +- .../subobject/RROIpPrefixSubobjectParser.java | 3 +- .../pcep/impl/PCEPObjectParserTest.java | 92 ++++++++++++------ ...CEPIncludeRouteObject1PackOfSubobjects.bin | Bin 92 -> 44 bytes ...EPReportedRouteObject1PackOfSubobjects.bin | Bin 84 -> 40 bytes .../spi/PCEPExtensionProviderContext.java | 5 +- .../pcep/spi/RROSubobjectHandlerRegistry.java | 5 +- .../OSGiPCEPExtensionProviderContext.java | 4 +- .../PCEPExtensionProviderContextImpl.java | 4 +- .../SimpleRROSubobjectHandlerRegistry.java | 7 +- 11 files changed, 91 insertions(+), 59 deletions(-) diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java index decb257e1b..9032c94e7c 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java @@ -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()); diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractRROWithSubobjectsParser.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractRROWithSubobjectsParser.java index 49fbf188d5..788d7b11ad 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractRROWithSubobjectsParser.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractRROWithSubobjectsParser.java @@ -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); diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROIpPrefixSubobjectParser.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROIpPrefixSubobjectParser.java index 8a70dec5c4..e49a57b240 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROIpPrefixSubobjectParser.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROIpPrefixSubobjectParser.java @@ -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} + * Parser for {@link ReportedRouteObject} */ public class RROIpPrefixSubobjectParser implements RROSubobjectParser, RROSubobjectSerializer { diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java index 2a8b63a7c9..4c1b66750b 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java @@ -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 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 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 { diff --git a/pcep/impl/src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin b/pcep/impl/src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin index 575c129ac1d9686d564c0317973f37835c97d063..d8bcbfae9ef14b8a30a59ef68be6a551e6c3e05c 100644 GIT binary patch delta 30 lcma#i;Z|T_5MbmGG6`T1ov1I$!@|SBz^D>dF>BAg4*)*%27~|r literal 92 zcmd-QWQbY7^8ddA3xhx-$A2JDU|{4BG6`T1WoQxs@sU9T1Cxl5NeBZn5MyZJVPJr% QVga%lRl+J}?YZ{>01$~MA^-pY diff --git a/pcep/impl/src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin b/pcep/impl/src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin index 90a45bc98b11e69a68e3f2c84d68319a04bd1885..fcd275ea45d0d0f1c339cb43c5320a4ea4cfadde 100644 GIT binary patch literal 40 jcmZSN_zwgM3`` subobjectClass, RROSubobjectSerializer serializer); + public AutoCloseable registerRROSubobjectSerializer( + Class subobjectClass, + RROSubobjectSerializer serializer); public AutoCloseable registerTlvSerializer(Class tlvClass, TlvSerializer serializer); diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectHandlerRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectHandlerRegistry.java index 53602058d6..28fa344c0c 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectHandlerRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectHandlerRegistry.java @@ -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); } diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/osgi/OSGiPCEPExtensionProviderContext.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/osgi/OSGiPCEPExtensionProviderContext.java index 5d7a73faf2..ea09c49672 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/osgi/OSGiPCEPExtensionProviderContext.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/osgi/OSGiPCEPExtensionProviderContext.java @@ -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 subobjectClass, + public AutoCloseable registerRROSubobjectSerializer( + final Class subobjectClass, final RROSubobjectSerializer serializer) { // TODO Auto-generated method stub return null; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java index 710865c9fc..6aa4b87f21 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java @@ -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 subobjectClass, + public AutoCloseable registerRROSubobjectSerializer( + final Class subobjectClass, final RROSubobjectSerializer serializer) { return this.rroSubReg.registerSubobjectSerializer(subobjectClass, serializer); } diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectHandlerRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectHandlerRegistry.java index e96788e87d..5412c89941 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectHandlerRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectHandlerRegistry.java @@ -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 subobjectClass, + public AutoCloseable registerSubobjectSerializer(final Class 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()); } } -- 2.36.6