Java 类net.floodlightcontroller.core.internal.RoleChanger.PendingRoleRequestEntry 实例源码

项目:floodlight-nfv    文件:ControllerTest.java   
protected void setupPendingRoleRequest(IOFSwitch sw, int xid, Role role,
        long cookie) {
    LinkedList<PendingRoleRequestEntry> pendingList =
            new LinkedList<PendingRoleRequestEntry>();
    controller.roleChanger.pendingRequestMap.put(sw, pendingList);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(xid, role, cookie);
    pendingList.add(entry);
}
项目:floodlight-nfv    文件:RoleChangerTest.java   
@Test
public void testVerifyRoleReplyReceived() throws Exception {
    Collection<IOFSwitch> switches = new LinkedList<IOFSwitch>();

    // Add a switch that has received a role reply
    IOFSwitch sw1 = EasyMock.createMock(IOFSwitch.class);
    LinkedList<PendingRoleRequestEntry> pendingList1 =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw1, pendingList1);
    switches.add(sw1);

    // Add a switch that has not yet received a role reply
    IOFSwitch sw2 = EasyMock.createMock(IOFSwitch.class);
    LinkedList<PendingRoleRequestEntry> pendingList2 =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw2, pendingList2);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(1, Role.MASTER, 123456);
    pendingList2.add(entry);
    // Timed out switch should become active
    expect(sw2.getAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA))
            .andReturn(null);
    expect(sw2.getHARole()).andReturn(null);
    sw2.setHARole(Role.MASTER, false);
    EasyMock.expectLastCall();
    switches.add(sw2);


    replay(sw1, sw2);
    roleChanger.verifyRoleReplyReceived(switches, 123456);
    verify(sw1, sw2);

    assertEquals(2, switches.size());
}
项目:floodlight-nfv    文件:RoleChangerTest.java   
protected void setupPendingRoleRequest(IOFSwitch sw, int xid, Role role,
        long cookie) {
    LinkedList<PendingRoleRequestEntry> pendingList =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw, pendingList);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(xid, role, cookie);
    pendingList.add(entry);
}
项目:floodlight-oss    文件:ControllerTest.java   
protected void setupPendingRoleRequest(IOFSwitch sw, int xid, Role role,
        long cookie) {
    LinkedList<PendingRoleRequestEntry> pendingList =
            new LinkedList<PendingRoleRequestEntry>();
    controller.roleChanger.pendingRequestMap.put(sw, pendingList);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(xid, role, cookie);
    pendingList.add(entry);
}
项目:floodlight-oss    文件:RoleChangerTest.java   
@Test
public void testVerifyRoleReplyReceived() throws Exception {
    Collection<IOFSwitch> switches = new LinkedList<IOFSwitch>();

    // Add a switch that has received a role reply
    IOFSwitch sw1 = EasyMock.createMock(IOFSwitch.class);
    LinkedList<PendingRoleRequestEntry> pendingList1 =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw1, pendingList1);
    switches.add(sw1);

    // Add a switch that has not yet received a role reply
    IOFSwitch sw2 = EasyMock.createMock(IOFSwitch.class);
    LinkedList<PendingRoleRequestEntry> pendingList2 =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw2, pendingList2);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(1, Role.MASTER, 123456);
    pendingList2.add(entry);
    // Timed out switch should become active
    expect(sw2.getAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA))
            .andReturn(null);
    expect(sw2.getHARole()).andReturn(null);
    sw2.setHARole(Role.MASTER, false);
    EasyMock.expectLastCall();
    switches.add(sw2);


    replay(sw1, sw2);
    roleChanger.verifyRoleReplyReceived(switches, 123456);
    verify(sw1, sw2);

    assertEquals(2, switches.size());
}
项目:floodlight-oss    文件:RoleChangerTest.java   
protected void setupPendingRoleRequest(IOFSwitch sw, int xid, Role role,
        long cookie) {
    LinkedList<PendingRoleRequestEntry> pendingList =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw, pendingList);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(xid, role, cookie);
    pendingList.add(entry);
}
项目:FL_HAND    文件:ControllerTest.java   
protected void setupPendingRoleRequest(IOFSwitch sw, int xid, Role role,
        long cookie) {
    LinkedList<PendingRoleRequestEntry> pendingList =
            new LinkedList<PendingRoleRequestEntry>();
    controller.roleChanger.pendingRequestMap.put(sw, pendingList);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(xid, role, cookie);
    pendingList.add(entry);
}
项目:FL_HAND    文件:RoleChangerTest.java   
@Test
public void testVerifyRoleReplyReceived() throws Exception {
    Collection<IOFSwitch> switches = new LinkedList<IOFSwitch>();

    // Add a switch that has received a role reply
    IOFSwitch sw1 = EasyMock.createMock(IOFSwitch.class);
    LinkedList<PendingRoleRequestEntry> pendingList1 =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw1, pendingList1);
    switches.add(sw1);

    // Add a switch that has not yet received a role reply
    IOFSwitch sw2 = EasyMock.createMock(IOFSwitch.class);
    LinkedList<PendingRoleRequestEntry> pendingList2 =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw2, pendingList2);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(1, Role.MASTER, 123456);
    pendingList2.add(entry);
    // Timed out switch should become active
    expect(sw2.getAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA))
            .andReturn(null);
    expect(sw2.getHARole()).andReturn(null);
    sw2.setHARole(Role.MASTER, false);
    EasyMock.expectLastCall();
    switches.add(sw2);


    replay(sw1, sw2);
    roleChanger.verifyRoleReplyReceived(switches, 123456);
    verify(sw1, sw2);

    assertEquals(2, switches.size());
}
项目:FL_HAND    文件:RoleChangerTest.java   
protected void setupPendingRoleRequest(IOFSwitch sw, int xid, Role role,
        long cookie) {
    LinkedList<PendingRoleRequestEntry> pendingList =
            new LinkedList<PendingRoleRequestEntry>();
    roleChanger.pendingRequestMap.put(sw, pendingList);
    PendingRoleRequestEntry entry =
            new PendingRoleRequestEntry(xid, role, cookie);
    pendingList.add(entry);
}