Retrieving handshaker drivers should respect driver annotation.
ONOS-2404. Change-Id: Ib0cd76790612216030a9dd50ed434253d8202868
Showing
1 changed file
with
11 additions
and
3 deletions
| ... | @@ -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; |
| ... | @@ -204,13 +206,19 @@ public class Controller { | ... | @@ -204,13 +206,19 @@ public class Controller { |
| 204 | protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, | 206 | protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, |
| 205 | OFDescStatsReply desc, | 207 | OFDescStatsReply desc, |
| 206 | OFVersion ofv) { | 208 | OFVersion ofv) { |
| 207 | - Driver driver = driverService | 209 | + Dpid dpidObj = new Dpid(dpid); |
| 208 | - .getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); | 210 | + |
| 211 | + Driver driver; | ||
| 212 | + try { | ||
| 213 | + driver = driverService.getDriver(DeviceId.deviceId(Dpid.uri(dpidObj))); | ||
| 214 | + } catch (ItemNotFoundException e) { | ||
| 215 | + driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); | ||
| 216 | + } | ||
| 209 | 217 | ||
| 210 | if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) { | 218 | if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) { |
| 211 | OpenFlowSwitchDriver ofSwitchDriver = driver.createBehaviour(new DefaultDriverHandler( | 219 | OpenFlowSwitchDriver ofSwitchDriver = driver.createBehaviour(new DefaultDriverHandler( |
| 212 | new DefaultDriverData(driver)), OpenFlowSwitchDriver.class); | 220 | new DefaultDriverData(driver)), OpenFlowSwitchDriver.class); |
| 213 | - ofSwitchDriver.init(new Dpid(dpid), desc, ofv); | 221 | + ofSwitchDriver.init(dpidObj, desc, ofv); |
| 214 | ofSwitchDriver.setAgent(agent); | 222 | ofSwitchDriver.setAgent(agent); |
| 215 | ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver)); | 223 | ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver)); |
| 216 | log.info("OpenFlow handshaker found for device {}: {}", dpid, ofSwitchDriver); | 224 | log.info("OpenFlow handshaker found for device {}: {}", dpid, ofSwitchDriver); | ... | ... |
-
Please register or login to post a comment