Merge "Initial code drop of Netty.io integration"
authorDana Kutenicsova <dkutenic@cisco.com>
Fri, 21 Mar 2014 08:34:57 +0000 (08:34 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 21 Mar 2014 08:34:57 +0000 (08:34 +0000)
42 files changed:
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/crabbe/initiated00/PcinitiateMessageParser.java
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful02/Stateful02PCReplyMessageParser.java
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful02/Stateful02PCReportMessageParser.java
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful02/Stateful02PCRequestMessageParser.java
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful02/Stateful02PCUpdateRequestMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated00/CInitiated00PCInitiateMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07ErrorMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCReportMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCUpdateRequestMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/StatefulActivator.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPValidatorTest.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPCloseMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPErrorMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPKeepAliveMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPNotificationMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPOpenMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPReplyMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPRequestMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/EROLabelSubobjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/GeneralizedLabelParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROLabelSubobjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/Type1LabelParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/WavebandSwitchingLabelParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tlv/AbstractVendorSpecificTlvParser.java [moved from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractVendorSpecificTlvParser.java with 92% similarity]
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/LabelSubobjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPRROSubobjectParserTest.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelHandlerRegistry.java [deleted file]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelUtil.java [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectHandlerRegistry.java [deleted file]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionConsumerContext.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java [moved from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelHandlerRegistry.java with 66% similarity]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java [moved from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectHandlerRegistry.java with 66% similarity]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful02TopologySessionListener.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListener.java
tcp-md5/core/pom.xml
tcp-md5/jni/pom.xml

index cf2f58b47272c9232304be7b729afcf1d9446ffd..45184711fd1f000dc41ca836c81ef819464ff63e 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Pcinitiate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.PcinitiateBuilder;
@@ -37,7 +37,7 @@ import com.google.common.collect.Lists;
 public class PcinitiateMessageParser extends AbstractMessageParser {
        public static final int TYPE = 12;
 
-       public PcinitiateMessageParser(final ObjectHandlerRegistry registry) {
+       public PcinitiateMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 18ec0ffe40410e307cbd6384de2cfa0dbf4b3f94..a395f2d72a9e767894f9db92e5cc79b305c849f1 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.impl.message.PCEPReplyMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.Replies1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.Replies1Builder;
@@ -42,7 +42,7 @@ import com.google.common.collect.Lists;
  */
 public final class Stateful02PCReplyMessageParser extends PCEPReplyMessageParser {
 
-       public Stateful02PCReplyMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful02PCReplyMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index edcaedee210eab7558ae5484e00bfe432d8eac0b..993bed582292e1848e8670255424d2ae60c7c50c 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.Pcrpt;
@@ -42,7 +42,7 @@ public final class Stateful02PCReportMessageParser extends AbstractMessageParser
 
        public static final int TYPE = 10;
 
-       public Stateful02PCReportMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful02PCReportMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 92548d11ab2e0a9ca719e39c8296fa10c8fbeddf..fce72d3671d0259d3065aa39d2d532277cc52d22 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.impl.message.PCEPRequestMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.P2p1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.P2p1Builder;
@@ -47,7 +47,7 @@ import com.google.common.collect.Lists;
  */
 public final class Stateful02PCRequestMessageParser extends PCEPRequestMessageParser {
 
-       public Stateful02PCRequestMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful02PCRequestMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index fee0a0298e864d072dcce9c776c029b95eeafe8d..fb00c4f3741799039b40c259613a59b00e3f795c 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.Pcupd;
@@ -42,7 +42,7 @@ public final class Stateful02PCUpdateRequestMessageParser extends AbstractMessag
 
        public static final int TYPE = 11;
 
-       public Stateful02PCUpdateRequestMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful02PCUpdateRequestMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index e58e55a580443837bcb8e33dc1e71a95a281ab77..4a2ec855a1f72ed001149594da22b3d49c7d804e 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.Pcinitiate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.PcinitiateBuilder;
@@ -42,7 +42,7 @@ public final class CInitiated00PCInitiateMessageParser extends AbstractMessagePa
 
        public static final int TYPE = 12;
 
-       public CInitiated00PCInitiateMessageParser(final ObjectHandlerRegistry registry) {
+       public CInitiated00PCInitiateMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 16138de4f0b3c76a7831a8ab6686a658c2fd7130..83a42f17000f808b7f14e7afa1bb6a644a9181da 100644 (file)
@@ -13,7 +13,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.impl.message.PCEPErrorMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.protocol.pcep.spi.UnknownObject;
@@ -45,7 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
  */
 public final class Stateful07ErrorMessageParser extends PCEPErrorMessageParser {
 
-       public Stateful07ErrorMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful07ErrorMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 0972aad359cbfb3941c9495ff24eef9df3413f30..b00bc2a84f054ca44dae9ed174dd1dc8cde6e37c 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Pcrpt;
@@ -44,7 +44,7 @@ public final class Stateful07PCReportMessageParser extends AbstractMessageParser
 
        public static final int TYPE = 10;
 
-       public Stateful07PCReportMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful07PCReportMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index c35f844f4d7b23134a2791abcc8b7f1ddc9a40fc..5b9992721ef518db61a1fb8568d874773e00a077 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Pcupd;
@@ -43,7 +43,7 @@ public final class Stateful07PCUpdateRequestMessageParser extends AbstractMessag
 
        public static final int TYPE = 11;
 
-       public Stateful07PCUpdateRequestMessageParser(final ObjectHandlerRegistry registry) {
+       public Stateful07PCUpdateRequestMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 0125e462f9db915e916b8753997bbbae882cbf46..0733de79717e9ec25c255db5be1455dc82a53938 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.ietf.stateful07;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
 import org.opendaylight.protocol.pcep.spi.TlvRegistry;
 import org.opendaylight.protocol.pcep.spi.pojo.AbstractPCEPExtensionProviderActivator;
@@ -30,7 +30,7 @@ public final class StatefulActivator extends AbstractPCEPExtensionProviderActiva
        protected List<AutoCloseable> startImpl(final PCEPExtensionProviderContext context) {
                final List<AutoCloseable> regs = new ArrayList<>();
 
-               final ObjectHandlerRegistry objReg = context.getObjectHandlerRegistry();
+               final ObjectRegistry objReg = context.getObjectHandlerRegistry();
                regs.add(context.registerMessageParser(Stateful07PCUpdateRequestMessageParser.TYPE, new Stateful07PCUpdateRequestMessageParser(objReg)));
                regs.add(context.registerMessageSerializer(Pcupd.class, new Stateful07PCUpdateRequestMessageParser(objReg)));
                regs.add(context.registerMessageParser(Stateful07PCReportMessageParser.TYPE, new Stateful07PCReportMessageParser(objReg)));
index 61ea60a9221244a6699e9c9d9fbb681e880c3e60..4dd3464e780b7c8fb58adf0976482d22ab5e2764 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.protocol.pcep.impl.message.PCEPNotificationMessageParser
 import org.opendaylight.protocol.pcep.impl.message.PCEPOpenMessageParser;
 import org.opendaylight.protocol.pcep.impl.message.PCEPReplyMessageParser;
 import org.opendaylight.protocol.pcep.impl.message.PCEPRequestMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
 import org.opendaylight.protocol.util.ByteArray;
@@ -148,7 +148,7 @@ import com.google.common.collect.Lists;
 
 public class PCEPValidatorTest {
 
-       private ObjectHandlerRegistry objectRegistry;
+       private ObjectRegistry objectRegistry;
 
        private Rp rpTrue;
        private Rp rpFalse;
index fb1ba57facd2afa70f89b0c5809518f9542b8c67..3231c84e052507f03ca8caca5c85790e689b4adf 100644 (file)
@@ -65,8 +65,8 @@ import org.opendaylight.protocol.pcep.impl.tlv.OrderTlvParser;
 import org.opendaylight.protocol.pcep.impl.tlv.OverloadedDurationTlvParser;
 import org.opendaylight.protocol.pcep.impl.tlv.ReqMissingTlvParser;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.LabelHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.LabelRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
 import org.opendaylight.protocol.pcep.spi.TlvRegistry;
@@ -114,7 +114,7 @@ public final class Activator extends AbstractPCEPExtensionProviderActivator {
        protected List<AutoCloseable> startImpl(final PCEPExtensionProviderContext context) {
                final List<AutoCloseable> regs = new ArrayList<>();
 
-               final LabelHandlerRegistry labelReg = context.getLabelHandlerRegistry();
+               final LabelRegistry labelReg = context.getLabelHandlerRegistry();
                context.registerLabelParser(Type1LabelParser.CTYPE, new Type1LabelParser());
                context.registerLabelParser(GeneralizedLabelParser.CTYPE, new GeneralizedLabelParser());
                context.registerLabelParser(WavebandSwitchingLabelParser.CTYPE, new WavebandSwitchingLabelParser());
@@ -187,7 +187,7 @@ public final class Activator extends AbstractPCEPExtensionProviderActivator {
                context.registerTlvSerializer(OfList.class, new OFListTlvParser());
                context.registerTlvSerializer(Order.class, new OrderTlvParser());
 
-               final ObjectHandlerRegistry objReg = context.getObjectHandlerRegistry();
+               final ObjectRegistry objReg = context.getObjectHandlerRegistry();
                context.registerObjectParser(PCEPRequestParameterObjectParser.CLASS, PCEPRequestParameterObjectParser.TYPE,
                                new PCEPRequestParameterObjectParser(tlvReg));
                context.registerObjectParser(PCEPNoPathObjectParser.CLASS, PCEPNoPathObjectParser.TYPE, new PCEPNoPathObjectParser(tlvReg));
index 2001581b1637e27a09636a6e710b9bc49e1f120c..a700f467f0d01950d938dbf866ce5e5f2704fd4a 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.CloseBuilder;
@@ -30,7 +30,7 @@ public class PCEPCloseMessageParser extends AbstractMessageParser {
 
        public static final int TYPE = 7;
 
-       public PCEPCloseMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPCloseMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 3b763470f2e975017544571e63ccf58cc173eee8..a69d128cb131940134ba94b79b1124807bec5337 100644 (file)
@@ -13,7 +13,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.protocol.pcep.spi.UnknownObject;
@@ -43,7 +43,7 @@ public class PCEPErrorMessageParser extends AbstractMessageParser {
 
        public static final int TYPE = 6;
 
-       public PCEPErrorMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPErrorMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 7eedb858f08d801e91dd10f545ce56b4974d9770..81aaded51f247bc404d4898134a30eb6f0069bfe 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
@@ -27,7 +27,7 @@ public class PCEPKeepAliveMessageParser extends AbstractMessageParser {
        private static final KeepaliveMessage MESSAGE = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
        public static final int TYPE = 2;
 
-       public PCEPKeepAliveMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPKeepAliveMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index ca04a80df848a9128df4c3ac0e6490c55b0ad963..ed8a40d4969897b498a094c1d6e10dc5535bca2e 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcntfBuilder;
@@ -36,7 +36,7 @@ public class PCEPNotificationMessageParser extends AbstractMessageParser {
 
        public static final int TYPE = 5;
 
-       public PCEPNotificationMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPNotificationMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 2584a0144b484b9bf4a020706e8eadfca17c3d42..81e157ed6922593af2124420bed8af5174e1afa1 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
@@ -28,7 +28,7 @@ public class PCEPOpenMessageParser extends AbstractMessageParser {
 
        public static final int TYPE = 1;
 
-       public PCEPOpenMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPOpenMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index fba2eb3269df25a9d0904a63cc97b84b639810cc..590b5ec00ffdede221fec2729a1c6cdc603ebb9a 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcrep;
@@ -50,7 +50,7 @@ public class PCEPReplyMessageParser extends AbstractMessageParser {
 
        public static final int TYPE = 4;
 
-       public PCEPReplyMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPReplyMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 44fbed0d2e6d84714fd5172874e87162671c3fb0..015ab58680e196ccaa711e37592b3951ccb185ee 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcreq;
@@ -58,7 +58,7 @@ public class PCEPRequestMessageParser extends AbstractMessageParser {
 
        public static final int TYPE = 3;
 
-       public PCEPRequestMessageParser(final ObjectHandlerRegistry registry) {
+       public PCEPRequestMessageParser(final ObjectRegistry registry) {
                super(registry);
        }
 
index 7a9c54eed6867a7b343b06e1f9c9f248b9ee0c64..eca9ca3c565f48f5cdc9669e85f0b5de9b08f08c 100644 (file)
@@ -13,9 +13,7 @@ import java.util.BitSet;
 import org.opendaylight.protocol.pcep.impl.object.EROSubobjectUtil;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.LabelHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.LabelParser;
-import org.opendaylight.protocol.pcep.spi.LabelSerializer;
+import org.opendaylight.protocol.pcep.spi.LabelRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject;
@@ -45,9 +43,9 @@ public class EROLabelSubobjectParser implements EROSubobjectParser, EROSubobject
 
        private static final int U_FLAG_OFFSET = 0;
 
-       private final LabelHandlerRegistry registry;
+       private final LabelRegistry registry;
 
-       public EROLabelSubobjectParser(final LabelHandlerRegistry labelReg) {
+       public EROLabelSubobjectParser(final LabelRegistry labelReg) {
                this.registry = Preconditions.checkNotNull(labelReg);
        }
 
@@ -64,40 +62,27 @@ public class EROLabelSubobjectParser implements EROSubobjectParser, EROSubobject
 
                final short cType = (short) UnsignedBytes.toInt(buffer[C_TYPE_F_OFFSET]);
 
-               final LabelParser parser = this.registry.getLabelParser(cType);
+               final LabelType labelType = this.registry.parseLabel(cType, ByteArray.cutBytes(buffer, HEADER_LENGTH));
 
-               if (parser == null) {
+               if (labelType == null) {
                        throw new PCEPDeserializerException("Unknown C-TYPE for ero label subobject. Passed: " + cType);
                }
                final LabelBuilder builder = new LabelBuilder();
                builder.setUniDirectional(reserved.get(U_FLAG_OFFSET));
-               builder.setLabelType(parser.parseLabel(ByteArray.cutBytes(buffer, HEADER_LENGTH)));
+               builder.setLabelType(labelType);
                return new SubobjectBuilder().setLoose(loose).setSubobjectType(new LabelCaseBuilder().setLabel(builder.build()).build()).build();
        }
 
        @Override
        public byte[] serializeSubobject(final Subobject subobject) {
                Preconditions.checkNotNull(subobject.getSubobjectType(), "Subobject type cannot be empty.");
-
                final Label label = ((LabelCase) subobject.getSubobjectType()).getLabel();
-               final LabelType l = label.getLabelType();
-
-               final LabelSerializer serializer = this.registry.getLabelSerializer(l);
-
-               if (serializer == null) {
+               final byte[] labelbytes = this.registry.serializeLabel(label.isUniDirectional(), false, label.getLabelType());
+               if (labelbytes == null) {
                        throw new IllegalArgumentException("Unknown EROLabelSubobject instance. Passed "
                                        + label.getLabelType().getImplementedInterface());
                }
-               final byte[] labelbytes = serializer.serializeLabel(l);
-               final byte[] retBytes = new byte[labelbytes.length + HEADER_LENGTH];
-
-               System.arraycopy(labelbytes, 0, retBytes, HEADER_LENGTH, labelbytes.length);
-
-               final BitSet reserved = new BitSet();
-               reserved.set(U_FLAG_OFFSET, label.isUniDirectional());
-               System.arraycopy(ByteArray.bitSetToBytes(reserved, RES_F_LENGTH), 0, retBytes, RES_F_OFFSET, RES_F_LENGTH);
-               retBytes[C_TYPE_F_OFFSET] = UnsignedBytes.checkedCast(serializer.getType());
-               return EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), retBytes);
+               return EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), labelbytes);
        }
 
        @Override
index 05b6a69d3a9fd2366a2da7fb6431e78d250788e6..33543e68b3deff8ba000d6a536dbc877eb37f243 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.impl.subobject;
 
 import org.opendaylight.protocol.pcep.spi.LabelParser;
 import org.opendaylight.protocol.pcep.spi.LabelSerializer;
+import org.opendaylight.protocol.pcep.spi.LabelUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.GeneralizedLabelCase;
@@ -32,12 +33,12 @@ public class GeneralizedLabelParser implements LabelParser, LabelSerializer {
        }
 
        @Override
-       public byte[] serializeLabel(final LabelType subobject) {
+       public byte[] serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject) {
                if (!(subobject instanceof GeneralizedLabelCase)) {
                        throw new IllegalArgumentException("Unknown Label Subobject instance. Passed " + subobject.getClass()
                                        + ". Needed GeneralizedLabelCase.");
                }
-               return ((GeneralizedLabelCase) subobject).getGeneralizedLabel().getGeneralizedLabel();
+               return LabelUtil.formatLabel(CTYPE, unidirectional, global, ((GeneralizedLabelCase) subobject).getGeneralizedLabel().getGeneralizedLabel());
        }
 
        @Override
index 20df46586b9e2db34ea2ad512de582aedb60fd95..9504689fae3da69224f8b01dd7f0be2c12574faa 100644 (file)
@@ -11,9 +11,7 @@ import java.util.Arrays;
 import java.util.BitSet;
 
 import org.opendaylight.protocol.pcep.impl.object.RROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.LabelHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.LabelParser;
-import org.opendaylight.protocol.pcep.spi.LabelSerializer;
+import org.opendaylight.protocol.pcep.spi.LabelRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
@@ -46,9 +44,9 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject
        public static final int U_FLAG_OFFSET = 0;
        public static final int G_FLAG_OFFSET = 7;
 
-       private final LabelHandlerRegistry registry;
+       private final LabelRegistry registry;
 
-       public RROLabelSubobjectParser(final LabelHandlerRegistry labelReg) {
+       public RROLabelSubobjectParser(final LabelRegistry labelReg) {
                this.registry = Preconditions.checkNotNull(labelReg);
        }
 
@@ -65,36 +63,27 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject
 
                final short cType = (short) UnsignedBytes.toInt(buffer[C_TYPE_F_OFFSET]);
 
-               final LabelParser parser = this.registry.getLabelParser(cType);
-
-               if (parser == null) {
+               final LabelType labelType = this.registry.parseLabel(cType, ByteArray.cutBytes(buffer, HEADER_LENGTH));
+               if (labelType == null) {
                        throw new PCEPDeserializerException("Unknown C-TYPE for ero label subobject. Passed: " + cType);
                }
                final LabelBuilder builder = new LabelBuilder();
                builder.setUniDirectional(reserved.get(U_FLAG_OFFSET));
                builder.setGlobal(reserved.get(G_FLAG_OFFSET));
-               builder.setLabelType(parser.parseLabel(ByteArray.cutBytes(buffer, HEADER_LENGTH)));
+               builder.setLabelType(labelType);
                return new SubobjectBuilder().setSubobjectType(new LabelCaseBuilder().setLabel(builder.build()).build()).build();
        }
 
        @Override
        public byte[] serializeSubobject(final Subobject subobject) {
+               Preconditions.checkNotNull(subobject.getSubobjectType(), "Subobject type cannot be empty.");
                final Label label = ((LabelCase) subobject.getSubobjectType()).getLabel();
-               final LabelType l = label.getLabelType();
-               final LabelSerializer parser = this.registry.getLabelSerializer(l);
-               if (parser == null) {
-                       throw new IllegalArgumentException("Unknown RROLabelSubobject instance. Passed " + subobject.getSubobjectType().getClass());
+               final byte[] labelbytes = this.registry.serializeLabel(label.isUniDirectional(), false, label.getLabelType());
+               if (labelbytes == null) {
+                       throw new IllegalArgumentException("Unknown EROLabelSubobject instance. Passed "
+                                       + label.getLabelType().getImplementedInterface());
                }
-               final byte[] labelbytes = parser.serializeLabel(l);
-               final byte[] retBytes = new byte[labelbytes.length + HEADER_LENGTH];
-               System.arraycopy(labelbytes, 0, retBytes, HEADER_LENGTH, labelbytes.length);
-
-               final BitSet reserved = new BitSet();
-               reserved.set(U_FLAG_OFFSET, label.isUniDirectional());
-               reserved.set(G_FLAG_OFFSET, label.isGlobal());
-               System.arraycopy(ByteArray.bitSetToBytes(reserved, RES_F_LENGTH), 0, retBytes, RES_F_OFFSET, RES_F_LENGTH);
-               retBytes[C_TYPE_F_OFFSET] = UnsignedBytes.checkedCast(parser.getType());
-               return RROSubobjectUtil.formatSubobject(TYPE, retBytes);
+               return RROSubobjectUtil.formatSubobject(TYPE, labelbytes);
        }
 
        @Override
index 3c3c2a6ebd55b3381c25d1bcf321e395f03f4648..fbb92a5201d93ceb4a45c38a1756575f0689326b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.impl.subobject;
 
 import org.opendaylight.protocol.pcep.spi.LabelParser;
 import org.opendaylight.protocol.pcep.spi.LabelSerializer;
+import org.opendaylight.protocol.pcep.spi.LabelUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
@@ -41,12 +42,12 @@ public class Type1LabelParser implements LabelParser, LabelSerializer {
        }
 
        @Override
-       public byte[] serializeLabel(final LabelType subobject) {
+       public byte[] serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject) {
                if (!(subobject instanceof Type1LabelCase)) {
                        throw new IllegalArgumentException("Unknown Label Subobject instance. Passed " + subobject.getClass()
                                        + ". Needed Type1LabelCase.");
                }
-               return ByteArray.longToBytes(((Type1LabelCase) subobject).getType1Label().getType1Label().longValue(), LABEL_LENGTH);
+               return LabelUtil.formatLabel(CTYPE, unidirectional, global, ByteArray.longToBytes(((Type1LabelCase) subobject).getType1Label().getType1Label().longValue(), LABEL_LENGTH));
        }
 
        @Override
index c959cec2b41db7b3ee2c5669a4a82cea1e224e61..edff427de9b44cd21b0af4d05d58b07e34856d09 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.impl.subobject;
 
 import org.opendaylight.protocol.pcep.spi.LabelParser;
 import org.opendaylight.protocol.pcep.spi.LabelSerializer;
+import org.opendaylight.protocol.pcep.spi.LabelUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
@@ -50,7 +51,7 @@ public class WavebandSwitchingLabelParser implements LabelParser, LabelSerialize
        }
 
        @Override
-       public byte[] serializeLabel(final LabelType subobject) {
+       public byte[] serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject) {
                if (!(subobject instanceof WavebandSwitchingLabelCase)) {
                        throw new IllegalArgumentException("Unknown Label Subobject instance. Passed " + subobject.getClass()
                                        + ". Needed WavebandSwitchingLabelCase.");
@@ -61,7 +62,7 @@ public class WavebandSwitchingLabelParser implements LabelParser, LabelSerialize
                System.arraycopy(ByteArray.intToBytes(obj.getStartLabel().intValue(), START_F_LENGTH), 0, retBytes, WAVEB_F_LENGTH, START_F_LENGTH);
                System.arraycopy(ByteArray.intToBytes(obj.getEndLabel().intValue(), END_F_LENGTH), 0, retBytes, WAVEB_F_LENGTH + START_F_LENGTH,
                                END_F_LENGTH);
-               return retBytes;
+               return LabelUtil.formatLabel(CTYPE, unidirectional, global, retBytes);
        }
 
        @Override
similarity index 92%
rename from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractVendorSpecificTlvParser.java
rename to pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tlv/AbstractVendorSpecificTlvParser.java
index bd43e70e3c5a9cdec15e24a009e5a51d335a1a29..be0a032aa8c4e4d9f4072102a7a897053573762f 100644 (file)
@@ -5,8 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.pcep.spi;
+package org.opendaylight.protocol.pcep.impl.tlv;
 
+import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.spi.TlvParser;
+import org.opendaylight.protocol.pcep.spi.TlvSerializer;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
@@ -39,7 +42,7 @@ abstract public class AbstractVendorSpecificTlvParser implements TlvParser, TlvS
             final byte[] bytes = new byte[ianaNumBytes.length + payloadBytes.length];
             System.arraycopy(ianaNumBytes, 0, bytes, 0, ENTERPRISE_NUM_LENGTH);
             System.arraycopy(payloadBytes, 0, bytes, ENTERPRISE_NUM_LENGTH, payloadBytes.length);
-            return bytes;
+            return TlvUtil.formatTlv(TYPE, bytes);
         }
         return new byte[0];
     }
index 0062346f45ca6ffe22e2caff908a68497eeaad80..e0d161b0a6aed257d3496acb357b3105240ad72a 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.protocol.pcep.impl.subobject.GeneralizedLabelParser;
 import org.opendaylight.protocol.pcep.impl.subobject.Type1LabelParser;
 import org.opendaylight.protocol.pcep.impl.subobject.WavebandSwitchingLabelParser;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.GeneralizedLabelCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.Type1LabelCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.label.type.WavebandSwitchingLabelCaseBuilder;
@@ -24,19 +25,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 
 public class LabelSubobjectParserTest {
 
-       private static final byte[] generalizedLabelBytes = { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF };
+       private static final byte[] generalizedLabelBytes = { (byte) 0x80, 0x02, 0x00, 0x04, 0x12, 0x00, 0x25, (byte) 0xFF };
 
-       private static final byte[] wavebandLabelBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x12, (byte) 0x34, (byte) 0x00, (byte) 0x00,
-                       (byte) 0x99, (byte) 0x99, (byte) 0x00, (byte) 0x00, (byte) 0x11, (byte) 0x11 };
+       private static final byte[] typeOneLabelBytes = { (byte) 0x81, 0x01, 0x12, 0x00, 0x25, (byte) 0xFF };
+
+       private static final byte[] wavebandLabelBytes = { 0x01, 0x03, 0x00, 0x00, 0x12, 0x34, 0x00, 0x00, (byte) 0x99, (byte) 0x99, 0x00, 0x00, 0x11, 0x11 };
 
        @Test
        public void testGeneralizedLabel() throws PCEPDeserializerException {
                final GeneralizedLabelParser parser = new GeneralizedLabelParser();
                final GeneralizedLabelBuilder iBuilder = new GeneralizedLabelBuilder();
-               iBuilder.setGeneralizedLabel(generalizedLabelBytes);
+               iBuilder.setGeneralizedLabel(ByteArray.cutBytes(generalizedLabelBytes, 2));
                final GeneralizedLabelCaseBuilder builder = new GeneralizedLabelCaseBuilder().setGeneralizedLabel(iBuilder.build());
-               assertEquals(builder.build(), parser.parseLabel(generalizedLabelBytes));
-               assertArrayEquals(generalizedLabelBytes, parser.serializeLabel(builder.build()));
+               assertEquals(builder.build(), parser.parseLabel(ByteArray.cutBytes(generalizedLabelBytes, 2)));
+               assertArrayEquals(generalizedLabelBytes, parser.serializeLabel(true, false, builder.build()));
        }
 
        @Test
@@ -47,8 +49,8 @@ public class LabelSubobjectParserTest {
                iBuilder.setStartLabel(0x9999L);
                iBuilder.setEndLabel(0x1111L);
                final WavebandSwitchingLabelCaseBuilder builder = new WavebandSwitchingLabelCaseBuilder().setWavebandSwitchingLabel(iBuilder.build());
-               assertEquals(builder.build(), parser.parseLabel(wavebandLabelBytes));
-               assertArrayEquals(wavebandLabelBytes, parser.serializeLabel(builder.build()));
+               assertEquals(builder.build(), parser.parseLabel(ByteArray.cutBytes(wavebandLabelBytes, 2)));
+               assertArrayEquals(wavebandLabelBytes, parser.serializeLabel(false, true, builder.build()));
        }
 
        @Test
@@ -57,7 +59,7 @@ public class LabelSubobjectParserTest {
                final Type1LabelBuilder iBuilder = new Type1LabelBuilder();
                iBuilder.setType1Label(0x120025ffL);
                final Type1LabelCaseBuilder builder = new Type1LabelCaseBuilder().setType1Label(iBuilder.build());
-               assertEquals(builder.build(), parser.parseLabel(generalizedLabelBytes));
-               assertArrayEquals(generalizedLabelBytes, parser.serializeLabel(builder.build()));
+               assertEquals(builder.build(), parser.parseLabel(ByteArray.cutBytes(typeOneLabelBytes, 2)));
+               assertArrayEquals(typeOneLabelBytes, parser.serializeLabel(true, true, builder.build()));
        }
 }
index d99eaedb5d08e0dff62853713a6af7dc0395af26..fa37327467183e211e795492ecd7be24591e29c7 100644 (file)
@@ -40,19 +40,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 public class PCEPRROSubobjectParserTest {
 
        private static final byte[] ip4PrefixBytes = { (byte) 0x01, (byte) 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0x16, (byte) 0x01 };
+               (byte) 0x16, (byte) 0x01 };
        private static final byte[] ip6PrefixBytes = { (byte) 0x02, (byte) 0x14, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x16, (byte) 0x02 };
+               (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+               (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x16, (byte) 0x02 };
        private static final byte[] unnumberedBytes = { (byte) 0x04, (byte) 0x0c, (byte) 0x02, (byte) 0x00, (byte) 0x12, (byte) 0x34,
-                       (byte) 0x50, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
+               (byte) 0x50, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
        private static final byte[] pathKey32Bytes = { (byte) 0x40, (byte) 0x08, (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34,
-                       (byte) 0x50, (byte) 0x00 };
+               (byte) 0x50, (byte) 0x00 };
        private static final byte[] pathKey128Bytes = { (byte) 0x41, (byte) 0x14, (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34,
-                       (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00,
-                       (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-       private static final byte[] labelBytes = { (byte) 0x03, (byte) 0x08, (byte) 0x81, (byte) 0x02, (byte) 0x12, (byte) 0x00, (byte) 0x25,
-                       (byte) 0xFF };
+               (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00,
+               (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+       private static final byte[] labelBytes = { 0x03, 0x08, (byte) 0x80, 0x02, 0x12, 0x00, 0x25,     (byte) 0xFF };
 
        @Test
        public void testRROIp4PrefixSubobject() throws PCEPDeserializerException {
@@ -126,7 +125,7 @@ public class PCEPRROSubobjectParserTest {
                        final RROLabelSubobjectParser parser = new RROLabelSubobjectParser(ctx.getLabelHandlerRegistry());
                        final SubobjectBuilder subs = new SubobjectBuilder();
                        subs.setSubobjectType(new LabelCaseBuilder().setLabel(
-                                       new LabelBuilder().setUniDirectional(true).setGlobal(true).setLabelType(
+                                       new LabelBuilder().setUniDirectional(true).setGlobal(false).setLabelType(
                                                        new GeneralizedLabelCaseBuilder().setGeneralizedLabel(
                                                                        new GeneralizedLabelBuilder().setGeneralizedLabel(
                                                                                        new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }).build()).build()).build()).build());
index 8d865e3f777bfc113e065512db93a6dad578fc64..97ce4243f357db907757fddfb7c6ebbd3d7b24f4 100644 (file)
@@ -53,9 +53,9 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
        private static final int P_FLAG_OFFSET = 6;
        private static final int I_FLAG_OFFSET = 7;
 
-       private final ObjectHandlerRegistry registry;
+       private final ObjectRegistry registry;
 
-       protected AbstractMessageParser(final ObjectHandlerRegistry registry) {
+       protected AbstractMessageParser(final ObjectRegistry registry) {
                this.registry = Preconditions.checkNotNull(registry);
        }
 
@@ -63,9 +63,7 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
                if (object == null) {
                        return new byte[] {};
                }
-               final ObjectSerializer serializer = this.registry.getObjectSerializer(object);
-               LOG.trace("Choosen serializer {}", serializer);
-               return serializer.serializeObject(object);
+               return this.registry.serializeObject(object);
        }
 
        private List<Object> parseObjects(final byte[] bytes) throws PCEPDeserializerException {
@@ -103,11 +101,10 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
 
                        offset += objLength - COMMON_OBJECT_HEADER_LENGTH;
 
-                       final ObjectParser parser = Preconditions.checkNotNull(this.registry.getObjectParser(objClass, objType));
                        final ObjectHeader header = new ObjectHeaderImpl(flags.get(P_FLAG_OFFSET), flags.get(I_FLAG_OFFSET));
 
                        // parseObject is required to return null for P=0 errored objects
-                       final Object o = parser.parseObject(header, bytesToPass);
+                       final Object o = this.registry.parseObject(objClass, objType, header, bytesToPass);
                        if (o != null) {
                                objs.add(o);
                        }
@@ -131,9 +128,9 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
                                new PcerrMessageBuilder().setErrorType(
                                                new RequestCaseBuilder().setRequest(
                                                                new RequestBuilder().setRps(Lists.newArrayList(new RpsBuilder().setRp(rp).build())).build()).build()).setErrors(
-                                               Arrays.asList(new ErrorsBuilder().setErrorObject(
-                                                               new ErrorObjectBuilder().setType(maping.getFromErrorsEnum(e).type).setValue(
-                                                                               maping.getFromErrorsEnum(e).value).build()).build())).build()).build();
+                                                                               Arrays.asList(new ErrorsBuilder().setErrorObject(
+                                                                                               new ErrorObjectBuilder().setType(maping.getFromErrorsEnum(e).type).setValue(
+                                                                                                               maping.getFromErrorsEnum(e).value).build()).build())).build()).build();
        }
 
        protected abstract Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException;
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelHandlerRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelHandlerRegistry.java
deleted file mode 100644 (file)
index 9fd7c5b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.spi;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
-
-public interface LabelHandlerRegistry {
-       LabelParser getLabelParser(int cType);
-       LabelSerializer getLabelSerializer(LabelType label);
-}
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java
new file mode 100644 (file)
index 0000000..04b912d
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.spi;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
+
+public interface LabelRegistry {
+       /**
+        * Finds parser for given label C-type in the registry. Delegates parsing to found parser.
+        * @param cType label type, key in parser registry
+        * @param buffer label raw binary value to be parsed
+        * @return null if the parser for this label could not be found
+        * @throws PCEPDeserializerException if the parsing did not succeed
+        */
+       LabelType parseLabel(final int cType, final byte[] buffer) throws PCEPDeserializerException;
+
+       /**
+        * Find serializer for given label. Delegates parsing to found serializer.
+        * @param label to be parsed
+        * @param unidirectional label common header flag
+        * @param global label commom header flag
+        * @return null if the serializer for this label could not be found
+        */
+       byte[] serializeLabel(final boolean unidirectional, final boolean global, final LabelType label);
+}
index 90f4df8092212b33e3250f851f8db1cbbee43590..e263d650b63d8671ea214ea811c2db61ed06d3e4 100644 (file)
@@ -12,5 +12,5 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 public interface LabelSerializer {
        @Deprecated
        int getType();
-       byte[] serializeLabel(LabelType subobject);
+       byte[] serializeLabel(boolean unidirectional, boolean global, LabelType subobject);
 }
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelUtil.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelUtil.java
new file mode 100644 (file)
index 0000000..2b7f64a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.spi;
+
+import java.util.BitSet;
+
+import org.opendaylight.protocol.util.ByteArray;
+
+import com.google.common.primitives.UnsignedBytes;
+
+public class LabelUtil {
+
+       private static final int RES_F_LENGTH = 1;
+
+       private static final int C_TYPE_F_LENGTH = 1;
+
+       private static final int RES_F_OFFSET = 0;
+
+       private static final int C_TYPE_F_OFFSET = RES_F_OFFSET + RES_F_LENGTH;
+
+       private static final int HEADER_LENGTH = C_TYPE_F_OFFSET + C_TYPE_F_LENGTH;
+
+       private static final int U_FLAG_OFFSET = 0;
+
+       private static final int G_FLAG_OFFSET = 7;
+
+       private LabelUtil() {
+
+       }
+
+       public static byte[] formatLabel(final int type, final boolean unidirectional, final boolean global, final byte[] labelbytes) {
+
+               final byte[] retBytes = new byte[labelbytes.length + HEADER_LENGTH];
+
+               System.arraycopy(labelbytes, 0, retBytes, HEADER_LENGTH, labelbytes.length);
+
+               final BitSet reserved = new BitSet();
+               reserved.set(U_FLAG_OFFSET, unidirectional);
+               reserved.set(G_FLAG_OFFSET, global);
+               System.arraycopy(ByteArray.bitSetToBytes(reserved, RES_F_LENGTH), 0, retBytes, RES_F_OFFSET, RES_F_LENGTH);
+               retBytes[C_TYPE_F_OFFSET] = UnsignedBytes.checkedCast(type);
+               return retBytes;
+       }
+}
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectHandlerRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectHandlerRegistry.java
deleted file mode 100644 (file)
index 7933b36..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.spi;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
-
-public interface ObjectHandlerRegistry {
-       ObjectParser getObjectParser(int objectClass, int objectType);
-       ObjectSerializer getObjectSerializer(Object object);
-}
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java
new file mode 100644 (file)
index 0000000..248d933
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.spi;
+
+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;
+
+public interface ObjectRegistry {
+       /**
+        * Finds parser for given object type and class in the registry. Delegates parsing to found parser.
+        * @param objectType object type
+        * @param objectClass object class
+        * @param buffer object raw binary value to be parsed
+        * @return null if the parser for this object could not be found
+        * @throws PCEPDeserializerException if the parsing did not succeed
+        */
+       Object parseObject(final int objectClass, final int objectType, final ObjectHeader header, final byte[] buffer) throws PCEPDeserializerException;
+
+       /**
+        * Find serializer for given object. Delegates parsing to found serializer.
+        * @param object to be parsed
+        * @return null if the serializer for this object could not be found
+        */
+       byte[] serializeObject(Object object);
+}
index b59452d47238d7ec84bfc80ac731ed4159d0ba7b..0b73fa424fd3429dfa8e28e93c34c6a709c12ab1 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.protocol.pcep.spi;
 
 public interface PCEPExtensionConsumerContext {
 
-       LabelHandlerRegistry getLabelHandlerRegistry();
+       LabelRegistry getLabelHandlerRegistry();
 
        MessageHandlerRegistry getMessageHandlerRegistry();
 
-       ObjectHandlerRegistry getObjectHandlerRegistry();
+       ObjectRegistry getObjectHandlerRegistry();
 
        EROSubobjectRegistry getEROSubobjectHandlerRegistry();
 
similarity index 66%
rename from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelHandlerRegistry.java
rename to pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java
index 441343a93fcc71390dbfcfee5128a97e6b5caa70..ba8880cc8479fc106031c43cfff1122353ab5d21 100644 (file)
@@ -8,16 +8,17 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.LabelHandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.LabelParser;
+import org.opendaylight.protocol.pcep.spi.LabelRegistry;
 import org.opendaylight.protocol.pcep.spi.LabelSerializer;
+import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.util.Values;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.label.subobject.LabelType;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 import com.google.common.base.Preconditions;
 
-public class SimpleLabelHandlerRegistry implements LabelHandlerRegistry {
+public class SimpleLabelRegistry implements LabelRegistry {
        private final HandlerRegistry<DataContainer, LabelParser, LabelSerializer> handlers = new HandlerRegistry<>();
 
        public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
@@ -30,13 +31,21 @@ public class SimpleLabelHandlerRegistry implements LabelHandlerRegistry {
        }
 
        @Override
-       public LabelParser getLabelParser(final int cType) {
+       public LabelType parseLabel(int cType, byte[] buffer) throws PCEPDeserializerException {
                Preconditions.checkArgument(cType >= 0 && cType <= Values.UNSIGNED_BYTE_MAX_VALUE);
-               return this.handlers.getParser(cType);
+               final LabelParser parser = this.handlers.getParser(cType);
+               if (parser == null) {
+                       return null;
+               }
+               return parser.parseLabel(buffer);
        }
 
        @Override
-       public LabelSerializer getLabelSerializer(final LabelType label) {
-               return this.handlers.getSerializer(label.getImplementedInterface());
+       public byte[] serializeLabel(final boolean unidirectional, final boolean global, final LabelType label) {
+               final LabelSerializer serializer = this.handlers.getSerializer(label.getImplementedInterface());
+               if (serializer == null) {
+                       return null;
+               }
+               return serializer.serializeLabel(unidirectional, global, label);
        }
 }
similarity index 66%
rename from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectHandlerRegistry.java
rename to pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java
index c93b9374c2c8faef763cee3108fc5c64b8872d1d..c123d906e510f94f6b00ec5148bbe353ea2f2926 100644 (file)
@@ -8,9 +8,10 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.ObjectParser;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
+import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
 import org.opendaylight.protocol.pcep.spi.UnknownObject;
 import org.opendaylight.protocol.util.Values;
@@ -23,7 +24,7 @@ import com.google.common.base.Preconditions;
 /**
  *
  */
-public final class SimpleObjectHandlerRegistry implements ObjectHandlerRegistry {
+public final class SimpleObjectRegistry implements ObjectRegistry {
        private final HandlerRegistry<DataContainer, ObjectParser, ObjectSerializer> handlers = new HandlerRegistry<>();
 
        private static int createKey(final int objectClass, final int objectType) {
@@ -43,35 +44,31 @@ public final class SimpleObjectHandlerRegistry implements ObjectHandlerRegistry
        }
 
        @Override
-       public ObjectParser getObjectParser(final int objectClass, final int objectType) {
-               final ObjectParser ret = this.handlers.getParser(createKey(objectClass, objectType));
-               if (ret != null) {
-                       return ret;
-               }
+       public Object parseObject(int objectClass, int objectType, ObjectHeader header, byte[] buffer) throws PCEPDeserializerException {
+               Preconditions.checkArgument(objectType >= 0 && objectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
+               final ObjectParser parser = this.handlers.getParser(createKey(objectClass, objectType));
+
+               if (parser == null) {
 
-               final boolean foundClass = false;
+                       final boolean foundClass = false;
 
-               // FIXME: BUG-187: search the parsers, check classes
+                       // FIXME: BUG-187: search the parsers, check classes
 
-               if (!foundClass) {
-                       return new ObjectParser() {
-                               @Override
-                               public Object parseObject(final ObjectHeader header, final byte[] buffer) {
-                                       return new UnknownObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS);
-                               }
-                       };
-               } else {
-                       return new ObjectParser() {
-                               @Override
-                               public Object parseObject(final ObjectHeader header, final byte[] buffer) {
-                                       return new UnknownObject(PCEPErrors.UNRECOGNIZED_OBJ_TYPE);
-                               }
-                       };
+                       if (!foundClass) {
+                               return new UnknownObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS);
+                       } else {
+                               return new UnknownObject(PCEPErrors.UNRECOGNIZED_OBJ_TYPE);
+                       }
                }
+               return parser.parseObject(header, buffer);
        }
 
        @Override
-       public ObjectSerializer getObjectSerializer(final Object object) {
-               return this.handlers.getSerializer(object.getImplementedInterface());
+       public byte[] serializeObject(Object object) {
+               final ObjectSerializer serializer = this.handlers.getSerializer(object.getImplementedInterface());
+               if (serializer == null) {
+                       return null;
+               }
+               return serializer.serializeObject(object);
        }
 }
index 27fa7be5c912e542e3f862365130a8843c53d3af..efa80cde3d2fe0191dc7866ffdf14006aabf1e51 100644 (file)
@@ -12,13 +12,13 @@ import javax.annotation.concurrent.ThreadSafe;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.LabelHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.LabelRegistry;
 import org.opendaylight.protocol.pcep.spi.LabelParser;
 import org.opendaylight.protocol.pcep.spi.LabelSerializer;
 import org.opendaylight.protocol.pcep.spi.MessageHandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.MessageParser;
 import org.opendaylight.protocol.pcep.spi.MessageSerializer;
-import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.ObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
@@ -42,16 +42,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
  */
 @ThreadSafe
 public class SimplePCEPExtensionProviderContext implements PCEPExtensionProviderContext {
-       private final SimpleLabelHandlerRegistry labelReg = new SimpleLabelHandlerRegistry();
+       private final SimpleLabelRegistry labelReg = new SimpleLabelRegistry();
        private final SimpleMessageHandlerRegistry msgReg = new SimpleMessageHandlerRegistry();
-       private final SimpleObjectHandlerRegistry objReg = new SimpleObjectHandlerRegistry();
+       private final SimpleObjectRegistry objReg = new SimpleObjectRegistry();
        private final SimpleEROSubobjectRegistry eroSubReg = new SimpleEROSubobjectRegistry();
        private final SimpleRROSubobjectRegistry rroSubReg = new SimpleRROSubobjectRegistry();
        private final SimpleXROSubobjectRegistry xroSubReg = new SimpleXROSubobjectRegistry();
        private final SimpleTlvRegistry tlvReg = new SimpleTlvRegistry();
 
        @Override
-       public final LabelHandlerRegistry getLabelHandlerRegistry() {
+       public final LabelRegistry getLabelHandlerRegistry() {
                return this.labelReg;
        }
 
@@ -61,7 +61,7 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
        }
 
        @Override
-       public final ObjectHandlerRegistry getObjectHandlerRegistry() {
+       public final ObjectRegistry getObjectHandlerRegistry() {
                return this.objReg;
        }
 
index 40f7cd7cbef1e63a5db766516e14b1fe9e3791f2..4caf11d67d404f33c62298755b9331fc6ff21fcb 100644 (file)
@@ -199,7 +199,7 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
 
                // Build the request and send it
                final UpdatesBuilder rb = new UpdatesBuilder();
-               rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(ra.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
+               rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(ra.getLsp().getPlspId()).setDelegate(ra.getLsp().isDelegate()).build());
 
                final PcupdMessageBuilder ib = new PcupdMessageBuilder(MESSAGE_HEADER);
                ib.setUpdates(ImmutableList.of(rb.build()));
@@ -221,7 +221,7 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
 
                // Build the PCUpd request and send it
                final UpdatesBuilder rb = new UpdatesBuilder();
-               rb.setLsp(new LspBuilder().setPlspId(ra.getLsp().getPlspId()).setDelegate(Boolean.TRUE).setOperational(input.getArguments().getAugmentation(Arguments2.class).isOperational()).build());
+               rb.setLsp(new LspBuilder().setPlspId(ra.getLsp().getPlspId()).setDelegate(ra.getLsp().isDelegate()).setOperational(input.getArguments().getAugmentation(Arguments2.class).isOperational()).build());
                final PathBuilder pb = new PathBuilder();
                rb.setPath(pb.setEro(input.getArguments().getEro()).build());
                pb.fieldsFrom(input.getArguments());
index 782711051f74c50ac84da7aaf8bb5e7a77b1f5eb..f412ffd5bece691dc8e0317687c243993cfffd41 100644 (file)
@@ -186,7 +186,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                final RequestsBuilder rb = new RequestsBuilder();
                rb.fieldsFrom(input.getArguments());
                rb.setSrp(new SrpBuilder().setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE).build());
-               rb.setLsp(new LspBuilder().setAdministrative(input.getArguments().isAdministrative()).setDelegate(Boolean.TRUE).setPlspId(
+               rb.setLsp(new LspBuilder().setAdministrative(input.getArguments().isAdministrative()).setDelegate(rb.getLsp().isDelegate()).setPlspId(
                                new PlspId(0L)).setTlvs(
                                                new TlvsBuilder().setSymbolicPathName(
                                                                new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(input.getName().getBytes(Charsets.UTF_8))).build()).build()).build());
@@ -215,7 +215,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                // Build the request and send it
                final RequestsBuilder rb = new RequestsBuilder();
                rb.setSrp(new SrpBuilder().setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE).build());
-               rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(ra.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
+               rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(ra.getLsp().getPlspId()).setDelegate(ra.getLsp().isDelegate()).build());
 
                final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(MESSAGE_HEADER);
                ib.setRequests(ImmutableList.of(rb.build()));
@@ -238,7 +238,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                // Build the PCUpd request and send it
                final UpdatesBuilder rb = new UpdatesBuilder();
                rb.setSrp(new SrpBuilder().setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE).build());
-               rb.setLsp(new LspBuilder().setPlspId(ra.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
+               rb.setLsp(new LspBuilder().setPlspId(ra.getLsp().getPlspId()).setDelegate(ra.getLsp().isDelegate()).build());
                final PathBuilder pb = new PathBuilder();
                rb.setPath(pb.setEro(input.getArguments().getEro()).build());
                pb.fieldsFrom(input.getArguments());
index d7553d0aa983d8304935db233d63fcfaabba68c8..a765b0d1b8bf823871ba5ea3c6446bff50840b87 100644 (file)
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
-      <parent>
-          <groupId>org.opendaylight.bgpcep</groupId>
-          <artifactId>tcpmd5-parent</artifactId>
-          <version>0.3.1-SNAPSHOT</version>
-      </parent>
+    <parent>
+        <groupId>org.opendaylight.bgpcep</groupId>
+        <artifactId>tcpmd5-parent</artifactId>
+        <version>0.3.1-SNAPSHOT</version>
+    </parent>
 
-      <modelVersion>4.0.0</modelVersion>
-      <artifactId>tcpmd5-core</artifactId>
-      <description>RFC2385-enable sockets</description>
-      <packaging>bundle</packaging>
-      <name>${project.artifactId}</name>
-      <prerequisites>
-          <maven>3.0.4</maven>
-      </prerequisites>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>tcpmd5-core</artifactId>
+    <description>RFC2385-enable sockets</description>
+    <packaging>bundle</packaging>
+    <name>${project.artifactId}</name>
+    <prerequisites>
+        <maven>3.0.4</maven>
+    </prerequisites>
 
     <dependencies>
         <dependency>
             </plugin>
         </plugins>
     </build>
-
-    <distributionManagement>
-        <site>
-            <id>${project.artifactId}</id>
-            <name>TCPMD5-CORE Module site</name>
-            <url>${basedir}/target/site/${project.artifactId}</url>
-        </site>
-    </distributionManagement>
 </project>
index d48b4fb74ecb52a26950509655b856042a21290a..bcf4e4c61baf97d91008ebe21d5867fb1e113b2f 100644 (file)
             </plugins>
         </pluginManagement>
     </build>
-
-    <pluginRepositories>
-        <pluginRepository>
-            <id>imagej.thirdparty</id>
-            <url>http://maven.imagej.net/content/repositories/thirdparty</url>
-        </pluginRepository>
-    </pluginRepositories>
-
-    <distributionManagement>
-        <site>
-            <id>${project.artifactId}</id>
-            <name>TCPMD5-JNI Module site</name>
-            <url>${basedir}/target/site/${project.artifactId}</url>
-        </site>
-    </distributionManagement>
 </project>