/** * send a table features request */ private void sendHandshakeTableFeaturesRequest() { OFTableFeaturesStatsRequest tfsr = factory.buildTableFeaturesStatsRequest() /* leave entries blank --> just ask, don't set */ .setXid(handshakeTransactionIds--) .build(); mainConnection.write(tfsr); }
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); }