Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 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; |
Saurav Das | fa2fa93 | 2015-03-03 11:29:48 -0800 | [diff] [blame] | 27 | import org.projectfloodlight.openflow.types.TableId; |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 28 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 29 | /** |
| 30 | * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make |
| 31 | * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software : |
| 32 | * 1.11.90 (or whatever version + build) Serial : None |
| 33 | */ |
| 34 | public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch { |
| 35 | |
Jonathan Hart | 2ffcd10 | 2015-01-16 16:47:50 -0800 | [diff] [blame] | 36 | private static final int LOWEST_PRIORITY = 0; |
| 37 | |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 38 | public OFSwitchImplOVS10(Dpid dpid, OFDescStatsReply desc) { |
| 39 | super(dpid); |
| 40 | setSwitchDescription(desc); |
| 41 | |
| 42 | } |
| 43 | |
| 44 | /* (non-Javadoc) |
| 45 | * @see java.lang.Object#toString() |
| 46 | */ |
| 47 | @Override |
| 48 | public String toString() { |
| 49 | return "OFSwitchImplOVS10 [" + ((channel != null) |
| 50 | ? channel.getRemoteAddress() : "?") |
| 51 | + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]"; |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public Boolean supportNxRole() { |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | @Override |
Jonathan Hart | 2ffcd10 | 2015-01-16 16:47:50 -0800 | [diff] [blame] | 60 | public void startDriverHandshake() { |
| 61 | OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd(); |
| 62 | fmBuilder.setPriority(LOWEST_PRIORITY); |
| 63 | write(fmBuilder.build()); |
| 64 | } |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 65 | |
| 66 | @Override |
| 67 | public boolean isDriverHandshakeComplete() { |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public void processDriverHandshakeMessage(OFMessage m) {} |
| 73 | |
| 74 | @Override |
| 75 | public void write(OFMessage msg) { |
| 76 | channel.write(Collections.singletonList(msg)); |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public void write(List<OFMessage> msgs) { |
| 81 | channel.write(msgs); |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public List<OFPortDesc> getPorts() { |
| 86 | return Collections.unmodifiableList(features.getPorts()); |
| 87 | } |
| 88 | |
Saurav Das | fa2fa93 | 2015-03-03 11:29:48 -0800 | [diff] [blame] | 89 | @Override |
| 90 | public TableType getTableType(TableId tid) { |
| 91 | return TableType.NONE; |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public void transformAndSendMsg(OFMessage msg, TableType tableType) { |
| 96 | // TODO Auto-generated method stub |
| 97 | |
| 98 | } |
tom | 7ef8ff9 | 2014-09-17 13:08:06 -0700 | [diff] [blame] | 99 | |
| 100 | } |