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.api.openflow.md.core.SwitchConnectionDistinguisher;
16 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
17 import org.opendaylight.openflowplugin.openflow.md.queue.QueueProcessor;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
21 import com.google.common.collect.Lists;
27 public interface ConnectionConductor {
29 /** distinguished connection states */
30 public enum CONDUCTOR_STATE {
31 /** initial phase of talking to switch */
33 /** standard phase - interacting with switch */
35 /** connection is idle, waiting for echo reply from switch */
37 /** talking to switch is over - resting in pieces */
41 /** supported version ordered by height (highest version is at the beginning) */
42 public static final List<Short> versionOrder = Lists.newArrayList((short) 0x04, (short) 0x01);
45 * initialize wiring around {@link #connectionAdapter}
50 * @return the negotiated version
52 public Short getVersion();
55 * @return the state of conductor
57 public CONDUCTOR_STATE getConductorState();
60 * @param conductorState
62 public void setConductorState(CONDUCTOR_STATE conductorState);
65 * terminates owned connection
66 * @return future result of disconnect action
68 public Future<Boolean> disconnect();
71 * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch)
74 public void setSessionContext(SessionContext context);
77 * assign corresponding {@link org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher} to this conductor
78 * to handle disconnect caused by switch. This involves auxiliary conductors only.
81 public void setConnectionCookie(SwitchConnectionDistinguisher auxiliaryKey);
84 * @return the sessionContext
86 public SessionContext getSessionContext();
89 * @return the auxiliaryKey (null if this is a primary connection)
91 public SwitchConnectionDistinguisher getAuxiliaryKey();
94 * @return the connectionAdapter
96 public ConnectionAdapter getConnectionAdapter();
99 * assign global queueKeeper
102 void setQueueProcessor(QueueProcessor<OfHeader, DataObject> queueKeeper);
105 * @param errorHandler for internal exception handling
107 void setErrorHandler(ErrorHandler errorHandler);
112 void setId(int conductorId);