blob: b7e98c3d2b3f0039a6e0b3b4a05e379340e7b81f [file] [log] [blame]
tom9c94c5b2014-09-17 13:14:42 -07001package org.onlab.onos.openflow.controller;
tom7ef8ff92014-09-17 13:08:06 -07002
3import org.projectfloodlight.openflow.protocol.OFMessage;
4
5/**
6 * Abstraction of an OpenFlow controller. Serves as a one stop
7 * shop for obtaining OpenFlow devices and (un)register listeners
8 * on OpenFlow events
9 */
10public interface OpenFlowController {
11
12 /**
13 * Returns all switches known to this OF controller.
14 * @return Iterable of dpid elements
15 */
16 public Iterable<OpenFlowSwitch> getSwitches();
17
18 /**
19 * Returns all master switches known to this OF controller.
20 * @return Iterable of dpid elements
21 */
22 public Iterable<OpenFlowSwitch> getMasterSwitches();
23
24 /**
25 * Returns all equal switches known to this OF controller.
26 * @return Iterable of dpid elements
27 */
28 public Iterable<OpenFlowSwitch> getEqualSwitches();
29
30
31 /**
32 * Returns the actual switch for the given Dpid.
33 * @param dpid the switch to fetch
34 * @return the interface to this switch
35 */
36 public OpenFlowSwitch getSwitch(Dpid dpid);
37
38 /**
39 * Returns the actual master switch for the given Dpid, if one exists.
40 * @param dpid the switch to fetch
41 * @return the interface to this switch
42 */
43 public OpenFlowSwitch getMasterSwitch(Dpid dpid);
44
45 /**
46 * Returns the actual equal switch for the given Dpid, if one exists.
47 * @param dpid the switch to fetch
48 * @return the interface to this switch
49 */
50 public OpenFlowSwitch getEqualSwitch(Dpid dpid);
51
52 /**
53 * Register a listener for meta events that occur to OF
54 * devices.
55 * @param listener the listener to notify
56 */
57 public void addListener(OpenFlowSwitchListener listener);
58
59 /**
60 * Unregister a listener.
61 *
62 * @param listener the listener to unregister
63 */
64 public void removeListener(OpenFlowSwitchListener listener);
65
66 /**
67 * Register a listener for packet events.
68 * @param priority the importance of this listener, lower values are more important
69 * @param listener the listener to notify
70 */
71 public void addPacketListener(int priority, PacketListener listener);
72
73 /**
74 * Unregister a listener.
75 *
76 * @param listener the listener to unregister
77 */
78 public void removePacketListener(PacketListener listener);
79
80 /**
alshabibeec3a062014-09-17 18:01:26 -070081 * Register a listener for OF msg events.
82 *
83 * @param listener the listener to notify
84 */
85 public void addEventListener(OpenFlowEventListener listener);
86
87 /**
88 * Unregister a listener.
89 *
90 * @param listener the listener to unregister
91 */
92 public void removeEventListener(OpenFlowEventListener listener);
93
94 /**
tom7ef8ff92014-09-17 13:08:06 -070095 * Send a message to a particular switch.
96 * @param dpid the switch to send to.
97 * @param msg the message to send
98 */
99 public void write(Dpid dpid, OFMessage msg);
100
101 /**
102 * Process a message and notify the appropriate listeners.
103 *
104 * @param dpid the dpid the message arrived on
105 * @param msg the message to process.
106 */
107 public void processPacket(Dpid dpid, OFMessage msg);
108
109 /**
110 * Sets the role for a given switch.
111 * @param role the desired role
112 * @param dpid the switch to set the role for.
113 */
114 public void setRole(Dpid dpid, RoleState role);
115}