tom | 9c94c5b | 2014-09-17 13:14:42 -0700 | [diff] [blame] | 1 | package org.onlab.onos.openflow.controller; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import org.projectfloodlight.openflow.protocol.OFFactory; |
| 6 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 7 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
| 8 | |
| 9 | /** |
| 10 | * Represents to provider facing side of a switch. |
| 11 | */ |
| 12 | public 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 Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 108 | /** |
| 109 | * Notifies the controller that role assertion has failed. |
| 110 | * |
| 111 | * @param role the failed role |
| 112 | */ |
| 113 | void returnRoleAssertFailure(RoleState role); |
| 114 | |
Praseed Balakrishnan | a22eadf | 2014-10-20 14:21:45 -0700 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Indicates if this switch is optical. |
| 118 | * |
| 119 | * @return true if optical |
| 120 | */ |
| 121 | public boolean isOptical(); |
| 122 | |
| 123 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 124 | } |