From 0eb1dcb005d2ef8c267f13bcaccf7620c182303e Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 16 Jan 2014 17:14:28 +0100 Subject: [PATCH] Switch to controller-provided protocol framework Change-Id: I378be68986a867477044ef8f35a0f50e410de82f Signed-off-by: Robert Varga --- bgp/parser-api/pom.xml | 9 +- bgp/parser-impl/pom.xml | 7 +- bgp/parser-mock/pom.xml | 5 +- bgp/parser-spi/pom.xml | 10 +- bgp/rib-impl/pom.xml | 8 +- bgp/rib-mock/pom.xml | 7 +- bgp/testtool/pom.xml | 5 +- commons/parent/pom.xml | 20 +- framework/.gitignore | 3 - framework/.project | 24 --- framework/pom.xml | 95 --------- .../framework/AbstractDispatcher.java | 168 ---------------- .../framework/AbstractProtocolSession.java | 52 ----- .../framework/AbstractSessionNegotiator.java | 74 ------- .../framework/DeserializerException.java | 37 ---- .../framework/DocumentedException.java | 40 ---- .../framework/NeverReconnectStrategy.java | 46 ----- .../framework/ProtocolHandlerFactory.java | 36 ---- .../framework/ProtocolMessageDecoder.java | 55 ------ .../framework/ProtocolMessageEncoder.java | 40 ---- .../framework/ProtocolMessageFactory.java | 41 ---- .../protocol/framework/ProtocolSession.java | 23 --- .../framework/ProtocolSessionPromise.java | 142 -------------- .../ReconnectImmediatelyStrategy.java | 51 ----- .../protocol/framework/ReconnectPromise.java | 182 ----------------- .../protocol/framework/ReconnectStrategy.java | 53 ----- .../framework/ReconnectStrategyFactory.java | 23 --- .../protocol/framework/SessionListener.java | 48 ----- .../framework/SessionListenerFactory.java | 22 --- .../protocol/framework/SessionNegotiator.java | 22 --- .../framework/SessionNegotiatorFactory.java | 28 --- .../protocol/framework/TerminationReason.java | 21 -- .../framework/TimedReconnectStrategy.java | 183 ------------------ .../protocol/framework/ComplementaryTest.java | 24 --- .../protocol/framework/ServerTest.java | 151 --------------- .../protocol/framework/Session.java | 47 ----- .../framework/SimpleByteToMessageDecoder.java | 26 --- .../protocol/framework/SimpleDispatcher.java | 64 ------ .../protocol/framework/SimpleMessage.java | 21 -- .../framework/SimpleMessageToByteEncoder.java | 24 --- .../protocol/framework/SimpleSession.java | 30 --- .../framework/SimpleSessionListener.java | 50 ----- .../SimpleSessionListenerFactory.java | 16 -- .../framework/SimpleSessionNegotiator.java | 28 --- framework/src/test/resources/keystore.jks | Bin 2249 -> 0 bytes framework/src/test/resources/logback-test.xml | 13 -- integration-tests/pom.xml | 4 + .../integration/AbstractBundleTest.java | 1 + .../integration/BgpLinkstateBundleTest.java | 2 +- .../integration/BgpParserApiBundleTest.java | 2 +- .../integration/BgpParserImplBundleTest.java | 3 +- .../integration/BgpParserMockBundleTest.java | 2 +- .../integration/BgpParserSpiBundleTest.java | 2 +- .../integration/BgpRibApiBundleTest.java | 2 +- .../integration/BgpRibImplBundleTest.java | 2 +- .../integration/BgpRibMockBundleTest.java | 2 +- .../integration/BgpRibSpiBundleTest.java | 2 +- .../integration/BgpUtilBundleTest.java | 2 +- .../integration/FrameworkBundleTest.java | 24 --- .../integration/PcepApiBundleTest.java | 2 +- .../integration/PcepImplBundleTest.java | 2 +- .../integration/PcepSpiBundleTest.java | 2 +- pcep/api/pom.xml | 9 +- pcep/impl/pom.xml | 12 +- pcep/testtool/pom.xml | 5 +- pom.xml | 1 - 66 files changed, 76 insertions(+), 2081 deletions(-) delete mode 100644 framework/.gitignore delete mode 100644 framework/.project delete mode 100644 framework/pom.xml delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/AbstractProtocolSession.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/NeverReconnectStrategy.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSession.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ReconnectImmediatelyStrategy.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategy.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategyFactory.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/SessionListener.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/SessionListenerFactory.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiator.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiatorFactory.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/TerminationReason.java delete mode 100644 framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/Session.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleByteToMessageDecoder.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessage.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessageToByteEncoder.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleSession.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListener.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListenerFactory.java delete mode 100644 framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionNegotiator.java delete mode 100644 framework/src/test/resources/keystore.jks delete mode 100644 framework/src/test/resources/logback-test.xml delete mode 100644 integration-tests/src/test/java/org/opendaylight/protocol/integration/FrameworkBundleTest.java diff --git a/bgp/parser-api/pom.xml b/bgp/parser-api/pom.xml index 3f1f69566d..77a46ecb90 100644 --- a/bgp/parser-api/pom.xml +++ b/bgp/parser-api/pom.xml @@ -33,10 +33,6 @@ ${project.groupId} util - - ${project.groupId} - framework - ${project.groupId} bgp-concepts @@ -50,6 +46,11 @@ slf4j-api + + org.opendaylight.controller + protocol-framework + + org.opendaylight.yangtools yang-binding diff --git a/bgp/parser-impl/pom.xml b/bgp/parser-impl/pom.xml index e89b4c1239..bcf36b9370 100644 --- a/bgp/parser-impl/pom.xml +++ b/bgp/parser-impl/pom.xml @@ -48,11 +48,12 @@ ${project.groupId} - framework + util + - ${project.groupId} - util + org.opendaylight.controller + protocol-framework diff --git a/bgp/parser-mock/pom.xml b/bgp/parser-mock/pom.xml index fba58b678e..875155e794 100644 --- a/bgp/parser-mock/pom.xml +++ b/bgp/parser-mock/pom.xml @@ -46,9 +46,10 @@ ${project.groupId} concepts + - ${project.groupId} - framework + org.opendaylight.controller + protocol-framework diff --git a/bgp/parser-spi/pom.xml b/bgp/parser-spi/pom.xml index 60642f36a7..74267f9090 100644 --- a/bgp/parser-spi/pom.xml +++ b/bgp/parser-spi/pom.xml @@ -33,10 +33,6 @@ ${project.groupId} util - - ${project.groupId} - framework - ${project.groupId} bgp-concepts @@ -45,6 +41,12 @@ ${project.groupId} bgp-parser-api + + + org.opendaylight.controller + protocol-framework + + com.google.guava guava diff --git a/bgp/rib-impl/pom.xml b/bgp/rib-impl/pom.xml index 8d0312210b..442ae58780 100644 --- a/bgp/rib-impl/pom.xml +++ b/bgp/rib-impl/pom.xml @@ -29,10 +29,6 @@ ${project.groupId} concepts - - ${project.groupId} - framework - ${project.groupId} util @@ -89,6 +85,10 @@ org.opendaylight.controller sal-binding-api + + org.opendaylight.controller + protocol-framework + org.opendaylight.yangtools yang-binding diff --git a/bgp/rib-mock/pom.xml b/bgp/rib-mock/pom.xml index 283be4ad40..7964681802 100644 --- a/bgp/rib-mock/pom.xml +++ b/bgp/rib-mock/pom.xml @@ -48,11 +48,12 @@ ${project.groupId} - framework + util + - ${project.groupId} - util + org.opendaylight.controller + protocol-framework diff --git a/bgp/testtool/pom.xml b/bgp/testtool/pom.xml index 8028a37e6c..1099de83e1 100644 --- a/bgp/testtool/pom.xml +++ b/bgp/testtool/pom.xml @@ -50,9 +50,10 @@ ${project.groupId} concepts + - ${project.groupId} - framework + org.opendaylight.controller + protocol-framework diff --git a/commons/parent/pom.xml b/commons/parent/pom.xml index 802f44f8df..e6edf4b7f6 100644 --- a/commons/parent/pom.xml +++ b/commons/parent/pom.xml @@ -52,8 +52,9 @@ 2.15 0.5.9-SNAPSHOT - 0.2.3-SNAPSHOT 0.6.0-SNAPSHOT + + 0.2.3-SNAPSHOT 2010.09.24.2-SNAPSHOT 2013.10.21.0-SNAPSHOT @@ -66,11 +67,6 @@ concepts ${project.version} - - ${project.groupId} - framework - ${project.version} - ${project.groupId} util @@ -150,6 +146,18 @@ + + org.opendaylight.controller + protocol-framework + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + protocol-framework + 0.4.0-SNAPSHOT + test-jar + test + org.opendaylight.controller config-api diff --git a/framework/.gitignore b/framework/.gitignore deleted file mode 100644 index fc1d35eb24..0000000000 --- a/framework/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -target -.classpath -.settings diff --git a/framework/.project b/framework/.project deleted file mode 100644 index c01307dbae..0000000000 --- a/framework/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - common-protocol - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/framework/pom.xml b/framework/pom.xml deleted file mode 100644 index 330bb48fdd..0000000000 --- a/framework/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - 4.0.0 - - scm:git:ssh://git.opendaylight.org:29418/bgpcep.git - scm:git:ssh://git.opendaylight.org:29418/bgpcep.git - https://wiki.opendaylight.org/view/BGP_LS_PCEP:Main - HEAD - - - org.opendaylight.bgpcep - commons.parent - 0.3.0-SNAPSHOT - ../commons/parent - - - 3.0.4 - - - framework - Common protocol framework - bundle - ${project.artifactId} - - - - io.netty - netty-buffer - - - io.netty - netty-codec - - - io.netty - netty-common - - - io.netty - netty-transport - - - com.google.guava - guava - - - com.google.code.findbugs - jsr305 - - - org.slf4j - slf4j-api - - - - - org.opendaylight.yangtools - mockito-configuration - - - junit - junit - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.groupId}.${project.artifactId} - - - - - org.apache.maven.plugins - maven-jar-plugin - - - package - - test-jar - - - - - - - diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java b/framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java deleted file mode 100644 index e19bdbacfc..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java +++ /dev/null @@ -1,168 +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.framework; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.ChannelOption; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioServerSocketChannel; -import io.netty.channel.socket.nio.NioSocketChannel; -import io.netty.util.concurrent.DefaultPromise; -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.GlobalEventExecutor; -import io.netty.util.concurrent.Promise; - -import java.io.Closeable; -import java.net.InetSocketAddress; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -/** - * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the - * start method that will handle sockets in different thread. - */ -public abstract class AbstractDispatcher, L extends SessionListener> implements Closeable { - - protected interface PipelineInitializer> { - /** - * Initializes channel by specifying the handlers in its pipeline. Handlers are protocol specific, therefore this - * method needs to be implemented in protocol specific Dispatchers. - * - * @param channel whose pipeline should be defined, also to be passed to {@link SessionNegotiatorFactory} - * @param promise to be passed to {@link SessionNegotiatorFactory} - */ - void initializeChannel(SocketChannel channel, Promise promise); - } - - - private static final Logger LOG = LoggerFactory.getLogger(AbstractDispatcher.class); - - private final EventLoopGroup bossGroup; - - private final EventLoopGroup workerGroup; - - private final EventExecutor executor; - - /** - * Internally creates new instances of NioEventLoopGroup, might deplete system resources and result in Too many open files exception. - * - * @deprecated use {@link AbstractDispatcher#AbstractDispatcher(io.netty.channel.EventLoopGroup, io.netty.channel.EventLoopGroup)} instead. - */ - @Deprecated - protected AbstractDispatcher() { - this(GlobalEventExecutor.INSTANCE, new NioEventLoopGroup(),new NioEventLoopGroup()); - } - - protected AbstractDispatcher(final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) { - this(GlobalEventExecutor.INSTANCE, bossGroup, workerGroup); - } - - protected AbstractDispatcher(final EventExecutor executor, final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) { - this.bossGroup = Preconditions.checkNotNull(bossGroup); - this.workerGroup = Preconditions.checkNotNull(workerGroup); - this.executor = Preconditions.checkNotNull(executor); - } - - - /** - * Creates server. Each server needs factories to pass their instances to client sessions. - * - * @param address address to which the server should be bound - * @param initializer instance of PipelineInitializer used to initialize the channel pipeline - * - * @return ChannelFuture representing the binding process - */ - protected ChannelFuture createServer(final InetSocketAddress address, final PipelineInitializer initializer) { - final ServerBootstrap b = new ServerBootstrap(); - b.group(this.bossGroup, this.workerGroup); - b.channel(NioServerSocketChannel.class); - b.option(ChannelOption.SO_BACKLOG, 128); - b.childHandler(new ChannelInitializer() { - - @Override - protected void initChannel(final SocketChannel ch) { - initializer.initializeChannel(ch, new DefaultPromise(executor)); - } - }); - b.childOption(ChannelOption.SO_KEEPALIVE, true); - - // Bind and start to accept incoming connections. - final ChannelFuture f = b.bind(address); - LOG.debug("Initiated server {} at {}.", f, address); - return f; - - } - - /** - * Creates a client. - * - * @param address remote address - * @param connectStrategy Reconnection strategy to be used when initial connection fails - * - * @return Future representing the connection process. Its result represents the combined success of TCP connection - * as well as session negotiation. - */ - protected Future createClient(final InetSocketAddress address, final ReconnectStrategy strategy, final PipelineInitializer initializer) { - final Bootstrap b = new Bootstrap(); - final ProtocolSessionPromise p = new ProtocolSessionPromise(executor, address, strategy, b); - b.group(this.workerGroup).channel(NioSocketChannel.class).option(ChannelOption.SO_KEEPALIVE, true).handler( - new ChannelInitializer() { - - @Override - protected void initChannel(final SocketChannel ch) { - initializer.initializeChannel(ch, p); - } - }); - p.connect(); - LOG.debug("Client created."); - return p; - } - - /** - * Creates a client. - * - * @param address remote address - * @param connectStrategyFactory Factory for creating reconnection strategy to be used when initial connection fails - * @param reestablishStrategy Reconnection strategy to be used when the already-established session fails - * - * @return Future representing the reconnection task. It will report completion based on reestablishStrategy, e.g. - * success if it indicates no further attempts should be made and failure if it reports an error - */ - protected Future createReconnectingClient(final InetSocketAddress address, final ReconnectStrategyFactory connectStrategyFactory, - final ReconnectStrategy reestablishStrategy, final PipelineInitializer initializer) { - - final ReconnectPromise p = new ReconnectPromise(GlobalEventExecutor.INSTANCE, this, address, connectStrategyFactory, reestablishStrategy, initializer); - p.connect(); - - return p; - - } - - /** - * @deprecated Should only be used with {@link AbstractDispatcher#AbstractDispatcher()} - */ - @Deprecated - @Override - public void close() { - try { - this.workerGroup.shutdownGracefully(); - } finally { - this.bossGroup.shutdownGracefully(); - } - } - -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/AbstractProtocolSession.java b/framework/src/main/java/org/opendaylight/protocol/framework/AbstractProtocolSession.java deleted file mode 100644 index de77907a0a..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/AbstractProtocolSession.java +++ /dev/null @@ -1,52 +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.framework; - -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.SimpleChannelInboundHandler; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class AbstractProtocolSession extends SimpleChannelInboundHandler implements ProtocolSession { - private static final Logger LOG = LoggerFactory.getLogger(AbstractProtocolSession.class); - - /** - * Handles incoming message (parsing, reacting if necessary). - * - * @param msg incoming message - */ - protected abstract void handleMessage(final M msg); - - /** - * Called when reached the end of input stream while reading. - */ - protected abstract void endOfInput(); - - /** - * Called when the session is added to the pipeline. - */ - protected abstract void sessionUp(); - - @Override - public final void channelInactive(final ChannelHandlerContext ctx) { - LOG.debug("Channel {} inactive.", ctx.channel()); - endOfInput(); - } - - @Override - protected final void channelRead0(final ChannelHandlerContext ctx, final Object msg) { - LOG.debug("Message was received: {}", msg); - handleMessage((M) msg); - } - - @Override - public final void handlerAdded(final ChannelHandlerContext ctx) { - sessionUp(); - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java b/framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java deleted file mode 100644 index f34ba5af75..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java +++ /dev/null @@ -1,74 +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.framework; - -import io.netty.channel.Channel; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.util.concurrent.Promise; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -/** - * Abstract base class for session negotiators. It implements the basic - * substrate to implement SessionNegotiator API specification, with subclasses - * needing to provide only - * - * @param Protocol message type - * @param Protocol session type, has to extend ProtocolSession - */ -public abstract class AbstractSessionNegotiator> extends ChannelInboundHandlerAdapter implements SessionNegotiator { - private final Logger logger = LoggerFactory.getLogger(AbstractSessionNegotiator.class); - private final Promise promise; - protected final Channel channel; - - public AbstractSessionNegotiator(final Promise promise, final Channel channel) { - this.promise = Preconditions.checkNotNull(promise); - this.channel = Preconditions.checkNotNull(channel); - } - - protected abstract void startNegotiation() throws Exception; - protected abstract void handleMessage(M msg) throws Exception; - - protected final void negotiationSuccessful(final S session) { - logger.debug("Negotiation on channel {} successful with session {}", channel, session); - channel.pipeline().replace(this, "session", session); - promise.setSuccess(session); - } - - protected final void negotiationFailed(final Throwable cause) { - logger.debug("Negotiation on channel {} failed", channel, cause); - channel.close(); - promise.setFailure(cause); - } - - @Override - public final void channelActive(final ChannelHandlerContext ctx) { - logger.debug("Starting session negotiation on channel {}", channel); - try { - startNegotiation(); - } catch (Exception e) { - logger.info("Unexpected negotiation failure", e); - negotiationFailed(e); - } - } - - @Override - public final void channelRead(final ChannelHandlerContext ctx, final Object msg) { - logger.debug("Negotiation read invoked on channel {}", channel); - try { - handleMessage((M)msg); - } catch (Exception e) { - logger.debug("Unexpected exception during negotiation", e); - negotiationFailed(e); - } - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java b/framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java deleted file mode 100644 index ab283d2baa..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java +++ /dev/null @@ -1,37 +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.framework; - -/** - * Used when something occurs during parsing bytes to java objects. - * - * @deprecated This exception no longer carries any special meaning. Users - * are advised to stop using it and define their own replacement. - */ -@Deprecated -public class DeserializerException extends Exception { - - private static final long serialVersionUID = -2247000673438452870L; - - /** - * Creates a deserializer exception. - * @param err string - */ - public DeserializerException(final String err) { - super(err); - } - - /** - * Creates a deserializer exception. - * @param err string - * @param e underlying exception - */ - public DeserializerException(final String err, final Throwable e) { - super(err, e); - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java b/framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java deleted file mode 100644 index c56ccf615c..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java +++ /dev/null @@ -1,40 +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.framework; - -/** - * Documented exception occurrs when an error is thrown that is documented - * in any RFC or draft for the specific protocol. - * - * @deprecated This exception no longer carries any special meaning. Users - * are advised to stop using it and define their own replacement. - */ -@Deprecated -public class DocumentedException extends Exception { - - private static final long serialVersionUID = -3727963789710833704L; - - /** - * Creates a documented exception - * @param message string - */ - public DocumentedException(final String message) { - super(message); - } - - /** - * Creates a documented exception - * @param err string - * @param cause the cause (which is saved for later retrieval by the - * Throwable.getCause() method). (A null value is permitted, and indicates - * that the cause is nonexistent or unknown.) - */ - public DocumentedException(final String err, final Exception cause) { - super(err, cause); - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/NeverReconnectStrategy.java b/framework/src/main/java/org/opendaylight/protocol/framework/NeverReconnectStrategy.java deleted file mode 100644 index 35dcc3f569..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/NeverReconnectStrategy.java +++ /dev/null @@ -1,46 +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.framework; - -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; - -import javax.annotation.concurrent.ThreadSafe; - -import com.google.common.base.Preconditions; - -/** - * Utility ReconnectStrategy singleton, which will cause the reconnect process - * to always fail. - */ -@ThreadSafe -public final class NeverReconnectStrategy implements ReconnectStrategy { - private final EventExecutor executor; - private final int timeout; - - public NeverReconnectStrategy(final EventExecutor executor, final int timeout) { - Preconditions.checkArgument(timeout >= 0); - this.executor = Preconditions.checkNotNull(executor); - this.timeout = timeout; - } - - @Override - public Future scheduleReconnect(final Throwable cause) { - return executor.newFailedFuture(new Throwable()); - } - - @Override - public void reconnectSuccessful() { - // Nothing to do - } - - @Override - public int getConnectTimeout() { - return timeout; - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java b/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java deleted file mode 100644 index ca3894af0b..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java +++ /dev/null @@ -1,36 +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.framework; - -import io.netty.channel.ChannelHandler; - -import com.google.common.base.Preconditions; - -/** - * @deprecated This is an adaptor class for turning ProtocolMessageFactory into - * Netty encoder/decoder. Use Netty-provided classes directly, by subclassing - * {@link io.netty.handler.codec.ByteToMessageDecoder} or similar instead. - */ -@Deprecated -public class ProtocolHandlerFactory { - private final ProtocolMessageEncoder encoder; - protected final ProtocolMessageFactory msgFactory; - - public ProtocolHandlerFactory(final ProtocolMessageFactory msgFactory) { - this.msgFactory = Preconditions.checkNotNull(msgFactory); - this.encoder = new ProtocolMessageEncoder(msgFactory); - } - - public ChannelHandler[] getEncoders() { - return new ChannelHandler[] { this.encoder }; - } - - public ChannelHandler[] getDecoders() { - return new ChannelHandler[] { new ProtocolMessageDecoder(this.msgFactory) }; - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java b/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java deleted file mode 100644 index e609ceab88..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java +++ /dev/null @@ -1,55 +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.framework; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -/** - * @deprecated This is an adaptor class for turning ProtocolMessageFactory into Netty decoder. Use Netty-provided - * classes directly, by subclassing {@link io.netty.handler.codec.ByteToMessageDecoder} or similar instead. - */ -@Deprecated -public final class ProtocolMessageDecoder extends ByteToMessageDecoder { - - private static final Logger LOG = LoggerFactory.getLogger(ProtocolMessageDecoder.class); - - private final ProtocolMessageFactory factory; - - public ProtocolMessageDecoder(final ProtocolMessageFactory factory) { - this.factory = Preconditions.checkNotNull(factory); - } - - @Override - protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List out) throws Exception { - if (in.readableBytes() == 0) { - LOG.debug("No more content in incoming buffer."); - return; - } - in.markReaderIndex(); - try { - LOG.trace("Received to decode: {}", ByteBufUtil.hexDump(in)); - final byte[] bytes = new byte[in.readableBytes()]; - in.readBytes(bytes); - out.add(this.factory.parse(bytes)); - } catch (DeserializerException | DocumentedException e) { - LOG.debug("Failed to decode protocol message", e); - this.exceptionCaught(ctx, e); - } - in.discardReadBytes(); - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java b/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java deleted file mode 100644 index 65894fa2d1..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java +++ /dev/null @@ -1,40 +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.framework; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandler.Sharable; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @deprecated This is an adaptor class for turning ProtocolMessageFactory into Netty encoder. Use Netty-provided - * classes directly, by subclassing {@link io.netty.handler.codec.MessageToByteDecoder} or similar instead. - */ -@Deprecated -@Sharable -public final class ProtocolMessageEncoder extends MessageToByteEncoder { - - private static final Logger LOG = LoggerFactory.getLogger(ProtocolMessageEncoder.class); - - private final ProtocolMessageFactory factory; - - public ProtocolMessageEncoder(final ProtocolMessageFactory factory) { - this.factory = factory; - } - - @Override - protected void encode(final ChannelHandlerContext ctx, final Object msg, final ByteBuf out) throws Exception { - LOG.debug("Sent to encode : {}", msg); - final byte[] bytes = this.factory.put((T) msg); - out.writeBytes(bytes); - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java b/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java deleted file mode 100644 index b24ab01774..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java +++ /dev/null @@ -1,41 +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.framework; - - -/** - * Interface for factory for parsing and serializing protocol specific messages. Needs to be implemented by a protocol - * specific message factory. The methods put/parse should delegate parsing to specific message parsers, e.g. - * OpenMessageParser etc. - * - * @param type of messages created by this factory - * - * @deprecated Interact with Netty 4.0 directly, by subclassing {@link io.netty.handler.codec.ByteToMessageCodec} or - * similar. - */ -@Deprecated -public interface ProtocolMessageFactory { - - /** - * Parses message from byte array. Requires specific protocol message header object to parse the header. - * - * @param bytes byte array from which the message will be parsed - * @return List of specific protocol messages - * @throws DeserializerException if some parsing error occurs - * @throws DocumentedException if some documented error occurs - */ - T parse(byte[] bytes) throws DeserializerException, DocumentedException; - - /** - * Serializes protocol specific message to byte array. - * - * @param msg message to be serialized. - * @return byte array resulting message - */ - byte[] put(T msg); -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSession.java b/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSession.java deleted file mode 100644 index 0e45f8a1ab..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSession.java +++ /dev/null @@ -1,23 +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.framework; - -import java.io.Closeable; - -/** - * Protocol Session represents the finite state machine in underlying protocol, including timers and its purpose is to - * create a connection between server and client. Session is automatically started, when TCP connection is created, but - * can be stopped manually. If the session is up, it has to redirect messages to/from user. Handles also malformed - * messages and unknown requests. - * - * This interface should be implemented by a final class representing a protocol specific session. - */ -public interface ProtocolSession extends Closeable { - @Override - void close(); -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java b/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java deleted file mode 100644 index 7066998296..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java +++ /dev/null @@ -1,142 +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.framework; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelOption; -import io.netty.util.concurrent.DefaultPromise; -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.FutureListener; -import io.netty.util.concurrent.Promise; - -import java.net.InetSocketAddress; - -import javax.annotation.concurrent.GuardedBy; -import javax.annotation.concurrent.ThreadSafe; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -@ThreadSafe -final class ProtocolSessionPromise> extends DefaultPromise { - private static final Logger LOG = LoggerFactory.getLogger(ProtocolSessionPromise.class); - private final ReconnectStrategy strategy; - private final InetSocketAddress address; - private final Bootstrap b; - - @GuardedBy("this") - private Future pending; - - ProtocolSessionPromise(final EventExecutor executor, final InetSocketAddress address, final ReconnectStrategy strategy, - final Bootstrap b) { - super(executor); - this.strategy = Preconditions.checkNotNull(strategy); - this.address = Preconditions.checkNotNull(address); - this.b = Preconditions.checkNotNull(b); - } - - synchronized void connect() { - final Object lock = this; - - try { - final int timeout = this.strategy.getConnectTimeout(); - - LOG.debug("Promise {} attempting connect for {}ms", lock, timeout); - - this.b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, timeout); - this.pending = this.b.connect(this.address).addListener(new ChannelFutureListener() { - @Override - public void operationComplete(final ChannelFuture cf) throws Exception { - synchronized (lock) { - - LOG.debug("Promise {} connection resolved", lock); - - // Triggered when a connection attempt is resolved. - Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(cf)); - - /* - * The promise we gave out could have been cancelled, - * which cascades to the connect getting cancelled, - * but there is a slight race window, where the connect - * is already resolved, but the listener has not yet - * been notified -- cancellation at that point won't - * stop the notification arriving, so we have to close - * the race here. - */ - if (isCancelled()) { - if (cf.isSuccess()) { - LOG.debug("Closing channel for cancelled promise {}", lock); - cf.channel().close(); - } - return; - } - - if (!cf.isSuccess()) { - LOG.info("Attempt to connect to connect to {} failed", ProtocolSessionPromise.this.address, cf.cause()); - final Future rf = ProtocolSessionPromise.this.strategy.scheduleReconnect(cf.cause()); - rf.addListener(new FutureListener() { - @Override - public void operationComplete(final Future sf) { - synchronized (lock) { - // Triggered when a connection attempt is to be made. - Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(sf)); - - /* - * The promise we gave out could have been cancelled, - * which cascades to the reconnect attempt getting - * cancelled, but there is a slight race window, where - * the reconnect attempt is already enqueued, but the - * listener has not yet been notified -- if cancellation - * happens at that point, we need to catch it here. - */ - if (!isCancelled()) { - if (sf.isSuccess()) { - connect(); - } else { - setFailure(sf.cause()); - } - } - } - } - }); - - ProtocolSessionPromise.this.pending = rf; - } else { - LOG.debug("Promise {} connection successful", lock); - } - } - } - }); - } catch (final Exception e) { - LOG.info("Failed to connect to {}", e); - setFailure(e); - } - } - - @Override - public synchronized boolean cancel(final boolean mayInterruptIfRunning) { - if (super.cancel(mayInterruptIfRunning)) { - this.pending.cancel(mayInterruptIfRunning); - return true; - } - - return false; - } - - @Override - public synchronized Promise setSuccess(final S result) { - LOG.debug("Promise {} completed", this); - this.strategy.reconnectSuccessful(); - return super.setSuccess(result); - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectImmediatelyStrategy.java b/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectImmediatelyStrategy.java deleted file mode 100644 index a12dcb283d..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectImmediatelyStrategy.java +++ /dev/null @@ -1,51 +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.framework; - -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; - -import javax.annotation.concurrent.ThreadSafe; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -/** - * Utility ReconnectStrategy singleton, which will cause the reconnect process - * to immediately schedule a reconnection attempt. - */ -@ThreadSafe -public final class ReconnectImmediatelyStrategy implements ReconnectStrategy { - private static final Logger LOG = LoggerFactory.getLogger(ReconnectImmediatelyStrategy.class); - private final EventExecutor executor; - private final int timeout; - - public ReconnectImmediatelyStrategy(final EventExecutor executor, final int timeout) { - Preconditions.checkArgument(timeout >= 0); - this.executor = Preconditions.checkNotNull(executor); - this.timeout = timeout; - } - - @Override - public Future scheduleReconnect(final Throwable cause) { - LOG.debug("Connection attempt failed", cause); - return executor.newSucceededFuture(null); - } - - @Override - public void reconnectSuccessful() { - // Nothing to do - } - - @Override - public int getConnectTimeout() { - return timeout; - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java b/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java deleted file mode 100644 index 869dc1afc1..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java +++ /dev/null @@ -1,182 +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.framework; - -import io.netty.channel.ChannelFuture; -import io.netty.channel.socket.SocketChannel; -import io.netty.util.concurrent.DefaultPromise; -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.FutureListener; -import io.netty.util.concurrent.Promise; - -import java.io.Closeable; -import java.net.InetSocketAddress; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.opendaylight.protocol.framework.AbstractDispatcher.PipelineInitializer; - -import com.google.common.base.Preconditions; - -final class ReconnectPromise, L extends SessionListener> extends DefaultPromise { - private final AbstractDispatcher dispatcher; - private final InetSocketAddress address; - private final ReconnectStrategyFactory strategyFactory; - private final ReconnectStrategy strategy; - private final PipelineInitializer initializer; - private Future pending; - - private final AtomicBoolean negotiationFinished = new AtomicBoolean(false); - - public ReconnectPromise(final EventExecutor executor, final AbstractDispatcher dispatcher, final InetSocketAddress address, - final ReconnectStrategyFactory connectStrategyFactory, final ReconnectStrategy reestablishStrategy, - final PipelineInitializer initializer) { - super(executor); - this.dispatcher = Preconditions.checkNotNull(dispatcher); - this.address = Preconditions.checkNotNull(address); - this.strategyFactory = Preconditions.checkNotNull(connectStrategyFactory); - this.strategy = Preconditions.checkNotNull(reestablishStrategy); - this.initializer = Preconditions.checkNotNull(initializer); - } - - // FIXME: BUG-190: refactor - - synchronized void connect() { - negotiationFinished.set(false); - - final ReconnectStrategy cs = this.strategyFactory.createReconnectStrategy(); - final ReconnectStrategy rs = new ReconnectStrategy() { - @Override - public Future scheduleReconnect(final Throwable cause) { - return cs.scheduleReconnect(cause); - } - - @Override - public void reconnectSuccessful() { - cs.reconnectSuccessful(); - } - - @Override - public int getConnectTimeout() throws Exception { - final int cst = cs.getConnectTimeout(); - final int rst = ReconnectPromise.this.strategy.getConnectTimeout(); - - if (cst == 0) { - return rst; - } - if (rst == 0) { - return cst; - } - return Math.min(cst, rst); - } - }; - - final Future cf = this.dispatcher.createClient(this.address, rs, new PipelineInitializer() { - @Override - public void initializeChannel(final SocketChannel channel, final Promise promise) { - addChannelClosedListener(channel.closeFuture()); - initializer.initializeChannel(channel, promise); - } - }); - - final Object lock = this; - this.pending = cf; - - cf.addListener(new FutureListener() { - - @Override - public void operationComplete(final Future future) { - synchronized (lock) { - if (!future.isSuccess()) { - final Future rf = ReconnectPromise.this.strategy.scheduleReconnect(cf.cause()); - - if(rf == null) { - // This should reflect: no more reconnecting strategies, enough - // Currently all reconnect strategies fail with exception, should return null - return; - } - - ReconnectPromise.this.pending = rf; - - rf.addListener(new FutureListener() { - @Override - public void operationComplete(final Future sf) { - synchronized (lock) { - /* - * The promise we gave out could have been cancelled, - * which cascades to the reconnect attempt getting - * cancelled, but there is a slight race window, where - * the reconnect attempt is already enqueued, but the - * listener has not yet been notified -- if cancellation - * happens at that point, we need to catch it here. - */ - if (!isCancelled()) { - if (sf.isSuccess()) { - connect(); - } else { - setFailure(sf.cause()); - } - } - } - } - }); - } else { - /* - * FIXME: BUG-190: we have a slight race window with cancellation - * here. Analyze and define its semantics. - */ - ReconnectPromise.this.strategy.reconnectSuccessful(); - negotiationFinished.set(true); - } - } - } - }); - } - - private final ClosedChannelListener closedChannelListener = new ClosedChannelListener(); - - class ClosedChannelListener implements Closeable, FutureListener { - - private final AtomicBoolean stop = new AtomicBoolean(false); - - @Override - public void operationComplete(final Future future) throws Exception { - if (stop.get()) { - return; - } - - // Start reconnecting crashed session after negotiation was successful - if (!negotiationFinished.get()) { - return; - } - - connect(); - } - - @Override - public void close() { - this.stop.set(true); - } - } - - private void addChannelClosedListener(final ChannelFuture channelFuture) { - channelFuture.addListener(closedChannelListener); - } - - @Override - public synchronized boolean cancel(final boolean mayInterruptIfRunning) { - closedChannelListener.close(); - - if (super.cancel(mayInterruptIfRunning)) { - this.pending.cancel(mayInterruptIfRunning); - return true; - } - - return false; - } -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategy.java b/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategy.java deleted file mode 100644 index b1de4f6943..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategy.java +++ /dev/null @@ -1,53 +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.framework; - -import io.netty.util.concurrent.Future; - -/** - * Interface exposed by a reconnection strategy provider. A reconnection - * strategy decides whether to attempt reconnection and when to do that. - * - * The proper way of using this API is such that when a connection attempt - * has failed, the user will call scheduleReconnect() to obtain a future, - * which tracks schedule of the next connect attempt. The user should add its - * own listener to be get notified when the future is done. Once the - * the notification fires, user should examine the future to see whether - * it is successful or not. If it is successful, the user should immediately - * initiate a connection attempt. If it is unsuccessful, the user must - * not attempt any more connection attempts and should abort the reconnection - * process. - */ -public interface ReconnectStrategy { - /** - * Query the strategy for the connect timeout. - * - * @return connect try timeout in milliseconds, or - * 0 for infinite (or system-default) timeout - * @throws Exception if the connection should not be attempted - */ - int getConnectTimeout() throws Exception; - - /** - * Schedule a connection attempt. The precise time when the connection - * should be attempted is signaled by successful completion of returned - * future. - * - * @param cause Cause of previous failure - * @return a future tracking the schedule, may not be null - * @throws IllegalStateException when a connection attempt is currently - * scheduled. - */ - Future scheduleReconnect(Throwable cause); - - /** - * Reset the strategy state. Users call this method once the reconnection - * process succeeds. - */ - void reconnectSuccessful(); -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategyFactory.java b/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategyFactory.java deleted file mode 100644 index bafd3ac480..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategyFactory.java +++ /dev/null @@ -1,23 +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.framework; - -/** - * Factory interface for creating new ReconnectStrategy instances. This is - * primarily useful for allowing injection of a specific type of strategy for - * on-demand use, pretty much like you would use a ThreadFactory. - */ -public interface ReconnectStrategyFactory { - /** - * Create a new ReconnectStrategy. - * - * @return a new reconnecty strategy - */ - ReconnectStrategy createReconnectStrategy(); -} - diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/SessionListener.java b/framework/src/main/java/org/opendaylight/protocol/framework/SessionListener.java deleted file mode 100644 index 2ba0ae5933..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/SessionListener.java +++ /dev/null @@ -1,48 +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.framework; - -import java.util.EventListener; - -/** - * Listener that receives session state informations. This interface should be - * implemented by a protocol specific abstract class, that is extended by - * a final class that implements the methods. - */ -public interface SessionListener, T extends TerminationReason> extends EventListener { - /** - * Fired when the session was established successfully. - * - * @param remoteParams Peer address families which we accepted - */ - void onSessionUp(S session); - - /** - * Fired when the session went down because of an IO error. Implementation should take care of closing underlying - * session. - * - * @param session that went down - * @param e Exception that was thrown as the cause of session being down - */ - void onSessionDown(S session, Exception e); - - /** - * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state. - * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session. - * - * @param reason the cause why the session went down - */ - void onSessionTerminated(S session, T reason); - - /** - * Fired when a normal protocol message is received. - * - * @param message Protocol message - */ - void onMessage(S session, M message); -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/SessionListenerFactory.java b/framework/src/main/java/org/opendaylight/protocol/framework/SessionListenerFactory.java deleted file mode 100644 index 56f887ea5a..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/SessionListenerFactory.java +++ /dev/null @@ -1,22 +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.framework; - - -/** - * Factory for generating Session Listeners. Used by a server. This interface should be - * implemented by a protocol specific abstract class, that is extended by - * a final class that implements the methods. - */ -public interface SessionListenerFactory> { - /** - * Returns one session listener - * @return specific session listener - */ - T getSessionListener(); -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiator.java b/framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiator.java deleted file mode 100644 index 3de64b07ff..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiator.java +++ /dev/null @@ -1,22 +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.framework; - -import io.netty.channel.ChannelInboundHandler; - -/** - * Session negotiator concepts. A negotiator is responsible for message - * handling while the exact session parameters are not known. Once the - * session parameters are finalized, the negotiator replaces itself in - * the channel pipeline with the session. - * - * @param Protocol session type. - */ -public interface SessionNegotiator> extends ChannelInboundHandler { - -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiatorFactory.java b/framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiatorFactory.java deleted file mode 100644 index 58a9e472d9..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiatorFactory.java +++ /dev/null @@ -1,28 +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.framework; - -import io.netty.channel.Channel; -import io.netty.util.concurrent.Promise; - -/** - * A factory class creating SessionNegotiators. - * - * @param session type - */ -public interface SessionNegotiatorFactory, L extends SessionListener> { - /** - * Create a new negotiator attached to a channel, which will notify - * a promise once the negotiation completes. - * - * @param channel Underlying channel - * @param promise Promise to be notified - * @return new negotiator instance - */ - SessionNegotiator getSessionNegotiator(SessionListenerFactory factory, Channel channel, Promise promise); -} diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/TerminationReason.java b/framework/src/main/java/org/opendaylight/protocol/framework/TerminationReason.java deleted file mode 100644 index 42a524c4ec..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/TerminationReason.java +++ /dev/null @@ -1,21 +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.framework; - -/** - * Marker interface for grouping session termination cause. - */ -public interface TerminationReason { - - /** - * Get cause of session termination. - * @return human-readable cause. - */ - String getErrorMessage(); -} - diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java b/framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java deleted file mode 100644 index 2903c8374a..0000000000 --- a/framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java +++ /dev/null @@ -1,183 +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.framework; - -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; - -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import javax.annotation.concurrent.GuardedBy; -import javax.annotation.concurrent.ThreadSafe; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -/** - * Swiss army knife equivalent for reconnect strategies. - * - * This strategy continues to schedule reconnect attempts, each having to complete in a fixed time (connectTime). - * - * Initial sleep time is specified as minSleep. Each subsequent unsuccessful attempt multiplies this time by a constant - * factor (sleepFactor) -- this allows for either constant reconnect times (sleepFactor = 1), or various degrees of - * exponential back-off (sleepFactor > 1). Maximum sleep time between attempts can be capped to a specific value - * (maxSleep). - * - * The strategy can optionally give up based on two criteria: - * - * A preset number of connection retries (maxAttempts) has been reached, or - * - * A preset absolute deadline is reached (deadline nanoseconds, as reported by System.nanoTime(). In this specific case, - * both connectTime and maxSleep will be controlled such that the connection attempt is resolved as closely to the - * deadline as possible. - * - * Both these caps can be combined, with the strategy giving up as soon as the first one is reached. - */ -@ThreadSafe -public final class TimedReconnectStrategy implements ReconnectStrategy { - private static final Logger LOG = LoggerFactory.getLogger(TimedReconnectStrategy.class); - private final EventExecutor executor; - private final Long deadline, maxAttempts, maxSleep; - private final double sleepFactor; - private final int connectTime; - private final long minSleep; - - @GuardedBy("this") - private long attempts; - - @GuardedBy("this") - private long lastSleep; - - @GuardedBy("this") - private boolean scheduled; - - public TimedReconnectStrategy(final EventExecutor executor, final int connectTime, final long minSleep, final double sleepFactor, - final Long maxSleep, final Long maxAttempts, final Long deadline) { - Preconditions.checkArgument(maxSleep == null || minSleep <= maxSleep); - Preconditions.checkArgument(sleepFactor >= 1); - Preconditions.checkArgument(connectTime >= 0); - this.executor = Preconditions.checkNotNull(executor); - this.deadline = deadline; - this.maxAttempts = maxAttempts; - this.minSleep = minSleep; - this.maxSleep = maxSleep; - this.sleepFactor = sleepFactor; - this.connectTime = connectTime; - } - - @Override - public synchronized Future scheduleReconnect(final Throwable cause) { - LOG.debug("Connection attempt failed", cause); - - // Check if a reconnect attempt is scheduled - Preconditions.checkState(!this.scheduled); - - // Get a stable 'now' time for deadline calculations - final long now = System.nanoTime(); - - // Obvious stop conditions - if (this.maxAttempts != null && this.attempts >= this.maxAttempts) { - return this.executor.newFailedFuture(new Throwable("Maximum reconnection attempts reached")); - } - if (this.deadline != null && this.deadline <= now) { - return this.executor.newFailedFuture(new TimeoutException("Reconnect deadline reached")); - } - - /* - * First connection attempt gets initialized to minimum sleep, - * each subsequent is exponentially backed off by sleepFactor. - */ - if (this.attempts != 0) { - this.lastSleep *= this.sleepFactor; - } else { - this.lastSleep = this.minSleep; - } - - // Cap the sleep time to maxSleep - if (this.maxSleep != null && this.lastSleep > this.maxSleep) { - LOG.debug("Capped sleep time from {} to {}", this.lastSleep, this.maxSleep); - this.lastSleep = this.maxSleep; - } - - this.attempts++; - - // Check if the reconnect attempt is within the deadline - if (this.deadline != null && this.deadline <= now + TimeUnit.MILLISECONDS.toNanos(this.lastSleep)) { - return this.executor.newFailedFuture(new TimeoutException("Next reconnect would happen after deadline")); - } - - LOG.debug("Connection attempt {} sleeping for {} milliseconds", this.attempts, this.lastSleep); - - // If we are not sleeping at all, return an already-succeeded future - if (this.lastSleep == 0) { - return this.executor.newSucceededFuture(null); - } - - // Need to retain a final reference to this for locking purposes, - // also set the scheduled flag. - final Object lock = this; - this.scheduled = true; - - // Schedule a task for the right time. It will also clear the flag. - return this.executor.schedule(new Callable() { - @Override - public Void call() throws TimeoutException { - synchronized (lock) { - Preconditions.checkState(TimedReconnectStrategy.this.scheduled); - TimedReconnectStrategy.this.scheduled = false; - } - - return null; - } - }, this.lastSleep, TimeUnit.MILLISECONDS); - } - - @Override - public synchronized void reconnectSuccessful() { - Preconditions.checkState(!this.scheduled); - this.attempts = 0; - } - - @Override - public int getConnectTimeout() throws TimeoutException { - int timeout = this.connectTime; - - if (this.deadline != null) { - - // If there is a deadline, we may need to cap the connect - // timeout to meet the deadline. - final long now = System.nanoTime(); - if (now >= this.deadline) { - throw new TimeoutException("Reconnect deadline already passed"); - } - - final long left = TimeUnit.NANOSECONDS.toMillis(this.deadline - now); - if (left < 1) { - throw new TimeoutException("Connect timeout too close to deadline"); - } - - /* - * A bit of magic: - * - if time left is less than the timeout, set it directly - * - if there is no timeout, and time left is: - * - less than maximum integer, set timeout to time left - * - more than maximum integer, set timeout Integer.MAX_VALUE - */ - if (timeout > left) { - timeout = (int) left; - } else if (timeout == 0) { - timeout = left <= Integer.MAX_VALUE ? (int) left : Integer.MAX_VALUE; - } - } - return timeout; - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java b/framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java deleted file mode 100644 index ad47adb0b4..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java +++ /dev/null @@ -1,24 +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.framework; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -@Deprecated -public class ComplementaryTest { - - @Test - public void testExceptions() { - final DeserializerException de = new DeserializerException("some error"); - final DocumentedException ee = new DocumentedException("some error"); - - assertEquals(de.getMessage(), ee.getMessage()); - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java b/framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java deleted file mode 100644 index cb6c93e224..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java +++ /dev/null @@ -1,151 +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.framework; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.util.concurrent.DefaultPromise; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.GlobalEventExecutor; -import io.netty.util.concurrent.Promise; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class ServerTest { - SimpleDispatcher clientDispatcher, dispatcher; - - final SimpleSessionListener pce = new SimpleSessionListener(); - - SimpleSession session = null; - - ChannelFuture server = null; - - InetSocketAddress serverAddress; - private NioEventLoopGroup eventLoopGroup; - - - @Before - public void setUp() { - final int port = 10000 + (int)(10000 * Math.random()); - serverAddress = new InetSocketAddress("127.0.0.1", port); - eventLoopGroup = new NioEventLoopGroup(); - } - - @Test - public void testConnectionEstablished() throws Exception { - final Promise p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE); - - this.dispatcher = new SimpleDispatcher(new SessionNegotiatorFactory() { - - @Override - public SessionNegotiator getSessionNegotiator(final SessionListenerFactory factory, - final Channel channel, final Promise promise) { - p.setSuccess(true); - return new SimpleSessionNegotiator(promise, channel); - } - }, new DefaultPromise(GlobalEventExecutor.INSTANCE), eventLoopGroup); - - this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory() { - @Override - public SimpleSessionListener getSessionListener() { - return new SimpleSessionListener(); - } - }); - - this.server.get(); - - this.clientDispatcher = new SimpleDispatcher(new SessionNegotiatorFactory() { - @Override - public SessionNegotiator getSessionNegotiator(final SessionListenerFactory factory, - final Channel channel, final Promise promise) { - return new SimpleSessionNegotiator(promise, channel); - } - }, new DefaultPromise(GlobalEventExecutor.INSTANCE), eventLoopGroup); - - this.session = this.clientDispatcher.createClient(this.serverAddress, - new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 5000), new SessionListenerFactory() { - @Override - public SimpleSessionListener getSessionListener() { - return new SimpleSessionListener(); - } - }).get(6, TimeUnit.SECONDS); - - assertEquals(true, p.get(3, TimeUnit.SECONDS)); - } - - @Test - public void testConnectionFailed() throws IOException, InterruptedException, ExecutionException, TimeoutException { - final Promise p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE); - - this.dispatcher = new SimpleDispatcher(new SessionNegotiatorFactory() { - - @Override - public SessionNegotiator getSessionNegotiator(final SessionListenerFactory factory, - final Channel channel, final Promise promise) { - p.setSuccess(true); - return new SimpleSessionNegotiator(promise, channel); - } - }, new DefaultPromise(GlobalEventExecutor.INSTANCE), eventLoopGroup); - - this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory() { - @Override - public SimpleSessionListener getSessionListener() { - return new SimpleSessionListener(); - } - }); - - this.server.get(); - - this.clientDispatcher = new SimpleDispatcher(new SessionNegotiatorFactory() { - @Override - public SessionNegotiator getSessionNegotiator(final SessionListenerFactory factory, - final Channel channel, final Promise promise) { - return new SimpleSessionNegotiator(promise, channel); - } - }, new DefaultPromise(GlobalEventExecutor.INSTANCE), eventLoopGroup); - - this.session = this.clientDispatcher.createClient(this.serverAddress, - new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 5000), new SessionListenerFactory() { - @Override - public SimpleSessionListener getSessionListener() { - return new SimpleSessionListener(); - } - }).get(6, TimeUnit.SECONDS); - - final Future session = this.clientDispatcher.createClient(this.serverAddress, - new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 5000), new SessionListenerFactory() { - @Override - public SimpleSessionListener getSessionListener() { - return new SimpleSessionListener(); - } - }); - assertFalse(session.isSuccess()); - } - - @After - public void tearDown() throws IOException, InterruptedException { - this.server.channel().close(); - this.eventLoopGroup.shutdownGracefully(); - try { - Thread.sleep(500); - } catch (final InterruptedException e) { - throw new RuntimeException(e); - } - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/Session.java b/framework/src/test/java/org/opendaylight/protocol/framework/Session.java deleted file mode 100644 index f2266d77b0..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/Session.java +++ /dev/null @@ -1,47 +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.framework; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.Lists; - -public class Session extends AbstractProtocolSession { - - private static final Logger logger = LoggerFactory.getLogger(Session.class); - - public final List msgs = Lists.newArrayList(); - - public boolean up = false; - - @Override - public void close() { - - } - - @Override - public void handleMessage(final SimpleMessage msg) { - logger.debug("Message received: {}", msg.getMessage()); - this.up = true; - this.msgs.add(msg); - logger.debug(this.msgs.size() + ""); - } - - @Override - public void endOfInput() { - logger.debug("End of input reported."); - } - - @Override - protected void sessionUp() { - logger.debug("Session up reported."); - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleByteToMessageDecoder.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleByteToMessageDecoder.java deleted file mode 100644 index 59452d7afc..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleByteToMessageDecoder.java +++ /dev/null @@ -1,26 +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.framework; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -import com.google.common.base.Charsets; - -/** - * - */ -public class SimpleByteToMessageDecoder extends ByteToMessageDecoder { - @Override - protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List out) { - out.add(new SimpleMessage(Charsets.UTF_8.decode(in.nioBuffer()).toString())); - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java deleted file mode 100644 index c4720c7a4c..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java +++ /dev/null @@ -1,64 +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.framework; - -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.Promise; - -import java.net.InetSocketAddress; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -public class SimpleDispatcher extends AbstractDispatcher { - private static final Logger logger = LoggerFactory.getLogger(SimpleDispatcher.class); - - private final SessionNegotiatorFactory negotiatorFactory; - private final ChannelOutboundHandler encoder = new SimpleMessageToByteEncoder(); - - private final class SimplePipelineInitializer implements PipelineInitializer { - final SessionListenerFactory listenerFactory; - - SimplePipelineInitializer(final SessionListenerFactory listenerFactory) { - this.listenerFactory = Preconditions.checkNotNull(listenerFactory); - } - - @Override - public void initializeChannel(final SocketChannel channel, final Promise promise) { - channel.pipeline().addLast(new SimpleByteToMessageDecoder()); - channel.pipeline().addLast("negotiator", negotiatorFactory.getSessionNegotiator(listenerFactory, channel, promise)); - channel.pipeline().addLast(encoder); - logger.debug("initialization completed for channel {}", channel); - } - - } - - public SimpleDispatcher(final SessionNegotiatorFactory negotiatorFactory, - final Promise promise, final EventLoopGroup eventLoopGroup) { - super(eventLoopGroup, eventLoopGroup); - this.negotiatorFactory = Preconditions.checkNotNull(negotiatorFactory); - } - - public Future createClient(final InetSocketAddress address, final ReconnectStrategy strategy, final SessionListenerFactory listenerFactory) { - return super.createClient(address, strategy, new SimplePipelineInitializer(listenerFactory)); - } - - public ChannelFuture createServer(final InetSocketAddress address, final SessionListenerFactory listenerFactory) { - return super.createServer(address, new SimplePipelineInitializer(listenerFactory)); - } - - @Override - public void close() { - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessage.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessage.java deleted file mode 100644 index 1ca7c8b49c..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessage.java +++ /dev/null @@ -1,21 +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.framework; - -public class SimpleMessage { - - private final String s; - - public SimpleMessage(final String s) { - this.s = s; - } - - public String getMessage() { - return this.s; - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessageToByteEncoder.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessageToByteEncoder.java deleted file mode 100644 index 5b7ee504e3..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleMessageToByteEncoder.java +++ /dev/null @@ -1,24 +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.framework; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandler.Sharable; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; - -/** - * - */ -@Sharable -public class SimpleMessageToByteEncoder extends MessageToByteEncoder { - @Override - protected void encode(final ChannelHandlerContext ctx, final SimpleMessage msg, final ByteBuf out) { - out.writeBytes(msg.getMessage().getBytes()); - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSession.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSession.java deleted file mode 100644 index d085be8e70..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSession.java +++ /dev/null @@ -1,30 +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.framework; - -public final class SimpleSession extends AbstractProtocolSession { - - public SimpleSession() { - } - - @Override - public void close() { - } - - @Override - public void handleMessage(final SimpleMessage msg) { - } - - @Override - public void endOfInput() { - } - - @Override - protected void sessionUp() { - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListener.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListener.java deleted file mode 100644 index 722c663477..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListener.java +++ /dev/null @@ -1,50 +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.framework; - -import java.util.ArrayList; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Simple Session Listener that is notified about messages and changes in the session. - */ -public class SimpleSessionListener implements SessionListener { - private static final Logger logger = LoggerFactory.getLogger(SimpleSessionListener.class); - - public List messages = new ArrayList(); - - public boolean up = false; - - public boolean failed = false; - - @Override - public void onMessage(final SimpleSession session, final SimpleMessage message) { - logger.debug("Received message: " + message.getClass() + " " + message); - this.messages.add(message); - } - - @Override - public void onSessionUp(final SimpleSession session) { - this.up = true; - } - - @Override - public void onSessionDown(final SimpleSession session, final Exception e) { - this.failed = true; - this.notifyAll(); - } - - @Override - public void onSessionTerminated(final SimpleSession session, final TerminationReason reason) { - this.failed = true; - this.notifyAll(); - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListenerFactory.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListenerFactory.java deleted file mode 100644 index 8135a89ccc..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionListenerFactory.java +++ /dev/null @@ -1,16 +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.framework; - -public class SimpleSessionListenerFactory implements SessionListenerFactory { - - @Override - public SimpleSessionListener getSessionListener() { - return new SimpleSessionListener(); - } -} diff --git a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionNegotiator.java b/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionNegotiator.java deleted file mode 100644 index f34829bb10..0000000000 --- a/framework/src/test/java/org/opendaylight/protocol/framework/SimpleSessionNegotiator.java +++ /dev/null @@ -1,28 +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.framework; - -import io.netty.channel.Channel; -import io.netty.util.concurrent.Promise; - -public class SimpleSessionNegotiator extends AbstractSessionNegotiator { - - public SimpleSessionNegotiator(Promise promise, Channel channel) { - super(promise, channel); - } - - @Override - protected void startNegotiation() throws Exception { - negotiationSuccessful(new SimpleSession()); - } - - @Override - protected void handleMessage(SimpleMessage msg) throws Exception { - throw new IllegalStateException("This method should never be invoked"); - } -} diff --git a/framework/src/test/resources/keystore.jks b/framework/src/test/resources/keystore.jks deleted file mode 100644 index e315823f3484d956488464808bc3f7868c3ec594..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2249 zcmchYX*AT29>(W4GxlZdWNg{`W2&)ck91{Z-xJDYnr2SbMN_|)BF44dGUN+ea~~A^L)80+!YWA1l|?!Tf(7Xn2?~r zSlqv{=c0Du;b+bCFc63bKoX$aNKsxv9bNzmXoJN8fCmI6Kv{dnmrs7i*AU;@kxHDo zCj!2rW}AYhuKIiai_`dtk26M|v!AZtZ zW#ZwFNYcvtUr8YUd#QbftUO-bTx48OHF|1uCR4K3$my%^W7j2=rBBw5p0ngIrreJx zm+I$rNEh3~(+xgxHz1*SqDQE_yCWqxUgvaxUNLOkgxT31ae($@EKy&)mfp>^VYmlx z_)8En>(Qp^f5jvz&@(28O+lIF%jdN^dM;?astcu?ii zyN5a|#ktu_S8NmOe?moHmuwz+kx7y7LWwVWo0Dy*>)`fRelRuhl+4keDxPnzK|D#v zu*V>Ad(T+cnHhX8g7G(bcCmQIp5&E}V23Zo;jV-pSBjrSK5(NkS5Fkr>@ZLMI4n=D zZmORg6NU6QE8UM-B&LYJtr4?S~0InOA8ftzB`gnkNR%xJ)i2?5~V(>?zFljfFUfc z`u1+t|KPljoapH3%2m6tkaj@O#7h27#!YS7fURwPeK{_5Nou}9eU@q@vZ}#ca9CeHbifgDoCh$HR-%d_#zFU?-M+ zPeh!RIBiEO^Yw0gO^F!G`p6(5qMW?yvxU-T&2l7&luS= zco@C>#g3U&e{??nbV-_fm*uE{^Q}>KKo<)Q$it{Ehr5(R+UGW) z_=&-3V}GI#1AW$MWNAYBTO*roX!o#meFh zBpzPY@-1hz?U@c=-#{s;TfIIprHHljU^mD=2n((?v)GR@2(tzXR<96hKc)@ct4btg z#&9TWFsWRKzg5M6N?`;;sPXo^Zc;zI5w)*Ula=#1cF@V0y@MD^D{DE($)jo6?0arK zvxb&VS4x~1_3xDP`mA{%)Ut)a5Io*T{3&hpGKHERR2|Ca6Zk6DNBidQdF1gqV2CsU zfgtfn0we}W0G}#>fB`TVD!cfh3n{`Ypq*-$x*-ApLOdWOPFHMqF(IB%UP(UBkl>Ke zn2`Sx{yzxcA4KpEBJ>A={Er}&WJPrKk%y2bNE2N{JtN=0tuFF!@Z0{MuOR@c|BPez zSwIK?41^>Af?xswfRdc;W!~gNF84JIGKA-Acx_Fn`gU#KdY8*57T*&$lUikRc6R=(_jby0?PLym63|O4N(+@%0Q*Q;CpSi0xIamYmcfhOmpS)veHfe3~{$pyCDLg z0KY_pU{J7EAbzv5yGTUs#olMBY#lQv0Xtuvd*M_E(7FzvWo}(%QI8d^*-Rws0K(#a zS^=-rMO)UljZO33oLj{=skaGPFb`pe%)~oHZcz;PgOEa&zLFQZ%8gXkYy2^#{dIJD zHpf7?zwo7#WmV>>4VrXCDOhsNM - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 938e9df968..8cf38ea1c0 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -92,6 +92,10 @@ org.opendaylight.controller sal-binding-broker-impl + + org.opendaylight.controller + protocol-framework + org.opendaylight.yangtools concepts diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/AbstractBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/AbstractBundleTest.java index ab09d97eef..4750a820cf 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/AbstractBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/AbstractBundleTest.java @@ -62,6 +62,7 @@ public abstract class AbstractBundleTest { ret.add(mavenBundle("org.javassist", "javassist", "3.17.1-GA")); ret.add(mavenBundle("org.opendaylight.controller", "config-api", "0.2.3-SNAPSHOT")); + ret.add(mavenBundle("org.opendaylight.controller", "protocol-framework", "0.4.0-SNAPSHOT")); ret.add(mavenBundle("org.opendaylight.controller", "sal-common-api", "1.0-SNAPSHOT")); ret.add(mavenBundle("org.opendaylight.controller", "sal-binding-api", "1.0-SNAPSHOT")); ret.add(mavenBundle("org.opendaylight.controller", "sal-binding-broker-impl", "1.0-SNAPSHOT")); diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpLinkstateBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpLinkstateBundleTest.java index 145f9215d3..fb7c698762 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpLinkstateBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpLinkstateBundleTest.java @@ -16,7 +16,7 @@ public final class BgpLinkstateBundleTest extends AbstractBundleTest { protected Collection prerequisiteBundles() { return Lists.newArrayList("bgp-concepts", "bgp-parser-api", "bgp-parser-spi", "bgp-rib-api", "bgp-rib-spi", - "concepts", "framework", "rsvp-api", "util"); + "concepts", "rsvp-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserApiBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserApiBundleTest.java index 3cfb6039a4..f4c703d6e0 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserApiBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserApiBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class BgpParserApiBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("bgp-concepts", "bgp-util", "concepts", "framework", "util"); + return Lists.newArrayList("bgp-concepts", "bgp-util", "concepts", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserImplBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserImplBundleTest.java index 68ee7e2af9..80dd1cd84b 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserImplBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserImplBundleTest.java @@ -14,7 +14,8 @@ import com.google.common.collect.Lists; public final class BgpParserImplBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("bgp-concepts", "bgp-linkstate", "bgp-parser-api", "bgp-parser-spi", "bgp-util", "concepts", "framework", "rsvp-api", "util"); + return Lists.newArrayList("bgp-concepts", "bgp-linkstate", "bgp-parser-api", + "bgp-parser-spi", "bgp-util", "concepts", "rsvp-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserMockBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserMockBundleTest.java index d94a189088..df42ae9bf0 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserMockBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserMockBundleTest.java @@ -15,7 +15,7 @@ public final class BgpParserMockBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { return Lists.newArrayList("concepts", "bgp-concepts", "bgp-parser-api", - "bgp-parser-spi", "bgp-parser-impl", "framework", "util"); + "bgp-parser-spi", "bgp-parser-impl", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserSpiBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserSpiBundleTest.java index d663e6e669..f2696a26dd 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserSpiBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpParserSpiBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class BgpParserSpiBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("bgp-concepts", "bgp-parser-api", "bgp-util", "concepts", "framework", "util"); + return Lists.newArrayList("bgp-concepts", "bgp-parser-api", "bgp-util", "concepts", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibApiBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibApiBundleTest.java index 6a80a54280..b4d9b8c6a4 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibApiBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibApiBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class BgpRibApiBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("concepts", "bgp-concepts", "bgp-linkstate", "bgp-parser-api", "framework", "util"); + return Lists.newArrayList("concepts", "bgp-concepts", "bgp-linkstate", "bgp-parser-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibImplBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibImplBundleTest.java index 09357d163c..4c5eb468bb 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibImplBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibImplBundleTest.java @@ -16,7 +16,7 @@ public final class BgpRibImplBundleTest extends AbstractBundleTest { protected Collection prerequisiteBundles() { return Lists.newArrayList("concepts", "bgp-concepts", "bgp-linkstate", "bgp-parser-api", "bgp-parser-impl", "bgp-parser-spi", "bgp-rib-api", "bgp-rib-spi", - "bgp-util", "framework", "rsvp-api", "util"); + "bgp-util", "rsvp-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibMockBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibMockBundleTest.java index bac6ec0a0f..ecb7292525 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibMockBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibMockBundleTest.java @@ -16,7 +16,7 @@ public final class BgpRibMockBundleTest extends AbstractBundleTest { protected Collection prerequisiteBundles() { return Lists.newArrayList("concepts", "bgp-concepts", "bgp-linkstate", "bgp-parser-api", "bgp-parser-impl", "bgp-parser-spi", "bgp-rib-api", "bgp-rib-impl", - "bgp-rib-spi", "bgp-util", "framework", "rsvp-api", "util"); + "bgp-rib-spi", "bgp-util", "rsvp-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibSpiBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibSpiBundleTest.java index 26c628d135..2779036fbd 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibSpiBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpRibSpiBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class BgpRibSpiBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("bgp-concepts", "bgp-parser-api", "bgp-rib-api", "concepts", "framework", "util"); + return Lists.newArrayList("bgp-concepts", "bgp-parser-api", "bgp-rib-api", "concepts", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpUtilBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpUtilBundleTest.java index 261a61fdce..0131644c8b 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpUtilBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/BgpUtilBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class BgpUtilBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("concepts", "bgp-concepts", "bgp-parser-api", "framework", "util"); + return Lists.newArrayList("concepts", "bgp-concepts", "bgp-parser-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/FrameworkBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/FrameworkBundleTest.java deleted file mode 100644 index 90d2b93256..0000000000 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/FrameworkBundleTest.java +++ /dev/null @@ -1,24 +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.integration; - -import java.util.Collection; - -import com.google.common.collect.Lists; - -public final class FrameworkBundleTest extends AbstractBundleTest { - @Override - protected Collection prerequisiteBundles() { - return Lists.newArrayList("concepts", "util"); - } - - @Override - protected Collection requiredBundles() { - return Lists.newArrayList("framework"); - } -} diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepApiBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepApiBundleTest.java index 64cda31b03..422a69b735 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepApiBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepApiBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class PcepApiBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("concepts", "framework", "rsvp-api", "util"); + return Lists.newArrayList("concepts", "rsvp-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepImplBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepImplBundleTest.java index ea3d070201..e01f538c05 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepImplBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepImplBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class PcepImplBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("concepts", "framework", "pcep-api", "pcep-spi", "rsvp-api", "util"); + return Lists.newArrayList("concepts", "pcep-api", "pcep-spi", "rsvp-api", "util"); } @Override diff --git a/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepSpiBundleTest.java b/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepSpiBundleTest.java index b7dacff764..39b91b4cc9 100644 --- a/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepSpiBundleTest.java +++ b/integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepSpiBundleTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.Lists; public final class PcepSpiBundleTest extends AbstractBundleTest { @Override protected Collection prerequisiteBundles() { - return Lists.newArrayList("concepts", "framework", "pcep-api", "rsvp-api", "util"); + return Lists.newArrayList("concepts", "pcep-api", "rsvp-api", "util"); } @Override diff --git a/pcep/api/pom.xml b/pcep/api/pom.xml index f709772756..3cfb0be09a 100644 --- a/pcep/api/pom.xml +++ b/pcep/api/pom.xml @@ -29,10 +29,6 @@ ${project.groupId} concepts - - ${project.groupId} - framework - ${project.groupId} util @@ -67,6 +63,11 @@ yang-common + + org.opendaylight.controller + protocol-framework + + concepts - framework util -- 2.36.6