Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.openflow.controller; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 17 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | import org.projectfloodlight.openflow.protocol.OFFactory; |
| 21 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 22 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
| 23 | |
| 24 | /** |
| 25 | * Represents to provider facing side of a switch. |
| 26 | */ |
| 27 | public interface OpenFlowSwitch { |
| 28 | |
| 29 | /** |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 30 | * The TableType is used to determine in which table (TableID) each flow rule |
| 31 | * needs to be put for multi-table support switch. |
| 32 | * It is used only for multi-table support switch. |
| 33 | */ |
| 34 | public static enum TableType { |
| 35 | /* IP table */ |
| 36 | IP, |
| 37 | /* MPLS table */ |
| 38 | MPLS, |
| 39 | /* ACL table */ |
| 40 | ACL, |
| 41 | /* Single table */ |
| 42 | NONE, |
| 43 | } |
| 44 | |
| 45 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 46 | * Writes the message to the driver. |
| 47 | * |
| 48 | * @param msg the message to write |
| 49 | */ |
| 50 | public void sendMsg(OFMessage msg); |
| 51 | |
| 52 | /** |
| 53 | * Writes to the OFMessage list to the driver. |
| 54 | * |
| 55 | * @param msgs the messages to be written |
| 56 | */ |
| 57 | public void sendMsg(List<OFMessage> msgs); |
| 58 | |
| 59 | /** |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 60 | * Writes to the OFMessage list to the driver. |
| 61 | * TableType is used to determine the table ID for the OFMessage. |
| 62 | * The switch driver that supports multi-table should implement the function. |
| 63 | * |
| 64 | * @param msg the message to be written |
| 65 | * @param tableType the type of table in which the OFMessage needs to put |
| 66 | */ |
| 67 | public void sendMsg(OFMessage msg, TableType tableType); |
| 68 | |
| 69 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 70 | * Handle a message from the switch. |
| 71 | * @param fromSwitch the message to handle |
| 72 | */ |
| 73 | public void handleMessage(OFMessage fromSwitch); |
| 74 | |
| 75 | /** |
| 76 | * Sets the role for this switch. |
| 77 | * @param role the role to set. |
| 78 | */ |
| 79 | public void setRole(RoleState role); |
| 80 | |
| 81 | /** |
| 82 | * Fetch the role for this switch. |
| 83 | * @return the role. |
| 84 | */ |
| 85 | public RoleState getRole(); |
| 86 | |
| 87 | /** |
| 88 | * Fetches the ports of this switch. |
| 89 | * @return unmodifiable list of the ports. |
| 90 | */ |
| 91 | public List<OFPortDesc> getPorts(); |
| 92 | |
| 93 | /** |
| 94 | * Provides the factory for this OF version. |
| 95 | * @return OF version specific factory. |
| 96 | */ |
| 97 | public OFFactory factory(); |
| 98 | |
| 99 | /** |
| 100 | * Gets a string version of the ID for this switch. |
| 101 | * |
| 102 | * @return string version of the ID |
| 103 | */ |
| 104 | public String getStringId(); |
| 105 | |
| 106 | /** |
| 107 | * Gets the datapathId of the switch. |
| 108 | * |
| 109 | * @return the switch dpid in long format |
| 110 | */ |
| 111 | public long getId(); |
| 112 | |
| 113 | /** |
| 114 | * fetch the manufacturer description. |
| 115 | * @return the description |
| 116 | */ |
Ray Milkey | d3edd03 | 2015-01-16 11:38:58 -0800 | [diff] [blame] | 117 | public String manufacturerDescription(); |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * fetch the datapath description. |
| 121 | * @return the description |
| 122 | */ |
| 123 | public String datapathDescription(); |
| 124 | |
| 125 | /** |
| 126 | * fetch the hardware description. |
| 127 | * @return the description |
| 128 | */ |
| 129 | public String hardwareDescription(); |
| 130 | |
| 131 | /** |
| 132 | * fetch the software description. |
| 133 | * @return the description |
| 134 | */ |
| 135 | public String softwareDescription(); |
| 136 | |
| 137 | /** |
| 138 | * fetch the serial number. |
| 139 | * @return the serial |
| 140 | */ |
| 141 | public String serialNumber(); |
| 142 | |
| 143 | /** |
Yuta HIGUCHI | 69a2735 | 2014-10-31 15:48:37 -0700 | [diff] [blame] | 144 | * Checks if the switch is still connected. |
| 145 | * |
| 146 | * @return whether the switch is still connected |
| 147 | */ |
| 148 | public boolean isConnected(); |
| 149 | |
| 150 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 151 | * Disconnects the switch by closing the TCP connection. Results in a call |
| 152 | * to the channel handler's channelDisconnected method for cleanup |
| 153 | */ |
| 154 | public void disconnectSwitch(); |
| 155 | |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 156 | /** |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 157 | * Notifies the controller that the device has responded to a set-role request. |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 158 | * |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 159 | * @param requested the role requested by the controller |
| 160 | * @param response the role set at the device |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 161 | */ |
Yuta HIGUCHI | 5c94727 | 2014-11-03 21:39:21 -0800 | [diff] [blame] | 162 | public void returnRoleReply(RoleState requested, RoleState response); |
Praseed Balakrishnan | a22eadf | 2014-10-20 14:21:45 -0700 | [diff] [blame] | 163 | |
| 164 | /** |
| 165 | * Indicates if this switch is optical. |
| 166 | * |
| 167 | * @return true if optical |
| 168 | */ |
| 169 | public boolean isOptical(); |
| 170 | |
Ray Milkey | e53f171 | 2015-01-16 09:17:16 -0800 | [diff] [blame] | 171 | /** |
| 172 | * Identifies the channel used to communicate with the switch. |
Ray Milkey | f25d135 | 2015-01-23 15:14:08 -0800 | [diff] [blame] | 173 | * |
| 174 | * @return string representation of the connection to the device |
Ray Milkey | e53f171 | 2015-01-16 09:17:16 -0800 | [diff] [blame] | 175 | */ |
| 176 | public String channelId(); |
| 177 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 178 | } |