public void handleDescStatsAndCreateSwitch(boolean subHandShakeComplete) throws Exception { // build the stats reply OFDescStatsReply sr = createDescriptionStatsReply(); reset(sw); SwitchDescription switchDescription = new SwitchDescription(sr); setupSwitchForInstantiationWithReset(); sw.setPortDescStats(anyObject(OFPortDescStatsReply.class)); expectLastCall().once(); sw.startDriverHandshake(); expectLastCall().once(); expect(sw.isDriverHandshakeComplete()).andReturn(subHandShakeComplete).once(); replay(sw); reset(switchManager); expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes(); expect( switchManager.getOFSwitchInstance(anyObject(OFConnection.class), eq(switchDescription), anyObject(OFFactory.class), anyObject(DatapathId.class))).andReturn(sw).once(); expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); switchManager.switchAdded(sw); expectLastCall().once(); replay(switchManager); // send the description stats reply switchHandler.processOFMessage(sr); verify(sw, switchManager); }
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception { // build the stats reply OFDescStatsReply sr = createDescriptionStatsReply(); reset(sw); SwitchDescription switchDescription = new SwitchDescription(sr); setupSwitchForInstantiationWithReset(); sw.startDriverHandshake(); expectLastCall().once(); sw.isDriverHandshakeComplete(); expectLastCall().andReturn(switchDriverComplete).once(); if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) { sw.setPortDescStats(anyObject(OFPortDescStatsReply.class)); expectLastCall().once(); } replay(sw); reset(switchManager); expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes(); expect( switchManager.getOFSwitchInstance(anyObject(OFConnection.class), eq(switchDescription), anyObject(OFFactory.class), anyObject(DatapathId.class))).andReturn(sw).once(); switchManager.switchAdded(sw); expectLastCall().once(); replay(switchManager); // send the description stats reply switchHandler.processOFMessage(sr); }
public void handleDescStatsAndCreateSwitch() throws Exception { // build the stats reply OFDescStatsReply sr = createDescriptionStatsReply(); reset(sw); SwitchDescription switchDescription = new SwitchDescription(sr); setupSwitchForInstantiationWithReset(); sw.setPortDescStats(anyObject(OFPortDescStatsReply.class)); expectLastCall().once(); expect(sw.getOFFactory()).andReturn(factory).once(); replay(sw); reset(switchManager); expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes(); expect( switchManager.getOFSwitchInstance(anyObject(OFConnection.class), eq(switchDescription), anyObject(OFFactory.class), anyObject(DatapathId.class))).andReturn(sw).once(); expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); switchManager.switchAdded(sw); expectLastCall().once(); replay(switchManager); // send the description stats reply switchHandler.processOFMessage(sr); OFMessage msg = connection.retrieveMessage(); assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class)); verifyUniqueXids(msg); verify(sw, switchManager); }
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception { // build the stats reply OFDescStatsReply sr = createDescriptionStatsReply(); reset(sw); SwitchDescription switchDescription = new SwitchDescription(sr); setupSwitchForInstantiationWithReset(); sw.startDriverHandshake(); expectLastCall().once(); expect(sw.getOFFactory()).andReturn(factory).once(); sw.isDriverHandshakeComplete(); expectLastCall().andReturn(switchDriverComplete).once(); if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) { sw.setPortDescStats(anyObject(OFPortDescStatsReply.class)); expectLastCall().once(); } replay(sw); reset(switchManager); expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes(); expect( switchManager.getOFSwitchInstance(anyObject(OFConnection.class), eq(switchDescription), anyObject(OFFactory.class), anyObject(DatapathId.class))).andReturn(sw).once(); switchManager.switchAdded(sw); expectLastCall().once(); replay(switchManager); // send the description stats reply switchHandler.processOFMessage(sr); }
/** * Notifies the channel listener that we have a valid baseline connection */ private final void notifyConnectionOpened(OFConnection connection){ this.connection = connection; this.newConnectionListener.connectionOpened(connection, featuresReply); }
/** * Notifies the channel listener that we our connection has been closed */ private final void notifyConnectionClosed(OFConnection connection){ connection.getListener().connectionClosed(connection); }
@Override public OFConnection getConnectionByCategory( LogicalOFMessageCategory category) { // TODO Auto-generated method stub return null; }
@Override public OFConnection getConnectionByCategory(LogicalOFMessageCategory category) { // TODO Auto-generated method stub return null; }