Java 类net.floodlightcontroller.core.internal.Controller.SwitchUpdateType 实例源码

项目:Multipath-Hedera-system-in-Floodlight-controller    文件:ControllerTest.java   
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);
}
项目:smartenit    文件:ControllerTest.java   
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);
}
项目:spring-open    文件:ControllerTest.java   
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));
}
项目:spring-open    文件:ControllerTest.java   
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));
}
项目:spring-open    文件:ControllerTest.java   
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());
}
项目:floodlight-qosmanager    文件:ControllerTest.java   
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);
}
项目:floodlight-nfv    文件:ControllerTest.java   
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);
}
项目:HederaInFloodlight    文件:ControllerTest.java   
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);
}
项目:floodlight-oss    文件:ControllerTest.java   
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);
}
项目:my-floodlight    文件:ControllerTest.java   
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);
}
项目:FL_HAND    文件:ControllerTest.java   
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);
}
项目:sdn-project    文件:ControllerTest.java   
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);
}
项目:spring-open    文件:ControllerTest.java   
@Override
public synchronized void switchActivatedMaster(long swId) {
    updateCount.add(SwitchUpdateType.ACTIVATED_MASTER);
    notifyAll();
}
项目:spring-open    文件:ControllerTest.java   
@Override
public synchronized void switchActivatedEqual(long swId) {
    updateCount.add(SwitchUpdateType.ACTIVATED_EQUAL);
    notifyAll();
}
项目:spring-open    文件:ControllerTest.java   
@Override
public synchronized void switchMasterToEqual(long swId) {
    updateCount.add(SwitchUpdateType.MASTER_TO_EQUAL);
    notifyAll();
}
项目:spring-open    文件:ControllerTest.java   
@Override
public synchronized void switchEqualToMaster(long swId) {
    updateCount.add(SwitchUpdateType.EQUAL_TO_MASTER);
    notifyAll();
}
项目:spring-open    文件:ControllerTest.java   
@Override
public synchronized void switchDisconnected(long swId) {
    updateCount.add(SwitchUpdateType.DISCONNECTED);
    notifyAll();
}
项目:spring-open    文件:ControllerTest.java   
/**
 * Tests that updates sent into the Controller updates queue are dispatched
 * to the listeners correctly.
 *
 * @throws InterruptedException
 */
@Test
public void testUpdateQueue() throws InterruptedException {
    // No difference between OpenFlow versions here
    OFVersion version = OFVersion.OF_10;
    OFPortDesc port = OFFactories.getFactory(version)
            .buildPortDesc().build();
    long dpid = 1L;

    DummySwitchListener switchListener = new DummySwitchListener();
    IOFSwitch sw = createMockSwitch(dpid, version);
    replay(sw);
    ControllerRunThread t = new ControllerRunThread();
    t.start();

    controller.addOFSwitchListener(switchListener);

    // Switch updates
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.ACTIVATED_MASTER,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.ACTIVATED_EQUAL,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.EQUAL_TO_MASTER,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.MASTER_TO_EQUAL,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.DISCONNECTED,
            switchListener);

    // Port updates
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.ADD,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.OTHER_UPDATE,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.DELETE,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.UP,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.DOWN,
            switchListener);
}
项目:spring-open    文件:ControllerTest.java   
/**
 * Gets the number of times a switch update event of the specified type
 * has been received.
 *
 * @param type SwitchUpdateType to get the count for
 * @return number of times the event has been received
 */
public int getSwitchUpdateCount(SwitchUpdateType type) {
    return updateCount.count(type);
}