public void verifyPortChangedUpdateInQueue(IOFSwitch sw) throws Exception { assertEquals(1, controller.updates.size()); IUpdate update = controller.updates.take(); assertEquals(true, update instanceof SwitchUpdate); SwitchUpdate swUpdate = (SwitchUpdate)update; assertEquals(sw, swUpdate.sw); assertEquals(SwitchUpdateType.PORTCHANGED, swUpdate.switchUpdateType); }
private void doTestUpdateQueueWithUpdate(long dpid, SwitchUpdateType type, DummySwitchListener listener) throws InterruptedException { controller.updates.put(controller.new SwitchUpdate(dpid, type)); synchronized (listener) { listener.wait(500); } // Test that the update was seen by the listener 1 time assertEquals(1, listener.getSwitchUpdateCount(type)); }
private void doTestUpdateQueueWithPortUpdate(long dpid, OFPortDesc port, PortChangeType type, DummySwitchListener listener) throws InterruptedException { controller.updates.put(controller.new SwitchUpdate(dpid, SwitchUpdateType.PORTCHANGED, port, type)); synchronized (listener) { listener.wait(500); } // Test that the update was seen by the listener 1 time assertEquals(1, listener.getPortUpdateCount(type)); }
private void doTestNotifyPortChanged(long dpid, OFPortDesc port, PortChangeType changeType) throws InterruptedException { controller.notifyPortChanged(dpid, port, changeType); assertEquals(1, controller.updates.size()); IUpdate update = controller.updates.take(); assertEquals(true, update instanceof SwitchUpdate); SwitchUpdate swUpdate = (SwitchUpdate) update; assertEquals(dpid, swUpdate.getSwId()); assertEquals(SwitchUpdateType.PORTCHANGED, swUpdate.getSwitchUpdateType()); assertEquals(changeType, swUpdate.getPortChangeType()); }