From e7eddcc352d6c8208d18d74e3db8fcf565e899d7 Mon Sep 17 00:00:00 2001 From: Dana Kutenicsova Date: Sun, 3 Nov 2013 12:36:00 +0100 Subject: [PATCH] BUG-50 : added test for XRO object. Change-Id: I0e54b24b5ebb1a24aa5905a26ce9a445fd4da570 Signed-off-by: Dana Kutenicsova --- .../protocol/pcep/impl/Activator.java | 16 +++--- .../AbstractXROWithSubobjectsParser.java | 48 ++++++++--------- .../object/PCEPExcludeRouteObjectParser.java | 27 +++++++--- .../impl/object/PCEPLspaObjectParser.java | 1 - ...ExplicitExclusionRouteSubobjectParser.java | 2 +- .../pcep/impl/PCEPObjectParserTest.java | 49 +++++++++++------- .../resources/PCEPExcludeRouteObject.1.bin | Bin 20 -> 16 bytes .../spi/PCEPExtensionProviderContext.java | 3 +- .../pcep/spi/XROSubobjectHandlerRegistry.java | 5 +- .../OSGiPCEPExtensionProviderContext.java | 3 +- .../PCEPExtensionProviderContextImpl.java | 3 +- .../SimpleXROSubobjectHandlerRegistry.java | 7 ++- 12 files changed, 96 insertions(+), 68 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 8a251138dd..8fffe1f536 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 @@ -112,6 +112,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.RpObject; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SrpObject; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.SvecObject; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.subobjects.subobject.type.PathKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersion; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.error.code.tlv.LspErrorCode; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.LspIdentifiers; @@ -127,8 +128,11 @@ 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.rsvp.rev130820.AsNumberSubobject; 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.SrlgSubobject; 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.Srlg; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.subobject.type.Unnumbered; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.GeneralizedLabel; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.Type1Label; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.WavebandSwitchingLabel; @@ -192,11 +196,11 @@ public final class Activator implements PCEPExtensionProviderActivator { context.registerXROSubobjectParser(XROPathKeySubobjectParser.TYPE, new XROPathKeySubobjectParser()); context.registerXROSubobjectParser(XROPathKeySubobjectParser.TYPE128, new XROPathKeySubobjectParser()); - context.registerXROSubobjectSerializer(IpPrefixSubobject.class, new XROIpPrefixSubobjectParser()); - context.registerXROSubobjectSerializer(AsNumberSubobject.class, new XROAsNumberSubobjectParser()); - context.registerXROSubobjectSerializer(SrlgSubobject.class, new XROSRLGSubobjectParser()); - context.registerXROSubobjectSerializer(UnnumberedSubobject.class, new XROUnnumberedInterfaceSubobjectParser()); - context.registerXROSubobjectSerializer(PathKeySubobject.class, new XROPathKeySubobjectParser()); + context.registerXROSubobjectSerializer(IpPrefix.class, new XROIpPrefixSubobjectParser()); + context.registerXROSubobjectSerializer(AsNumber.class, new XROAsNumberSubobjectParser()); + context.registerXROSubobjectSerializer(Srlg.class, new XROSRLGSubobjectParser()); + context.registerXROSubobjectSerializer(Unnumbered.class, new XROUnnumberedInterfaceSubobjectParser()); + context.registerXROSubobjectSerializer(PathKey.class, new XROPathKeySubobjectParser()); final TlvHandlerRegistry tlvReg = context.getTlvHandlerRegistry(); context.registerTlvParser(NoPathVectorTlvParser.TYPE, new NoPathVectorTlvParser()); diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractXROWithSubobjectsParser.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractXROWithSubobjectsParser.java index bc63d3f620..208d47426f 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractXROWithSubobjectsParser.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/AbstractXROWithSubobjectsParser.java @@ -21,20 +21,19 @@ import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; +import com.google.common.primitives.UnsignedBytes; public abstract class AbstractXROWithSubobjectsParser implements ObjectParser, ObjectSerializer { - private static final Logger logger = LoggerFactory.getLogger(AbstractXROWithSubobjectsParser.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractXROWithSubobjectsParser.class); private static final int SUB_TYPE_FLAG_F_LENGTH = 1; 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 XROSubobjectHandlerRegistry subobjReg; @@ -46,9 +45,7 @@ public abstract class AbstractXROWithSubobjectsParser implements ObjectParser, O if (bytes == null) { throw new IllegalArgumentException("Byte array is mandatory."); } - int type; - byte[] soContentsBytes; int length; int offset = 0; @@ -57,26 +54,28 @@ public abstract class AbstractXROWithSubobjectsParser implements ObjectParser, O while (offset < bytes.length) { - length = ByteArray.bytesToInt(ByteArray.subByte(bytes, offset + LENGTH_F_OFFSET, SUB_LENGTH_F_LENGTH)); + final boolean mandatory = ((bytes[offset] & (1 << 7)) != 0) ? true : false; + type = UnsignedBytes.checkedCast((bytes[offset] & 0xff) & ~(1 << 7)); - final boolean mandatory = ((bytes[offset + TYPE_FLAG_F_OFFSET] & (1 << 7)) != 0) ? true : false; - type = (bytes[offset + TYPE_FLAG_F_OFFSET] & 0xff) & ~(1 << 7); + offset += SUB_TYPE_FLAG_F_LENGTH; - if (length > bytes.length - offset) { + length = UnsignedBytes.toInt(bytes[offset]); + + offset += SUB_LENGTH_F_LENGTH; + + if (length - SUB_HEADER_LENGTH > bytes.length - offset) { throw new PCEPDeserializerException("Wrong length specified. Passed: " + length + "; Expected: <= " + (bytes.length - offset)); } + soContentsBytes = ByteArray.subByte(bytes, offset, length - SO_CONTENTS_OFFSET); - soContentsBytes = new byte[length - SO_CONTENTS_OFFSET]; - System.arraycopy(bytes, offset + SO_CONTENTS_OFFSET, soContentsBytes, 0, length - SO_CONTENTS_OFFSET); - - logger.debug("Attempt to parse subobject from bytes: {}", ByteArray.bytesToHexString(soContentsBytes)); + LOG.debug("Attempt to parse subobject from bytes: {}", ByteArray.bytesToHexString(soContentsBytes)); final Subobjects sub = this.subobjReg.getSubobjectParser(type).parseSubobject(soContentsBytes, mandatory); - logger.debug("Subobject was parsed. {}", sub); + LOG.debug("Subobject was parsed. {}", sub); subs.add(sub); - offset += length; + offset += soContentsBytes.length; } return subs; } @@ -89,19 +88,20 @@ public abstract class AbstractXROWithSubobjectsParser implements ObjectParser, O for (final Subobjects subobject : subobjects) { - final XROSubobjectSerializer serializer = this.subobjReg.getSubobjectSerializer(subobject); + final XROSubobjectSerializer serializer = this.subobjReg.getSubobjectSerializer(subobject.getSubobjectType()); + + final byte typeBytes = (byte) (ByteArray.cutBytes(ByteArray.intToBytes(serializer.getType()), (Integer.SIZE / 8) - 1)[0] | (subobject.isMandatory() ? 1 << 7 + : 0)); final byte[] valueBytes = serializer.serializeSubobject(subobject); - final byte[] bytes = new byte[SUB_HEADER_LENGTH + valueBytes.length]; + final byte lengthBytes = UnsignedBytes.checkedCast(valueBytes.length + SUB_HEADER_LENGTH); - final byte typeBytes = (byte) (ByteArray.cutBytes(ByteArray.intToBytes(serializer.getType()), (Integer.SIZE / 8) - 1)[0] | (subobject.isMandatory() ? 1 << 7 - : 0)); - final byte lengthBytes = ByteArray.cutBytes(ByteArray.intToBytes(valueBytes.length), (Integer.SIZE / 8) - 1)[0]; + final byte[] bytes = new byte[valueBytes.length + SUB_HEADER_LENGTH]; bytes[0] = typeBytes; bytes[1] = lengthBytes; - System.arraycopy(valueBytes, 0, bytes, SUB_HEADER_LENGTH, valueBytes.length); + ByteArray.copyWhole(valueBytes, bytes, SUB_HEADER_LENGTH); finalLength += bytes.length; result.add(bytes); diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPExcludeRouteObjectParser.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPExcludeRouteObjectParser.java index b911a88043..f357a9e90a 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPExcludeRouteObjectParser.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPExcludeRouteObjectParser.java @@ -10,20 +10,26 @@ package org.opendaylight.protocol.pcep.impl.object; import org.opendaylight.protocol.pcep.PCEPDeserializerException; import org.opendaylight.protocol.pcep.PCEPDocumentedException; import org.opendaylight.protocol.pcep.spi.XROSubobjectHandlerRegistry; +import org.opendaylight.protocol.util.ByteArray; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ExcludeRouteObject; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ExcludeRouteObject.Flags; 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.ObjectHeader; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.svec.XroBuilder; +import com.google.common.primitives.UnsignedBytes; + /** * Parser for {@link ExcludeRouteObject} */ public final class PCEPExcludeRouteObjectParser extends AbstractXROWithSubobjectsParser { - public static final int CLASS = 7; // FIXME: to actual value + public static final int CLASS = 7; public static final int TYPE = 1; + private static final int FLAGS_OFFSET = 3; + public PCEPExcludeRouteObjectParser(final XROSubobjectHandlerRegistry registry) { super(registry); } @@ -31,24 +37,31 @@ public final class PCEPExcludeRouteObjectParser extends AbstractXROWithSubobject @Override public ExcludeRouteObject parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException, PCEPDocumentedException { - if (bytes == null || bytes.length == 0) + if (bytes == null || bytes.length == 0) { throw new IllegalArgumentException("Byte array is mandatory. Can't be null or empty."); - + } final XroBuilder builder = new XroBuilder(); - builder.setIgnore(header.isIgnore()); builder.setProcessingRule(header.isProcessingRule()); - builder.setSubobjects(parseSubobjects(bytes)); + builder.setFlags(new Flags(UnsignedBytes.toInt(bytes[FLAGS_OFFSET]) != 0)); + builder.setSubobjects(parseSubobjects(ByteArray.cutBytes(bytes, FLAGS_OFFSET + 1))); return builder.build(); } @Override public byte[] serializeObject(final Object object) { - if (!(object instanceof ExcludeRouteObject)) + if (!(object instanceof ExcludeRouteObject)) { throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed ExcludeRouteObject."); + } final ExcludeRouteObject obj = (ExcludeRouteObject) object; assert !(obj.getSubobjects().isEmpty()) : "Empty Excluded Route Object."; - return serializeSubobject(obj.getSubobjects()); + final byte[] bytes = serializeSubobject(obj.getSubobjects()); + final byte[] result = new byte[FLAGS_OFFSET + 1 + bytes.length]; + if (obj.getFlags().isFail()) { + result[FLAGS_OFFSET] = 1; + } + ByteArray.copyWhole(bytes, result, FLAGS_OFFSET + 1); + return result; } @Override diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPLspaObjectParser.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPLspaObjectParser.java index f2e96c03c4..881d5fc19d 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPLspaObjectParser.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPLspaObjectParser.java @@ -44,7 +44,6 @@ public class PCEPLspaObjectParser extends AbstractObjectWithTlvsParser - // * Used resources:
- // * - PCEPExcludeRouteObject.1.bin
- // * - // * @throws IOException - // * @throws PCEPDeserializerException - // * @throws PCEPDocumentedException - // */ - // @Test - // public void testExcludeRouteObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException { - // final List xroSubobjects = new ArrayList(); - // xroSubobjects.add(new XROIPPrefixSubobject(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 192, - // (byte) 168, - // (byte) 100, (byte) 100 }), 16), true, XROSubobjectAttribute.NODE)); - // xroSubobjects.add(new XROAsNumberSubobject(new AsNumber(0x1234L), false)); - // - // } - // + @Test + public void testExcludeRouteObject() throws Exception { + final PCEPExcludeRouteObjectParser parser = new PCEPExcludeRouteObjectParser(PCEPExtensionProviderContextImpl.create().getXROSubobjectHandlerRegistry()); + final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPExcludeRouteObject.1.bin"); + + final XroBuilder builder = new XroBuilder(); + builder.setProcessingRule(false); + builder.setIgnore(false); + builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ExcludeRouteObject.Flags(true)); + final List subs = Lists.newArrayList(); + subs.add(new SubobjectsBuilder().setMandatory(true).setSubobjectType( + new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("192.168.0.0/16"))).build()).setAttribute(Attribute.Node).build()); + subs.add(new SubobjectsBuilder().setMandatory(false).setSubobjectType( + new AsNumberBuilder().setAsNumber(new AsNumber(0x1234L)).build()).build()); + builder.setSubobjects(subs); + + assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result)); + assertArrayEquals(result, parser.serializeObject(builder.build())); + } @Test public void testSrpObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException { diff --git a/pcep/impl/src/test/resources/PCEPExcludeRouteObject.1.bin b/pcep/impl/src/test/resources/PCEPExcludeRouteObject.1.bin index a2c2bc9aa08c282a2b19191f3ede47d72ce8d4b2..994e2b6ad981e69abc5e058e49fac747dd2d1a26 100644 GIT binary patch literal 16 XcmZQzU|?+IIIx0&L4Z+#MaTpI6*2;D literal 20 bcmWd>Vh~|qU|?+IIIx0&L4Z+#MaTpI88iZ= diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionProviderContext.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionProviderContext.java index f2b5388535..84e219d3ad 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionProviderContext.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionProviderContext.java @@ -11,6 +11,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.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; public interface PCEPExtensionProviderContext extends PCEPExtensionConsumerContext { @@ -38,7 +39,7 @@ public interface PCEPExtensionProviderContext extends PCEPExtensionConsumerConte public AutoCloseable registerTlvParser(int tlvType, TlvParser parser); - public AutoCloseable registerXROSubobjectSerializer(Class subobjectClass, XROSubobjectSerializer serializer); + public AutoCloseable registerXROSubobjectSerializer(Class subobjectClass, XROSubobjectSerializer serializer); public AutoCloseable registerXROSubobjectParser(int subobjectType, XROSubobjectParser parser); } diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectHandlerRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectHandlerRegistry.java index 2e46370774..3ad96724de 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectHandlerRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectHandlerRegistry.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.exclude.route.object.Subobjects; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.basic.explicit.route.subobjects.SubobjectType; public interface XROSubobjectHandlerRegistry { public XROSubobjectParser getSubobjectParser(int subobjectType); - public XROSubobjectSerializer getSubobjectSerializer(Subobjects subobject); + + public XROSubobjectSerializer 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 682c7117a8..dff12f9a3f 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 @@ -26,6 +26,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.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; @@ -109,7 +110,7 @@ class OSGiPCEPExtensionProviderContext extends OSGiPCEPExtensionConsumerContext } @Override - public AutoCloseable registerXROSubobjectSerializer(final Class subobjectClass, + public AutoCloseable registerXROSubobjectSerializer(final Class subobjectClass, final XROSubobjectSerializer 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 ab2910d686..b697116975 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 @@ -38,6 +38,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.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; /** @@ -188,7 +189,7 @@ public final class PCEPExtensionProviderContextImpl implements PCEPExtensionProv } @Override - public AutoCloseable registerXROSubobjectSerializer(final Class subobjectClass, + public AutoCloseable registerXROSubobjectSerializer(final Class subobjectClass, final XROSubobjectSerializer serializer) { return this.xroSubReg.registerSubobjectSerializer(subobjectClass, serializer); } diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectHandlerRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectHandlerRegistry.java index 030adfcb64..7f6781dd17 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectHandlerRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectHandlerRegistry.java @@ -12,8 +12,7 @@ import org.opendaylight.protocol.pcep.spi.XROSubobjectHandlerRegistry; import org.opendaylight.protocol.pcep.spi.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer; import org.opendaylight.protocol.util.Util; -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.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.yangtools.yang.binding.DataContainer; import com.google.common.base.Preconditions; @@ -26,7 +25,7 @@ public final class SimpleXROSubobjectHandlerRegistry implements XROSubobjectHand return this.handlers.registerParser(subobjectType, parser); } - public AutoCloseable registerSubobjectSerializer(final Class subobjectClass, + public AutoCloseable registerSubobjectSerializer(final Class subobjectClass, final XROSubobjectSerializer serializer) { return this.handlers.registerSerializer(subobjectClass, serializer); } @@ -38,7 +37,7 @@ public final class SimpleXROSubobjectHandlerRegistry implements XROSubobjectHand } @Override - public XROSubobjectSerializer getSubobjectSerializer(final Subobjects subobject) { + public XROSubobjectSerializer getSubobjectSerializer(final SubobjectType subobject) { return this.handlers.getSerializer(subobject.getImplementedInterface()); } } -- 2.36.6