X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Fhoneynode%2F2.1%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfHelloMessageToXMLEncoder.java;fp=tests%2Fhoneynode%2F2.1%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfHelloMessageToXMLEncoder.java;h=0000000000000000000000000000000000000000;hb=c764b14f67faf1665f8814db9e5d16ddb342553e;hp=fac1b2ba4db393aab8a2a2876369c99d46da1c96;hpb=b90fdacec82f92e07d14ed1df31e3fe53275c676;p=transportpce.git diff --git a/tests/honeynode/2.1/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoder.java b/tests/honeynode/2.1/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoder.java deleted file mode 100644 index fac1b2ba4..000000000 --- a/tests/honeynode/2.1/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.netconf.nettyutil.handler; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import javax.xml.transform.TransformerException; -import org.opendaylight.netconf.api.NetconfMessage; -import org.opendaylight.netconf.api.messages.NetconfHelloMessage; -import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader; - -/** - * Customized NetconfMessageToXMLEncoder that serializes additional header with - * session metadata along with - * {@link NetconfHelloMessage} - * . Used by netconf clients to send information about the user, ip address, - * protocol etc. - * - *

- * Hello message with header example: - * - *

- * - *

- * {@code
- * [tomas;10.0.0.0/10000;tcp;1000;1000;;/home/tomas;;]
- * < hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- * < capabilities>
- * < capability>urn:ietf:params:netconf:base:1.0< /capability>
- * < /capabilities>
- * < /hello>
- * }
- * 
- */ -public final class NetconfHelloMessageToXMLEncoder extends NetconfMessageToXMLEncoder { - @Override - @VisibleForTesting - public void encode(ChannelHandlerContext ctx, NetconfMessage msg, ByteBuf out) - throws IOException, TransformerException { - Preconditions.checkState(msg instanceof NetconfHelloMessage, "Netconf message of type %s expected, was %s", - NetconfHelloMessage.class, msg.getClass()); - Optional headerOptional = ((NetconfHelloMessage) msg) - .getAdditionalHeader(); - - // If additional header present, serialize it along with netconf hello message - if (headerOptional.isPresent()) { - out.writeBytes(headerOptional.get().toFormattedString().getBytes(StandardCharsets.UTF_8)); - } - - super.encode(ctx, msg, out); - } -}