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 { |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame^] | 35 | /* VLAN-to-MPLS table */ |
| 36 | VLAN_MPLS, |
| 37 | |
| 38 | /* VLAN table */ |
| 39 | VLAN, |
| 40 | |
| 41 | /* L2 table */ |
| 42 | ETHER, |
| 43 | |
| 44 | /* Class of Service table */ |
| 45 | COS, |
| 46 | |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 47 | /* IP table */ |
| 48 | IP, |
| 49 | /* MPLS table */ |
| 50 | MPLS, |
| 51 | /* ACL table */ |
| 52 | ACL, |
| 53 | /* Single table */ |
| 54 | NONE, |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame^] | 55 | |
| 56 | |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 60 | * Writes the message to the driver. |
| 61 | * |
| 62 | * @param msg the message to write |
| 63 | */ |
| 64 | public void sendMsg(OFMessage msg); |
| 65 | |
| 66 | /** |
| 67 | * Writes to the OFMessage list to the driver. |
| 68 | * |
| 69 | * @param msgs the messages to be written |
| 70 | */ |
| 71 | public void sendMsg(List<OFMessage> msgs); |
| 72 | |
| 73 | /** |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 74 | * Writes to the OFMessage list to the driver. |
| 75 | * TableType is used to determine the table ID for the OFMessage. |
| 76 | * The switch driver that supports multi-table should implement the function. |
| 77 | * |
| 78 | * @param msg the message to be written |
| 79 | * @param tableType the type of table in which the OFMessage needs to put |
| 80 | */ |
| 81 | public void sendMsg(OFMessage msg, TableType tableType); |
| 82 | |
| 83 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 84 | * Handle a message from the switch. |
| 85 | * @param fromSwitch the message to handle |
| 86 | */ |
| 87 | public void handleMessage(OFMessage fromSwitch); |
| 88 | |
| 89 | /** |
| 90 | * Sets the role for this switch. |
| 91 | * @param role the role to set. |
| 92 | */ |
| 93 | public void setRole(RoleState role); |
| 94 | |
| 95 | /** |
| 96 | * Fetch the role for this switch. |
| 97 | * @return the role. |
| 98 | */ |
| 99 | public RoleState getRole(); |
| 100 | |
| 101 | /** |
| 102 | * Fetches the ports of this switch. |
| 103 | * @return unmodifiable list of the ports. |
| 104 | */ |
| 105 | public List<OFPortDesc> getPorts(); |
| 106 | |
| 107 | /** |
| 108 | * Provides the factory for this OF version. |
| 109 | * @return OF version specific factory. |
| 110 | */ |
| 111 | public OFFactory factory(); |
| 112 | |
| 113 | /** |
| 114 | * Gets a string version of the ID for this switch. |
| 115 | * |
| 116 | * @return string version of the ID |
| 117 | */ |
| 118 | public String getStringId(); |
| 119 | |
| 120 | /** |
| 121 | * Gets the datapathId of the switch. |
| 122 | * |
| 123 | * @return the switch dpid in long format |
| 124 | */ |
| 125 | public long getId(); |
| 126 | |
| 127 | /** |
| 128 | * fetch the manufacturer description. |
| 129 | * @return the description |
| 130 | */ |
Ray Milkey | d3edd03 | 2015-01-16 11:38:58 -0800 | [diff] [blame] | 131 | public String manufacturerDescription(); |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 132 | |
| 133 | /** |
| 134 | * fetch the datapath description. |
| 135 | * @return the description |
| 136 | */ |
| 137 | public String datapathDescription(); |
| 138 | |
| 139 | /** |
| 140 | * fetch the hardware description. |
| 141 | * @return the description |
| 142 | */ |
| 143 | public String hardwareDescription(); |
| 144 | |
| 145 | /** |
| 146 | * fetch the software description. |
| 147 | * @return the description |
| 148 | */ |
| 149 | public String softwareDescription(); |
| 150 | |
| 151 | /** |
| 152 | * fetch the serial number. |
| 153 | * @return the serial |
| 154 | */ |
| 155 | public String serialNumber(); |
| 156 | |
| 157 | /** |
Yuta HIGUCHI | 69a2735 | 2014-10-31 15:48:37 -0700 | [diff] [blame] | 158 | * Checks if the switch is still connected. |
| 159 | * |
| 160 | * @return whether the switch is still connected |
| 161 | */ |
| 162 | public boolean isConnected(); |
| 163 | |
| 164 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 165 | * Disconnects the switch by closing the TCP connection. Results in a call |
| 166 | * to the channel handler's channelDisconnected method for cleanup |
| 167 | */ |
| 168 | public void disconnectSwitch(); |
| 169 | |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 170 | /** |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 171 | * 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] | 172 | * |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 173 | * @param requested the role requested by the controller |
| 174 | * @param response the role set at the device |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 175 | */ |
Yuta HIGUCHI | 5c94727 | 2014-11-03 21:39:21 -0800 | [diff] [blame] | 176 | public void returnRoleReply(RoleState requested, RoleState response); |
Praseed Balakrishnan | a22eadf | 2014-10-20 14:21:45 -0700 | [diff] [blame] | 177 | |
| 178 | /** |
| 179 | * Indicates if this switch is optical. |
| 180 | * |
| 181 | * @return true if optical |
| 182 | */ |
| 183 | public boolean isOptical(); |
| 184 | |
Ray Milkey | e53f171 | 2015-01-16 09:17:16 -0800 | [diff] [blame] | 185 | /** |
| 186 | * Identifies the channel used to communicate with the switch. |
Ray Milkey | f25d135 | 2015-01-23 15:14:08 -0800 | [diff] [blame] | 187 | * |
| 188 | * @return string representation of the connection to the device |
Ray Milkey | e53f171 | 2015-01-16 09:17:16 -0800 | [diff] [blame] | 189 | */ |
| 190 | public String channelId(); |
| 191 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 192 | } |