Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 3 | * |
| 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 |
| 7 | * |
| 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. |
| 15 | */ |
| 16 | package org.onosproject.openflow; |
| 17 | |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 18 | import org.onosproject.net.Device; |
| 19 | import org.onosproject.net.driver.DriverData; |
| 20 | import org.onosproject.net.driver.DriverHandler; |
| 21 | import org.onosproject.openflow.controller.Dpid; |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 22 | import org.onosproject.openflow.controller.OpenFlowSession; |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 23 | import org.onosproject.openflow.controller.RoleState; |
| 24 | import org.onosproject.openflow.controller.driver.OpenFlowAgent; |
| 25 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; |
| 26 | import org.onosproject.openflow.controller.driver.RoleHandler; |
| 27 | import org.onosproject.openflow.controller.driver.SwitchStateException; |
| 28 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; |
| 29 | import org.projectfloodlight.openflow.protocol.OFErrorMsg; |
| 30 | import org.projectfloodlight.openflow.protocol.OFFactories; |
| 31 | import org.projectfloodlight.openflow.protocol.OFFactory; |
| 32 | import org.projectfloodlight.openflow.protocol.OFFeaturesReply; |
| 33 | import org.projectfloodlight.openflow.protocol.OFMessage; |
Jordi Ortiz | aa8de49 | 2016-12-01 00:21:36 +0100 | [diff] [blame] | 34 | import org.projectfloodlight.openflow.protocol.OFMeterFeatures; |
Jordi Ortiz | 91477b8 | 2016-11-29 15:22:50 +0100 | [diff] [blame] | 35 | import org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply; |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 36 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
| 37 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; |
| 38 | import org.projectfloodlight.openflow.protocol.OFVersion; |
| 39 | |
Jian Li | a78cdb2 | 2016-04-21 13:03:58 -0700 | [diff] [blame] | 40 | import java.util.List; |
| 41 | |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 42 | /** |
| 43 | * Testing adapter for the OpenFlow switch driver class. |
| 44 | */ |
| 45 | public class OpenflowSwitchDriverAdapter implements OpenFlowSwitchDriver { |
Ray Milkey | ca20bb5 | 2015-11-10 13:59:16 -0800 | [diff] [blame] | 46 | |
| 47 | RoleState role = RoleState.MASTER; |
| 48 | |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 49 | @Override |
| 50 | public void setAgent(OpenFlowAgent agent) { |
| 51 | |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void setRoleHandler(RoleHandler roleHandler) { |
| 56 | |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public void reassertRole() { |
| 61 | |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public boolean handleRoleError(OFErrorMsg error) { |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public void handleNiciraRole(OFMessage m) throws SwitchStateException { |
| 71 | |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public void handleRole(OFMessage m) throws SwitchStateException { |
| 76 | |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public boolean connectSwitch() { |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public boolean activateMasterSwitch() { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public boolean activateEqualSwitch() { |
| 91 | return false; |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public void transitionToEqualSwitch() { |
| 96 | |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public void transitionToMasterSwitch() { |
| 101 | |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public void removeConnectedSwitch() { |
| 106 | |
| 107 | } |
| 108 | |
| 109 | @Override |
| 110 | public void setPortDescReply(OFPortDescStatsReply portDescReply) { |
| 111 | |
| 112 | } |
| 113 | |
| 114 | @Override |
| 115 | public void setPortDescReplies(List<OFPortDescStatsReply> portDescReplies) { |
| 116 | |
| 117 | } |
| 118 | |
| 119 | @Override |
| 120 | public void setFeaturesReply(OFFeaturesReply featuresReply) { |
| 121 | |
| 122 | } |
| 123 | |
| 124 | @Override |
Jordi Ortiz | 91477b8 | 2016-11-29 15:22:50 +0100 | [diff] [blame] | 125 | public void setMeterFeaturesReply(OFMeterFeaturesStatsReply meterFeaturesReply) { |
| 126 | |
| 127 | } |
| 128 | |
| 129 | @Override |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 130 | public void setSwitchDescription(OFDescStatsReply desc) { |
| 131 | |
| 132 | } |
| 133 | |
| 134 | @Override |
| 135 | public int getNextTransactionId() { |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | @Override |
| 140 | public void setOFVersion(OFVersion ofV) { |
| 141 | |
| 142 | } |
| 143 | |
| 144 | @Override |
| 145 | public void setTableFull(boolean full) { |
| 146 | |
| 147 | } |
| 148 | |
| 149 | @Override |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 150 | public void setChannel(OpenFlowSession channel) { |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 151 | |
| 152 | } |
| 153 | |
| 154 | @Override |
| 155 | public void setConnected(boolean connected) { |
| 156 | |
| 157 | } |
| 158 | |
| 159 | @Override |
| 160 | public void init(Dpid dpid, OFDescStatsReply desc, OFVersion ofv) { |
| 161 | |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public Boolean supportNxRole() { |
| 166 | return true; |
| 167 | } |
| 168 | |
| 169 | @Override |
| 170 | public void startDriverHandshake() { |
| 171 | |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public boolean isDriverHandshakeComplete() { |
| 176 | return false; |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | public void processDriverHandshakeMessage(OFMessage m) { |
| 181 | |
| 182 | } |
| 183 | |
| 184 | @Override |
| 185 | public void sendRoleRequest(OFMessage message) { |
| 186 | |
| 187 | } |
| 188 | |
| 189 | @Override |
| 190 | public void sendHandshakeMessage(OFMessage message) { |
| 191 | |
| 192 | } |
| 193 | |
| 194 | @Override |
| 195 | public DriverHandler handler() { |
| 196 | return null; |
| 197 | } |
| 198 | |
| 199 | @Override |
| 200 | public void setHandler(DriverHandler handler) { |
| 201 | |
| 202 | } |
| 203 | |
| 204 | @Override |
| 205 | public DriverData data() { |
| 206 | return null; |
| 207 | } |
| 208 | |
| 209 | @Override |
| 210 | public void setData(DriverData data) { |
| 211 | |
| 212 | } |
| 213 | |
| 214 | @Override |
| 215 | public void sendMsg(OFMessage msg) { |
| 216 | |
| 217 | } |
| 218 | |
| 219 | @Override |
| 220 | public void sendMsg(List<OFMessage> msgs) { |
| 221 | |
| 222 | } |
| 223 | |
| 224 | @Override |
| 225 | public void handleMessage(OFMessage fromSwitch) { |
| 226 | |
| 227 | } |
| 228 | |
| 229 | @Override |
| 230 | public void setRole(RoleState role) { |
Ray Milkey | ca20bb5 | 2015-11-10 13:59:16 -0800 | [diff] [blame] | 231 | this.role = role; |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | @Override |
| 235 | public RoleState getRole() { |
Ray Milkey | ca20bb5 | 2015-11-10 13:59:16 -0800 | [diff] [blame] | 236 | return role; |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | @Override |
| 240 | public List<OFPortDesc> getPorts() { |
| 241 | return null; |
| 242 | } |
| 243 | |
| 244 | @Override |
Jordi Ortiz | aa8de49 | 2016-12-01 00:21:36 +0100 | [diff] [blame] | 245 | public OFMeterFeatures getMeterFeatures() { |
| 246 | return null; |
| 247 | } |
| 248 | |
| 249 | @Override |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 250 | public OFFactory factory() { |
| 251 | // return what-ever triggers requestPending = true |
| 252 | return OFFactories.getFactory(OFVersion.OF_10); |
| 253 | } |
| 254 | |
| 255 | @Override |
| 256 | public String getStringId() { |
| 257 | return "100"; |
| 258 | } |
| 259 | |
| 260 | @Override |
| 261 | public long getId() { |
| 262 | return 0; |
| 263 | } |
| 264 | |
| 265 | @Override |
| 266 | public String manufacturerDescription() { |
| 267 | return null; |
| 268 | } |
| 269 | |
| 270 | @Override |
| 271 | public String datapathDescription() { |
| 272 | return null; |
| 273 | } |
| 274 | |
| 275 | @Override |
| 276 | public String hardwareDescription() { |
| 277 | return null; |
| 278 | } |
| 279 | |
| 280 | @Override |
| 281 | public String softwareDescription() { |
| 282 | return null; |
| 283 | } |
| 284 | |
| 285 | @Override |
| 286 | public String serialNumber() { |
| 287 | return null; |
| 288 | } |
| 289 | |
| 290 | @Override |
| 291 | public boolean isConnected() { |
| 292 | return false; |
| 293 | } |
| 294 | |
| 295 | @Override |
| 296 | public void disconnectSwitch() { |
| 297 | |
| 298 | } |
| 299 | |
| 300 | @Override |
| 301 | public void returnRoleReply(RoleState requested, RoleState response) { |
| 302 | |
| 303 | } |
| 304 | |
| 305 | @Override |
| 306 | public Device.Type deviceType() { |
| 307 | return Device.Type.SWITCH; |
| 308 | } |
| 309 | |
| 310 | @Override |
| 311 | public String channelId() { |
| 312 | return null; |
| 313 | } |
Ray Milkey | 7f9e020 | 2015-11-04 17:14:09 -0800 | [diff] [blame] | 314 | } |