blob: 798440ade6c23c35a3c4dfadcb7ec2e08856e3ca [file] [log] [blame]
alshabib54ebd9c2014-08-27 18:38:41 -07001package org.onlab.onos.of.controller;
2
alshabib6171f182014-09-02 19:00:32 -07003import java.util.List;
4
5import org.projectfloodlight.openflow.protocol.OFFactory;
alshabib54ebd9c2014-08-27 18:38:41 -07006import org.projectfloodlight.openflow.protocol.OFMessage;
alshabib6171f182014-09-02 19:00:32 -07007import org.projectfloodlight.openflow.protocol.OFPortDesc;
alshabib54ebd9c2014-08-27 18:38:41 -07008
9/**
alshabib6171f182014-09-02 19:00:32 -070010 * Represents to provider facing side of a switch.
alshabib54ebd9c2014-08-27 18:38:41 -070011 */
12public interface OpenFlowSwitch {
13
14 /**
alshabib6171f182014-09-02 19:00:32 -070015 * Writes the message to the driver.
alshabib54ebd9c2014-08-27 18:38:41 -070016 *
17 * @param msg the message to write
18 */
alshabibd777b202014-08-28 17:52:55 -070019 public void sendMsg(OFMessage msg);
alshabib54ebd9c2014-08-27 18:38:41 -070020
21 /**
alshabib6171f182014-09-02 19:00:32 -070022 * Writes to the OFMessage list to the driver.
23 *
24 * @param msgs the messages to be written
25 */
26 public void sendMsg(List<OFMessage> msgs);
27
28 /**
alshabib54ebd9c2014-08-27 18:38:41 -070029 * Handle a message from the switch.
30 * @param fromSwitch the message to handle
31 */
32 public void handleMessage(OFMessage fromSwitch);
alshabib6171f182014-09-02 19:00:32 -070033
34 /**
35 * Sets the role for this switch.
36 * @param role the role to set.
37 */
38 public void setRole(RoleState role);
39
40 /**
41 * Fetch the role for this switch.
42 * @return the role.
43 */
44 public RoleState getRole();
45
46 /**
47 * Fetches the ports of this switch.
48 * @return unmodifiable list of the ports.
49 */
50 public List<OFPortDesc> getPorts();
51
52 /**
53 * Provides the factory for this OF version.
54 * @return OF version specific factory.
55 */
56 public OFFactory factory();
57
58 /**
59 * Gets a string version of the ID for this switch.
60 *
61 * @return string version of the ID
62 */
63 public String getStringId();
64
65 /**
66 * Gets the datapathId of the switch.
67 *
68 * @return the switch dpid in long format
69 */
70 public long getId();
71
72 /**
73 * Disconnects the switch by closing the TCP connection. Results in a call
74 * to the channel handler's channelDisconnected method for cleanup
75 */
76 public void disconnectSwitch();
77
alshabib54ebd9c2014-08-27 18:38:41 -070078}