blob: 38fe65fb09e19d6fdcde7987768f631ff5176bbc [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska781d18b2014-10-27 10:31:25 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.openflow.drivers;
tom7ef8ff92014-09-17 13:08:06 -070017
Jonathan Hart2ffcd102015-01-16 16:47:50 -080018import java.util.Collections;
19import java.util.List;
20
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.openflow.controller.Dpid;
22import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch;
tom7ef8ff92014-09-17 13:08:06 -070023import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
Jonathan Hart2ffcd102015-01-16 16:47:50 -080024import org.projectfloodlight.openflow.protocol.OFFlowAdd;
tom7ef8ff92014-09-17 13:08:06 -070025import org.projectfloodlight.openflow.protocol.OFMessage;
26import org.projectfloodlight.openflow.protocol.OFPortDesc;
Saurav Dasfa2fa932015-03-03 11:29:48 -080027import org.projectfloodlight.openflow.types.TableId;
tom7ef8ff92014-09-17 13:08:06 -070028
tom7ef8ff92014-09-17 13:08:06 -070029/**
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 */
34public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch {
35
Jonathan Hart2ffcd102015-01-16 16:47:50 -080036 private static final int LOWEST_PRIORITY = 0;
37
tom7ef8ff92014-09-17 13:08:06 -070038 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 Hart2ffcd102015-01-16 16:47:50 -080060 public void startDriverHandshake() {
61 OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd();
62 fmBuilder.setPriority(LOWEST_PRIORITY);
63 write(fmBuilder.build());
64 }
tom7ef8ff92014-09-17 13:08:06 -070065
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 Dasfa2fa932015-03-03 11:29:48 -080089 @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 }
tom7ef8ff92014-09-17 13:08:06 -070099
100}