* 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.netconf.nettyutil;
import io.netty.channel.Channel;
import io.netty.util.concurrent.Promise;
import org.opendaylight.netconf.api.NetconfSession;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
import org.opendaylight.netconf.nettyutil.handler.FramingMechanismHandlerFactory;
import org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfHelloMessageToXMLEncoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
public abstract class AbstractChannelInitializer<S extends NetconfSession> {
-
public static final String NETCONF_MESSAGE_DECODER = "netconfMessageDecoder";
public static final String NETCONF_MESSAGE_AGGREGATOR = "aggregator";
public static final String NETCONF_MESSAGE_ENCODER = "netconfMessageEncoder";
public static final String NETCONF_MESSAGE_FRAME_ENCODER = "frameEncoder";
public static final String NETCONF_SESSION_NEGOTIATOR = "negotiator";
- public void initialize(Channel ch, Promise<S> promise) {
+ public void initialize(final Channel ch, final Promise<S> promise) {
ch.pipeline().addLast(NETCONF_MESSAGE_AGGREGATOR, new NetconfEOMAggregator());
initializeMessageDecoder(ch);
ch.pipeline().addLast(NETCONF_MESSAGE_FRAME_ENCODER,
initializeSessionNegotiator(ch, promise);
}
- protected void initializeMessageEncoder(Channel ch) {
+ protected void initializeMessageEncoder(final Channel ch) {
// Special encoding handler for hello message to include additional header if available,
// it is thrown away after successful negotiation
ch.pipeline().addLast(NETCONF_MESSAGE_ENCODER, new NetconfHelloMessageToXMLEncoder());
}
- protected void initializeMessageDecoder(Channel ch) {
+ protected void initializeMessageDecoder(final Channel ch) {
// Special decoding handler for hello message to parse additional header if available,
// it is thrown away after successful negotiation
ch.pipeline().addLast(NETCONF_MESSAGE_DECODER, new NetconfXMLToHelloMessageDecoder());
* identified by {@link AbstractChannelInitializer#NETCONF_MESSAGE_DECODER}, (or any other custom decoder processor)
*/
protected abstract void initializeSessionNegotiator(Channel ch, Promise<S> promise);
-
}
import org.opendaylight.netconf.api.NetconfDocumentedException;
import org.opendaylight.netconf.api.NetconfMessage;
import org.opendaylight.netconf.api.NetconfSessionListener;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
import org.opendaylight.netconf.api.messages.HelloMessage;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
import org.opendaylight.netconf.nettyutil.handler.FramingMechanismHandlerFactory;
import org.opendaylight.netconf.nettyutil.handler.NetconfMessageToXMLEncoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToMessageDecoder;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.MessageToByteEncoder;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
/**
* netconf message part constants as bytes.
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.netconf.api.NetconfSessionListener;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
import org.opendaylight.netconf.api.messages.HelloMessage;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.nettyutil.handler.NetconfChunkAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
@RunWith(MockitoJUnitRunner.StrictStubs.class)
public class AbstractNetconfSessionNegotiatorTest {
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.netconf.api.NetconfSessionListener;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
import org.opendaylight.netconf.api.messages.HelloMessage;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
import org.opendaylight.netconf.nettyutil.handler.ChunkedFramingMechanismEncoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfChunkAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
import org.opendaylight.netconf.util.test.XmlFileLoader;
import org.w3c.dom.Document;
* 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.netconf.nettyutil.handler;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
public class FramingMechanismHandlerFactoryTest {
-
@Test
public void testCreate() throws Exception {
MatcherAssert.assertThat(FramingMechanismHandlerFactory
* 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.netconf.util.messages;
+package org.opendaylight.netconf.api.messages;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.netconf.api.NetconfMessage;
+import org.opendaylight.netconf.api.messages.FramingMechanism;
import org.opendaylight.netconf.nettyutil.handler.ChunkedFramingMechanismEncoder;
import org.opendaylight.netconf.nettyutil.handler.FramingMechanismHandlerFactory;
import org.opendaylight.netconf.nettyutil.handler.NetconfChunkAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator;
import org.opendaylight.netconf.nettyutil.handler.NetconfMessageToXMLEncoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToMessageDecoder;
-import org.opendaylight.netconf.util.messages.FramingMechanism;
import org.opendaylight.netconf.util.test.XmlFileLoader;
public class MessageParserTest {