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