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.openflowplugin.openflow.md.core;
11 import java.util.List;
12 import java.util.concurrent.Future;
14 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
15 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
16 import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeper;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
18 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import com.google.common.collect.Lists;
26 public interface ConnectionConductor {
28 /** distinguished connection states */
29 public enum CONDUCTOR_STATE {
30 /** initial phase of talking to switch */
32 /** standard phase - interacting with switch */
34 /** connection is idle, waiting for echo reply from switch */
36 /** talking to switch is over - resting in pieces */
40 /** supported version ordered by height (highest version is at the beginning) */
41 public static final List<Short> versionOrder = Lists.newArrayList((short) 0x04, (short) 0x01);
44 * initialize wiring around {@link #connectionAdapter}
49 * @return the negotiated version
51 public Short getVersion();
54 * @return the state of conductor
56 public CONDUCTOR_STATE getConductorState();
59 * @param conductorState
61 public void setConductorState(CONDUCTOR_STATE conductorState);
64 * terminates owned connection
65 * @return future result of disconnect action
67 public Future<Boolean> disconnect();
70 * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch)
73 public void setSessionContext(SessionContext context);
76 * assign corresponding {@link SwitchConnectionDistinguisher} to this conductor
77 * to handle disconnect caused by switch. This involves auxiliary conductors only.
80 public void setConnectionCookie(SwitchConnectionDistinguisher auxiliaryKey);
83 * @return the sessionContext
85 public SessionContext getSessionContext();
88 * @return the auxiliaryKey (null if this is a primary connection)
90 public SwitchConnectionDistinguisher getAuxiliaryKey();
93 * @return the connectionAdapter
95 public ConnectionAdapter getConnectionAdapter();
98 * assign global queueKeeper
101 void setQueueKeeper(QueueKeeper<OfHeader, DataObject> queueKeeper);
104 * @param errorHandler for internal exception handling
106 void setErrorHandler(ErrorHandler errorHandler);