Jonathan Hart

Retrieving handshaker drivers should respect driver annotation.

ONOS-2404.

Ported from onos-1.2 branch.

Change-Id: Ib0cd76790612216030a9dd50ed434253d8202868
...@@ -21,6 +21,8 @@ import org.jboss.netty.channel.ChannelPipelineFactory; ...@@ -21,6 +21,8 @@ import org.jboss.netty.channel.ChannelPipelineFactory;
21 import org.jboss.netty.channel.group.ChannelGroup; 21 import org.jboss.netty.channel.group.ChannelGroup;
22 import org.jboss.netty.channel.group.DefaultChannelGroup; 22 import org.jboss.netty.channel.group.DefaultChannelGroup;
23 import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; 23 import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
24 +import org.onlab.util.ItemNotFoundException;
25 +import org.onosproject.net.DeviceId;
24 import org.onosproject.net.driver.DefaultDriverData; 26 import org.onosproject.net.driver.DefaultDriverData;
25 import org.onosproject.net.driver.DefaultDriverHandler; 27 import org.onosproject.net.driver.DefaultDriverHandler;
26 import org.onosproject.net.driver.Driver; 28 import org.onosproject.net.driver.Driver;
...@@ -206,8 +208,14 @@ public class Controller { ...@@ -206,8 +208,14 @@ public class Controller {
206 protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, 208 protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid,
207 OFDescStatsReply desc, 209 OFDescStatsReply desc,
208 OFVersion ofv) { 210 OFVersion ofv) {
209 - Driver driver = driverService 211 + Dpid dpidObj = new Dpid(dpid);
210 - .getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); 212 +
213 + Driver driver;
214 + try {
215 + driver = driverService.getDriver(DeviceId.deviceId(Dpid.uri(dpidObj)));
216 + } catch (ItemNotFoundException e) {
217 + driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc());
218 + }
211 219
212 if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) { 220 if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) {
213 Dpid did = new Dpid(dpid); 221 Dpid did = new Dpid(dpid);
......