Java 类org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleReply 实例源码

项目:athena    文件:RoleManager.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param experimenterMsg message
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 * @throws SwitchStateException If the message is a Nicira role reply
 * but the numeric role value is unknown.
 */
@Override
public RoleState extractNiciraRoleReply(OFExperimenter experimenterMsg)
        throws SwitchStateException {
    int vendor = (int) experimenterMsg.getExperimenter();
    if (vendor != 0x2320) {
        return null;
    }
    OFNiciraControllerRoleReply nrr =
            (OFNiciraControllerRoleReply) experimenterMsg;

    RoleState role = null;
    OFNiciraControllerRole ncr = nrr.getRole();
    switch (ncr) {
    case ROLE_MASTER:
        role = RoleState.MASTER;
        break;
    case ROLE_OTHER:
        role = RoleState.EQUAL;
        break;
    case ROLE_SLAVE:
        role = RoleState.SLAVE;
        break;
    default: //handled below
    }

    if (role == null) {
        String msg = String.format("Switch: [%s], "
                + "received NX_ROLE_REPLY with invalid role "
                + "value %s",
                sw.getStringId(),
                nrr.getRole());
        throw new SwitchStateException(msg);
    }
    return role;
}
项目:fresco_floodlight    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:iTAP-controller    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:SDN-Multicast    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:arscheduler    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:arscheduler    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:floodlight1.2-delay    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:floodlight-hardware    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:ACAMPController    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:ACAMPController    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:fast-failover-demo    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:fast-failover-demo    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:ravikumaran201504    文件:RoleManager.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param experimenterMsg message
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 * @throws SwitchStateException If the message is a Nicira role reply
 * but the numeric role value is unknown.
 */
@Override
public RoleState extractNiciraRoleReply(OFExperimenter experimenterMsg)
        throws SwitchStateException {
    int vendor = (int) experimenterMsg.getExperimenter();
    if (vendor != 0x2320) {
        return null;
    }
    OFNiciraControllerRoleReply nrr =
            (OFNiciraControllerRoleReply) experimenterMsg;

    RoleState role = null;
    OFNiciraControllerRole ncr = nrr.getRole();
    switch (ncr) {
    case ROLE_MASTER:
        role = RoleState.MASTER;
        break;
    case ROLE_OTHER:
        role = RoleState.EQUAL;
        break;
    case ROLE_SLAVE:
        role = RoleState.SLAVE;
        break;
    default: //handled below
    }

    if (role == null) {
        String msg = String.format("Switch: [%s], "
                + "received NX_ROLE_REPLY with invalid role "
                + "value %s",
                sw.getStringId(),
                nrr.getRole());
        throw new SwitchStateException(msg);
    }
    return role;
}
项目:floodlightLB    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:floodlightLB    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:DSC    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:DSC    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:floodlight    文件:NiciraRoleUtils.java   
public static OFControllerRole niciraToOFRole(OFNiciraControllerRoleReply roleReply) {
    switch(roleReply.getRole()) {
        case ROLE_MASTER:
            return OFControllerRole.ROLE_MASTER;
        case ROLE_OTHER:
            return OFControllerRole.ROLE_EQUAL;
        case ROLE_SLAVE:
            return OFControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("unknown Nicira role value: " + roleReply.getRole());
    }
}
项目:floodlight    文件:OFSwitchHandshakeHandlerVer10Test.java   
@Override
protected OFMessage getRoleReply(long xid, OFControllerRole role) {
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setXid(xid)
            .setRole(NiciraRoleUtils.ofRoleToNiciraRole(role))
            .build();
    return roleReply;
}
项目:spring-open    文件:OFChannelHandler.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a Nicira
 * role reply. Otherwise return null.
 *
 * @param h The channel handler receiving the message
 * @param vendorMessage The vendor message to parse.
 * @return The role in the message if the message is a Nicira role
 *         reply, null otherwise.
 * @throws SwitchStateException If the message is a Nicira role reply
 *         but the numeric role value is unknown.
 */
protected Role extractNiciraRoleReply(OFChannelHandler h,
        OFExperimenter experimenterMsg) throws SwitchStateException {
    int vendor = (int) experimenterMsg.getExperimenter();
    if (vendor != 0x2320) // magic number representing nicira
        return null;
    OFNiciraControllerRoleReply nrr =
            (OFNiciraControllerRoleReply) experimenterMsg;

    Role role = null;
    OFNiciraControllerRole ncr = nrr.getRole();
    switch (ncr) {
    case ROLE_MASTER:
        role = Role.MASTER;
        break;
    case ROLE_OTHER:
        role = Role.EQUAL;
        break;
    case ROLE_SLAVE:
        role = Role.SLAVE;
        break;
    default: // handled below
    }

    if (role == null) {
        String msg = String.format("Switch: [%s], State: [%s], "
                + "received NX_ROLE_REPLY with invalid role "
                + "value %d",
                h.getSwitchInfoString(),
                this.toString(),
                nrr.getRole());
        throw new SwitchStateException(msg);
    }
    return role;
}
项目:onos    文件:RoleManager.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param experimenterMsg message
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 * @throws SwitchStateException If the message is a Nicira role reply
 * but the numeric role value is unknown.
 */
@Override
public RoleState extractNiciraRoleReply(OFExperimenter experimenterMsg)
        throws SwitchStateException {
    int vendor = (int) experimenterMsg.getExperimenter();
    if (vendor != 0x2320) {
        return null;
    }
    OFNiciraControllerRoleReply nrr =
            (OFNiciraControllerRoleReply) experimenterMsg;

    RoleState role = null;
    OFNiciraControllerRole ncr = nrr.getRole();
    switch (ncr) {
    case ROLE_MASTER:
        role = RoleState.MASTER;
        break;
    case ROLE_OTHER:
        role = RoleState.EQUAL;
        break;
    case ROLE_SLAVE:
        role = RoleState.SLAVE;
        break;
    default: //handled below
    }

    if (role == null) {
        String msg = String.format("Switch: [%s], "
                + "received NX_ROLE_REPLY with invalid role "
                + "value %s",
                sw.getStringId(),
                nrr.getRole());
        throw new SwitchStateException(msg);
    }
    return role;
}
项目:fresco_floodlight    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    expect(channel.writeAndFlush(capture(writeCapture))).andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:iTAP-controller    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    channel.write(capture(writeCapture));
    expectLastCall().andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:SDN-Multicast    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    expect(channel.writeAndFlush(capture(writeCapture))).andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:arscheduler    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    expect(channel.writeAndFlush(capture(writeCapture))).andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:floodlight1.2-delay    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    expect(channel.writeAndFlush(capture(writeCapture))).andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:floodlight-hardware    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    expect(channel.writeAndFlush(capture(writeCapture))).andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:ACAMPController    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    expect(channel.writeAndFlush(capture(writeCapture))).andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:fast-failover-demo    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    channel.write(capture(writeCapture));
    expectLastCall().andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:floodlightLB    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    channel.write(capture(writeCapture));
    expectLastCall().andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:DSC    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    channel.write(capture(writeCapture));
    expectLastCall().andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:floodlight    文件:OFChannelHandlerVer10Test.java   
/**
 * Test dispatch of messages while in Complete state
 */
@Test
public void testMessageDispatchComplete() throws Exception {
    moveToComplete();
    newConnection.getValue().setListener(connectionListener);

    resetChannel();
    channel.write(capture(writeCapture));
    expectLastCall().andReturn(null).atLeastOnce();
    replay(channel);

    // Send echo request. expect reply
    OFMessage echoRequest = factory.buildEchoRequest().build();
    sendMessageToHandlerWithControllerReset(ImmutableList.<OFMessage>of(echoRequest));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.ECHO_REPLY, msgs.get(0).getType());

    // Send barrier reply. expect dispatch
    OFBarrierReply barrierReply = factory.buildBarrierReply()
            .build();

    resetAndExpectConnectionListener(barrierReply);


    // Send packet in. expect dispatch
    OFFlowRemoved flowRemoved = factory.buildFlowRemoved()
            .build();

    resetAndExpectConnectionListener(flowRemoved);

    // Send get config reply. expect dispatch
    OFGetConfigReply getConfigReply = factory.buildGetConfigReply()
            .build();

    resetAndExpectConnectionListener(getConfigReply);

    // Send packet in. expect dispatch
    OFPacketIn pi = factory.buildPacketIn()
            .setReason(OFPacketInReason.NO_MATCH)
            .build();

    resetAndExpectConnectionListener(pi);

    // Send port status. expect dispatch
    OFPortStatus portStatus = factory.buildPortStatus()
            .setReason(OFPortReason.DELETE)
            .setDesc(portDesc)
            .build();

    resetAndExpectConnectionListener(portStatus);

    // Send queue reply. expect dispatch
    OFQueueGetConfigReply queueReply = factory.buildQueueGetConfigReply()
            .build();

    resetAndExpectConnectionListener(queueReply);

    // Send stat reply. expect dispatch
    OFFlowStatsReply statReply = factory.buildFlowStatsReply()
            .build();

    resetAndExpectConnectionListener(statReply);

    // Send role reply. expect dispatch
    OFNiciraControllerRoleReply roleReply = factory.buildNiciraControllerRoleReply()
            .setRole(OFNiciraControllerRole.ROLE_MASTER)
            .build();

    resetAndExpectConnectionListener(roleReply);

}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandler.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param h The channel handler receiving the message
 * @param vendorMessage The vendor message to parse.
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 */
protected OFControllerRole extractNiciraRoleReply(OFMessage vendorMessage) {
    if (!(vendorMessage instanceof OFNiciraControllerRoleReply))
        return null;
    OFNiciraControllerRoleReply roleReply =
            (OFNiciraControllerRoleReply) vendorMessage;
    return NiciraRoleUtils.niciraToOFRole(roleReply);
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandler.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param h The channel handler receiving the message
 * @param vendorMessage The vendor message to parse.
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 */
protected OFControllerRole extractNiciraRoleReply(OFMessage vendorMessage) {
    if (!(vendorMessage instanceof OFNiciraControllerRoleReply))
        return null;
    OFNiciraControllerRoleReply roleReply =
            (OFNiciraControllerRoleReply) vendorMessage;
    return NiciraRoleUtils.niciraToOFRole(roleReply);
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandler.java   
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param h The channel handler receiving the message
 * @param vendorMessage The vendor message to parse.
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 */
protected OFControllerRole extractNiciraRoleReply(OFMessage vendorMessage) {
    if (!(vendorMessage instanceof OFNiciraControllerRoleReply))
        return null;
    OFNiciraControllerRoleReply roleReply =
            (OFNiciraControllerRoleReply) vendorMessage;
    return NiciraRoleUtils.niciraToOFRole(roleReply);
}