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 io.netty.channel.Channel;
12 import java.util.Collection;
13 import org.opendaylight.controller.netconf.nettyutil.AbstractNetconfSession;
14 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfEXICodec;
15 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfEXIToMessageDecoder;
16 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfMessageToEXIEncoder;
17 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfMessageToXMLEncoder;
18 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfXMLToMessageDecoder;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class NetconfClientSession extends AbstractNetconfSession<NetconfClientSession, NetconfClientSessionListener> {
24 private static final Logger logger = LoggerFactory.getLogger(NetconfClientSession.class);
25 private final Collection<String> capabilities;
27 public NetconfClientSession(NetconfClientSessionListener sessionListener, Channel channel, long sessionId,
28 Collection<String> capabilities) {
29 super(sessionListener, channel, sessionId);
30 this.capabilities = capabilities;
31 logger.debug("Client Session {} created", toString());
34 public Collection<String> getServerCapabilities() {
39 protected NetconfClientSession thisInstance() {
44 protected void addExiHandlers(NetconfEXICodec exiCodec) {
45 // TODO used only in negotiator, client supports only auto start-exi
46 replaceMessageDecoder(new NetconfEXIToMessageDecoder(exiCodec));
47 replaceMessageEncoder(new NetconfMessageToEXIEncoder(exiCodec));
51 public void stopExiCommunication() {
52 // TODO never used, Netconf client does not support stop-exi
53 replaceMessageDecoder(new NetconfXMLToMessageDecoder());
54 replaceMessageEncoder(new NetconfMessageToXMLEncoder());