2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.client;
11 import java.util.Collection;
13 import org.opendaylight.controller.netconf.util.AbstractNetconfSession;
14 import org.opendaylight.controller.netconf.util.handler.NetconfEXICodec;
15 import org.opendaylight.controller.netconf.util.handler.NetconfEXIToMessageDecoder;
16 import org.opendaylight.controller.netconf.util.handler.NetconfMessageToEXIEncoder;
17 import org.opendaylight.controller.netconf.util.handler.NetconfMessageToXMLEncoder;
18 import org.opendaylight.controller.netconf.util.handler.NetconfXMLToMessageDecoder;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 import io.netty.channel.Channel;
24 public final class NetconfClientSession extends AbstractNetconfSession<NetconfClientSession, NetconfClientSessionListener> {
26 private static final Logger logger = LoggerFactory.getLogger(NetconfClientSession.class);
27 private final Collection<String> capabilities;
29 public NetconfClientSession(NetconfClientSessionListener sessionListener, Channel channel, long sessionId,
30 Collection<String> capabilities) {
31 super(sessionListener, channel, sessionId);
32 this.capabilities = capabilities;
33 logger.debug("Client Session {} created", toString());
36 public Collection<String> getServerCapabilities() {
41 protected NetconfClientSession thisInstance() {
46 protected void addExiHandlers(NetconfEXICodec exiCodec) {
47 // TODO used only in negotiator, client supports only auto start-exi
48 replaceMessageDecoder(new NetconfEXIToMessageDecoder(exiCodec));
49 replaceMessageEncoder(new NetconfMessageToEXIEncoder(exiCodec));
53 public void stopExiCommunication() {
54 // TODO never used, Netconf client does not support stop-exi
55 replaceMessageDecoder(new NetconfXMLToMessageDecoder());
56 replaceMessageEncoder(new NetconfMessageToXMLEncoder());