blob: 870f10a20ff5e6484421e694e7423dfa7b9ce8bb [file] [log] [blame]
tom9c94c5b2014-09-17 13:14:42 -07001package org.onlab.onos.openflow.controller.driver;
tom7ef8ff92014-09-17 13:08:06 -07002
tom9c94c5b2014-09-17 13:14:42 -07003import org.onlab.onos.openflow.controller.Dpid;
4import org.onlab.onos.openflow.controller.OpenFlowSwitch;
Ayaka Koshibeab91cc42014-09-25 10:20:52 -07005import org.onlab.onos.openflow.controller.RoleState;
tom7ef8ff92014-09-17 13:08:06 -07006import org.projectfloodlight.openflow.protocol.OFMessage;
7
8/**
9 * Responsible for keeping track of the current set of switches
10 * connected to the system. As well as whether they are in Master
11 * role or not.
12 *
13 */
14public interface OpenFlowAgent {
15
16 /**
17 * Add a switch that has just connected to the system.
18 * @param dpid the dpid to add
19 * @param sw the actual switch object.
20 * @return true if added, false otherwise.
21 */
22 public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw);
23
24 /**
25 * Checks if the activation for this switch is valid.
26 * @param dpid the dpid to check
27 * @return true if valid, false otherwise
28 */
29 public boolean validActivation(Dpid dpid);
30
31 /**
32 * Called when a switch is activated, with this controller's role as MASTER.
33 * @param dpid the dpid to add.
34 * @param sw the actual switch
35 * @return true if added, false otherwise.
36 */
37 public boolean addActivatedMasterSwitch(Dpid dpid, OpenFlowSwitch sw);
38
39 /**
40 * Called when a switch is activated, with this controller's role as EQUAL.
41 * @param dpid the dpid to add.
42 * @param sw the actual switch
43 * @return true if added, false otherwise.
44 */
45 public boolean addActivatedEqualSwitch(Dpid dpid, OpenFlowSwitch sw);
46
47 /**
48 * Called when this controller's role for a switch transitions from equal
49 * to master. For 1.0 switches, we internally refer to the role 'slave' as
50 * 'equal' - so this transition is equivalent to 'addActivatedMasterSwitch'.
51 * @param dpid the dpid to transistion.
52 */
53 public void transitionToMasterSwitch(Dpid dpid);
54
55 /**
56 * Called when this controller's role for a switch transitions to equal.
57 * For 1.0 switches, we internally refer to the role 'slave' as
58 * 'equal'.
59 * @param dpid the dpid to transistion.
60 */
61 public void transitionToEqualSwitch(Dpid dpid);
62
63 /**
64 * Clear all state in controller switch maps for a switch that has
65 * disconnected from the local controller. Also release control for
66 * that switch from the global repository. Notify switch listeners.
67 * @param dpid the dpid to remove.
68 */
69 public void removeConnectedSwitch(Dpid dpid);
70
71 /**
72 * Process a message coming from a switch.
73 *
74 * @param dpid the dpid the message came on.
75 * @param m the message to process
76 */
77 public void processMessage(Dpid dpid, OFMessage m);
Ayaka Koshibeab91cc42014-09-25 10:20:52 -070078
79 /**
80 * Notifies the controller that role assertion has failed.
81 *
82 * @param dpid the switch that failed role assertion
83 * @param role the failed role
84 */
85 public void returnRoleAssertFailed(Dpid dpid, RoleState role);
tom7ef8ff92014-09-17 13:08:06 -070086}