blob: 0b1dc2be42a2f90ca8fab40bacc2fb4ae5aa5272 [file] [log] [blame]
alshabibb452fd72015-04-22 20:46:20 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
alshabibb452fd72015-04-22 20:46:20 -07003 *
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 */
16package org.onosproject.driver.handshaker;
17
18import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch;
19import org.projectfloodlight.openflow.protocol.OFFlowAdd;
20import org.projectfloodlight.openflow.protocol.OFMessage;
alshabibb452fd72015-04-22 20:46:20 -070021import org.projectfloodlight.openflow.protocol.OFVersion;
22
alshabibb452fd72015-04-22 20:46:20 -070023/**
24 * Default driver to fallback on if no other driver is available.
25 */
Madan Jampani1b8ea342015-05-27 17:22:59 -070026public class DefaultSwitchHandshaker extends AbstractOpenFlowSwitch {
alshabibb452fd72015-04-22 20:46:20 -070027
28 private static final int LOWEST_PRIORITY = 0;
29
30 @Override
31 public Boolean supportNxRole() {
alshabibb452fd72015-04-22 20:46:20 -070032 return false;
33 }
34
35 @Override
36 public void startDriverHandshake() {
37 if (factory().getVersion() == OFVersion.OF_10) {
38 OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd();
39 fmBuilder.setPriority(LOWEST_PRIORITY);
alshabiba2df7b2a2015-05-06 13:57:10 -070040 sendHandshakeMessage(fmBuilder.build());
alshabibb452fd72015-04-22 20:46:20 -070041 }
42 }
43
44 @Override
45 public void processDriverHandshakeMessage(OFMessage m) {}
46
47 @Override
48 public boolean isDriverHandshakeComplete() {
49 return true;
50 }
alshabibb452fd72015-04-22 20:46:20 -070051}