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 License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.api.openflow.connection;
11 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
12 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
13 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
14 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
20 * Each OpenFlow session is tracked by a Connection Context. These attach to a particular Device Context in such a way,
21 * that there is at most one primary session associated with a Device Context.
23 * Created by Martin Bobak <mbobak@cisco.com> on 25.2.2015.
25 public interface ConnectionContext extends AutoCloseable {
28 * distinguished connection states
30 enum CONNECTION_STATE {
32 * initial phase of talking to switch
36 * standard phase - interacting with switch
40 * connection is idle, waiting for echo reply from switch
44 * talking to switch is over - resting in pieces
54 void setNodeId(NodeId nodeId);
57 * Method returns identifier of device whic connection represents this context.
59 * @return {@link org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId}
64 * @return the connectionAdapter
66 ConnectionAdapter getConnectionAdapter();
69 * Returns reference to OFJava outbound queue provider. Outbound queue is used for outbound messages processing.
73 OutboundQueue getOutboundQueueProvider();
75 * Method sets reference to OFJava outbound queue provider.
78 void setOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider);
81 * Method returns current connection state.
83 * @return {@link ConnectionContext.CONNECTION_STATE}
85 CONNECTION_STATE getConnectionState();
88 * Method sets connection state of current context.
90 * @param connectionState
92 void setConnectionState(CONNECTION_STATE connectionState);
95 * @param featuresReply as received from device during handshake
97 void setFeatures(FeaturesReply featuresReply);
100 * @return featureReply as received from device during handshake
102 FeaturesReply getFeatures();
105 * Method sets handler for handling closing connections.
107 * @param deviceDisconnectedHandler
109 void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler);
112 * Method provides propagates info about closed connection to handler for handling closing connections.
114 void propagateClosingConnection();
116 void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration);