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.drivers; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 17 | |
Jonathan Hart | 2ffcd10 | 2015-01-16 16:47:50 -0800 | [diff] [blame] | 18 | import java.util.Collections; |
| 19 | import java.util.List; |
| 20 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 21 | import org.onosproject.openflow.controller.Dpid; |
| 22 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 23 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; |
Jonathan Hart | 2ffcd10 | 2015-01-16 16:47:50 -0800 | [diff] [blame] | 24 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 25 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 26 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
| 27 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 28 | /** |
| 29 | * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make |
| 30 | * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software : |
| 31 | * 1.11.90 (or whatever version + build) Serial : None |
| 32 | */ |
| 33 | public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch { |
| 34 | |
Jonathan Hart | 2ffcd10 | 2015-01-16 16:47:50 -0800 | [diff] [blame] | 35 | private static final int LOWEST_PRIORITY = 0; |
| 36 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 37 | public OFSwitchImplOVS10(Dpid dpid, OFDescStatsReply desc) { |
| 38 | super(dpid); |
| 39 | setSwitchDescription(desc); |
| 40 | |
| 41 | } |
| 42 | |
| 43 | /* (non-Javadoc) |
| 44 | * @see java.lang.Object#toString() |
| 45 | */ |
| 46 | @Override |
| 47 | public String toString() { |
| 48 | return "OFSwitchImplOVS10 [" + ((channel != null) |
| 49 | ? channel.getRemoteAddress() : "?") |
| 50 | + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]"; |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public Boolean supportNxRole() { |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | @Override |
Jonathan Hart | 2ffcd10 | 2015-01-16 16:47:50 -0800 | [diff] [blame] | 59 | public void startDriverHandshake() { |
| 60 | OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd(); |
| 61 | fmBuilder.setPriority(LOWEST_PRIORITY); |
| 62 | write(fmBuilder.build()); |
| 63 | } |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 64 | |
| 65 | @Override |
| 66 | public boolean isDriverHandshakeComplete() { |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public void processDriverHandshakeMessage(OFMessage m) {} |
| 72 | |
| 73 | @Override |
| 74 | public void write(OFMessage msg) { |
| 75 | channel.write(Collections.singletonList(msg)); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void write(List<OFMessage> msgs) { |
| 80 | channel.write(msgs); |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public List<OFPortDesc> getPorts() { |
| 85 | return Collections.unmodifiableList(features.getPorts()); |
| 86 | } |
| 87 | |
| 88 | |
| 89 | } |