blob: a017abeb444c545923fd0bba8f49c2293b7c0d36 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 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;
27
tom7ef8ff92014-09-17 13:08:06 -070028/**
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 */
33public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch {
34
Jonathan Hart2ffcd102015-01-16 16:47:50 -080035 private static final int LOWEST_PRIORITY = 0;
36
tom7ef8ff92014-09-17 13:08:06 -070037 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 Hart2ffcd102015-01-16 16:47:50 -080059 public void startDriverHandshake() {
60 OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd();
61 fmBuilder.setPriority(LOWEST_PRIORITY);
62 write(fmBuilder.build());
63 }
tom7ef8ff92014-09-17 13:08:06 -070064
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}