added switch connection providers starting
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / connection / ConnectionContext.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.api.openflow.connection;
10
11 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
14
15 /**
16  * Each OpenFlow session is tracked by a Connection Context. These attach to a particular Device Context in such a way,
17  * that there is at most one primary session associated with a Device Context.
18  * <p>
19  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 25.2.2015.
20  */
21 public interface ConnectionContext extends MultiMsgCollector {
22
23     /**
24      * distinguished connection states
25      */
26     enum CONNECTION_STATE {
27         /**
28          * initial phase of talking to switch
29          */
30         HANDSHAKING,
31         /**
32          * standard phase - interacting with switch
33          */
34         WORKING,
35         /**
36          * connection is idle, waiting for echo reply from switch
37          */
38         TIMEOUTING,
39         /**
40          * talking to switch is over - resting in pieces
41          */
42         RIP
43     }
44
45     /**
46      * setter for nodeId
47      * @param nodeId
48      */
49     void setNodeId(NodeId nodeId);
50
51     /**
52      * Method returns identifier of device whic connection represents this context.
53      *
54      * @return {@link org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId}
55      */
56     NodeId getNodeId();
57
58     /**
59      * @return the connectionAdapter
60      */
61     ConnectionAdapter getConnectionAdapter();
62
63
64     /**
65      * Method returns current connection state.
66      *
67      * @return {@link ConnectionContext.CONNECTION_STATE}
68      */
69     CONNECTION_STATE getConnectionState();
70
71     /**
72      * Method sets connection state of current context.
73      *
74      * @param connectionState
75      */
76     void setConnectionState(CONNECTION_STATE connectionState);
77
78     /**
79      * @param featuresReply as received from device during handshake
80      */
81     void setFeatures(FeaturesReply featuresReply);
82
83     /**
84      * @return featureReply as received from device during handshake
85      */
86     FeaturesReply getFeatures();
87
88
89 }