blob: 1375a2090295faec8cc773046a505ac4f806c376 [file] [log] [blame]
tom9c94c5b2014-09-17 13:14:42 -07001package org.onlab.onos.openflow.controller;
tom7ef8ff92014-09-17 13:08:06 -07002
3import java.util.List;
4
5import org.projectfloodlight.openflow.protocol.OFFactory;
6import org.projectfloodlight.openflow.protocol.OFMessage;
7import org.projectfloodlight.openflow.protocol.OFPortDesc;
8
9/**
10 * Represents to provider facing side of a switch.
11 */
12public interface OpenFlowSwitch {
13
14 /**
15 * Writes the message to the driver.
16 *
17 * @param msg the message to write
18 */
19 public void sendMsg(OFMessage msg);
20
21 /**
22 * 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 /**
29 * Handle a message from the switch.
30 * @param fromSwitch the message to handle
31 */
32 public void handleMessage(OFMessage fromSwitch);
33
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 * fetch the manufacturer description.
74 * @return the description
75 */
76 public String manfacturerDescription();
77
78 /**
79 * fetch the datapath description.
80 * @return the description
81 */
82 public String datapathDescription();
83
84 /**
85 * fetch the hardware description.
86 * @return the description
87 */
88 public String hardwareDescription();
89
90 /**
91 * fetch the software description.
92 * @return the description
93 */
94 public String softwareDescription();
95
96 /**
97 * fetch the serial number.
98 * @return the serial
99 */
100 public String serialNumber();
101
102 /**
103 * Disconnects the switch by closing the TCP connection. Results in a call
104 * to the channel handler's channelDisconnected method for cleanup
105 */
106 public void disconnectSwitch();
107
Ayaka Koshibeab91cc42014-09-25 10:20:52 -0700108 /**
109 * Notifies the controller that role assertion has failed.
110 *
111 * @param role the failed role
112 */
Ayaka Koshibee8708e32014-10-22 13:40:18 -0700113 public void returnRoleAssertFailure(RoleState role);
Praseed Balakrishnana22eadf2014-10-20 14:21:45 -0700114
115 /**
116 * Indicates if this switch is optical.
117 *
118 * @return true if optical
119 */
120 public boolean isOptical();
121
tom7ef8ff92014-09-17 13:08:06 -0700122}