2 * Copyright (c) 2015 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
8 package org.opendaylight.openflowplugin.impl.connection;
10 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
11 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
12 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
21 public class ConnectionContextImpl implements ConnectionContext {
23 private final ConnectionAdapter connectionAdapter;
24 private CONNECTION_STATE connectionState;
25 private FeaturesReply featuresReply;
26 private NodeId nodeId;
27 private DeviceDisconnectedHandler deviceDisconnectedHandler;
28 private static final Logger LOG = LoggerFactory.getLogger(ConnectionContextImpl.class);
31 * @param connectionAdapter
33 public ConnectionContextImpl(final ConnectionAdapter connectionAdapter) {
34 this.connectionAdapter = connectionAdapter;
38 public ConnectionAdapter getConnectionAdapter() {
39 return connectionAdapter;
43 public CONNECTION_STATE getConnectionState() {
44 return connectionState;
48 public NodeId getNodeId() {
53 public void setNodeId(final NodeId nodeId) {
58 public void setConnectionState(final CONNECTION_STATE connectionState) {
59 this.connectionState = connectionState;
63 public FeaturesReply getFeatures() {
68 public void setDeviceDisconnectedHandler(final DeviceDisconnectedHandler deviceDisconnectedHandler) {
69 this.deviceDisconnectedHandler = deviceDisconnectedHandler;
73 public void propagateClosingConnection() {
74 if (null != deviceDisconnectedHandler) {
75 LOG.trace("Populating connection closed event.");
76 this.deviceDisconnectedHandler.onDeviceDisconnected(this);
81 public void setFeatures(final FeaturesReply featuresReply) {
82 this.featuresReply = featuresReply;