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 | /** |
| 30 | * Writes the message to the driver. |
| 31 | * |
| 32 | * @param msg the message to write |
| 33 | */ |
| 34 | public void sendMsg(OFMessage msg); |
| 35 | |
| 36 | /** |
| 37 | * Writes to the OFMessage list to the driver. |
| 38 | * |
| 39 | * @param msgs the messages to be written |
| 40 | */ |
| 41 | public void sendMsg(List<OFMessage> msgs); |
| 42 | |
| 43 | /** |
| 44 | * Handle a message from the switch. |
| 45 | * @param fromSwitch the message to handle |
| 46 | */ |
| 47 | public void handleMessage(OFMessage fromSwitch); |
| 48 | |
| 49 | /** |
| 50 | * Sets the role for this switch. |
| 51 | * @param role the role to set. |
| 52 | */ |
| 53 | public void setRole(RoleState role); |
| 54 | |
| 55 | /** |
| 56 | * Fetch the role for this switch. |
| 57 | * @return the role. |
| 58 | */ |
| 59 | public RoleState getRole(); |
| 60 | |
| 61 | /** |
| 62 | * Fetches the ports of this switch. |
| 63 | * @return unmodifiable list of the ports. |
| 64 | */ |
| 65 | public List<OFPortDesc> getPorts(); |
| 66 | |
| 67 | /** |
| 68 | * Provides the factory for this OF version. |
| 69 | * @return OF version specific factory. |
| 70 | */ |
| 71 | public OFFactory factory(); |
| 72 | |
| 73 | /** |
| 74 | * Gets a string version of the ID for this switch. |
| 75 | * |
| 76 | * @return string version of the ID |
| 77 | */ |
| 78 | public String getStringId(); |
| 79 | |
| 80 | /** |
| 81 | * Gets the datapathId of the switch. |
| 82 | * |
| 83 | * @return the switch dpid in long format |
| 84 | */ |
| 85 | public long getId(); |
| 86 | |
| 87 | /** |
| 88 | * fetch the manufacturer description. |
| 89 | * @return the description |
| 90 | */ |
| 91 | public String manfacturerDescription(); |
| 92 | |
| 93 | /** |
| 94 | * fetch the datapath description. |
| 95 | * @return the description |
| 96 | */ |
| 97 | public String datapathDescription(); |
| 98 | |
| 99 | /** |
| 100 | * fetch the hardware description. |
| 101 | * @return the description |
| 102 | */ |
| 103 | public String hardwareDescription(); |
| 104 | |
| 105 | /** |
| 106 | * fetch the software description. |
| 107 | * @return the description |
| 108 | */ |
| 109 | public String softwareDescription(); |
| 110 | |
| 111 | /** |
| 112 | * fetch the serial number. |
| 113 | * @return the serial |
| 114 | */ |
| 115 | public String serialNumber(); |
| 116 | |
| 117 | /** |
Yuta HIGUCHI | 69a2735 | 2014-10-31 15:48:37 -0700 | [diff] [blame] | 118 | * Checks if the switch is still connected. |
| 119 | * |
| 120 | * @return whether the switch is still connected |
| 121 | */ |
| 122 | public boolean isConnected(); |
| 123 | |
| 124 | /** |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 125 | * Disconnects the switch by closing the TCP connection. Results in a call |
| 126 | * to the channel handler's channelDisconnected method for cleanup |
| 127 | */ |
| 128 | public void disconnectSwitch(); |
| 129 | |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 130 | /** |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 131 | * 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] | 132 | * |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 133 | * @param requested the role requested by the controller |
| 134 | * @param response the role set at the device |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 135 | */ |
Yuta HIGUCHI | 5c94727 | 2014-11-03 21:39:21 -0800 | [diff] [blame] | 136 | public void returnRoleReply(RoleState requested, RoleState response); |
Praseed Balakrishnan | a22eadf | 2014-10-20 14:21:45 -0700 | [diff] [blame] | 137 | |
| 138 | /** |
| 139 | * Indicates if this switch is optical. |
| 140 | * |
| 141 | * @return true if optical |
| 142 | */ |
| 143 | public boolean isOptical(); |
| 144 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 145 | } |