当前位置: 首页>>代码示例>>Java>>正文


Java OFBadActionCode类代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFBadActionCode的典型用法代码示例。如果您正苦于以下问题:Java OFBadActionCode类的具体用法?Java OFBadActionCode怎么用?Java OFBadActionCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OFBadActionCode类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFBadActionCode类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ofWireValue

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
public static OFBadActionCode ofWireValue(short val) {
    switch(val) {
        case BAD_TYPE_VAL:
            return OFBadActionCode.BAD_TYPE;
        case BAD_LEN_VAL:
            return OFBadActionCode.BAD_LEN;
        case BAD_EXPERIMENTER_VAL:
            return OFBadActionCode.BAD_EXPERIMENTER;
        case BAD_EXPERIMENTER_TYPE_VAL:
            return OFBadActionCode.BAD_EXPERIMENTER_TYPE;
        case BAD_OUT_PORT_VAL:
            return OFBadActionCode.BAD_OUT_PORT;
        case BAD_ARGUMENT_VAL:
            return OFBadActionCode.BAD_ARGUMENT;
        case EPERM_VAL:
            return OFBadActionCode.EPERM;
        case TOO_MANY_VAL:
            return OFBadActionCode.TOO_MANY;
        case BAD_QUEUE_VAL:
            return OFBadActionCode.BAD_QUEUE;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadActionCode in version 1.0: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:25,代码来源:OFBadActionCodeSerializerVer10.java

示例2: toWireValue

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
public static short toWireValue(OFBadActionCode e) {
    switch(e) {
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_EXPERIMENTER_TYPE:
            return BAD_EXPERIMENTER_TYPE_VAL;
        case BAD_OUT_PORT:
            return BAD_OUT_PORT_VAL;
        case BAD_ARGUMENT:
            return BAD_ARGUMENT_VAL;
        case EPERM:
            return EPERM_VAL;
        case TOO_MANY:
            return TOO_MANY_VAL;
        case BAD_QUEUE:
            return BAD_QUEUE_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadActionCode in version 1.0: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:25,代码来源:OFBadActionCodeSerializerVer10.java

示例3: getBadActionErrorMessage

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
/** Return a bad action error message with the given xid/code */
private OFMessage getBadActionErrorMessage(OFBadActionCode code, long xid) {
	OFErrorMsg msg = factory.errorMsgs().buildBadActionErrorMsg()
			.setXid(xid)
			.setCode(code)
			.build();
	return msg;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:9,代码来源:OFSwitchHandlerTestBase.java

示例4: testInitialMoveToSlaveNoRole

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
/** Move the channel from scratch to SLAVE state
 * Builds on doMoveToWaitInitialRole()
 * adds testing for WAIT_INITAL_ROLE state
 *
 * This method tests the case that the switch does NOT support roles.
 * The channel handler still needs to send the initial request to find
 * out that whether the switch supports roles.
 *
 */
@Test
public void testInitialMoveToSlaveNoRole() throws Exception {
	// first, move us to WAIT_INITIAL_ROLE_STATE
	moveToWaitInitialRole();
	assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

	// Set the role
	long xid = setupSwitchSendRoleRequestAndVerify(null, OFControllerRole.ROLE_SLAVE);
	assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

	// prepare mocks and inject the role reply message
	reset(sw);
	sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
	expectLastCall().once();
	sw.setControllerRole(OFControllerRole.ROLE_SLAVE);
	expectLastCall().once();
	sw.disconnect(); // Make sure we disconnect
	expectLastCall().once();
	replay(sw);


	// FIXME: shouldn't use ordinal(), but OFError is broken

	// Error with incorrect xid and type. Should be ignored.
	OFMessage err = getBadActionErrorMessage(OFBadActionCode.BAD_TYPE, xid+1);

	// sendMessageToHandler will verify and rest controller mock
	switchHandler.processOFMessage(err);
	assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

	// Error with correct xid. Should trigger state transition
	err = getBadRequestErrorMessage(OFBadRequestCode.BAD_EXPERIMENTER, xid);
	// sendMessageToHandler will verify and rest controller mock
	switchHandler.processOFMessage(err);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:45,代码来源:OFSwitchHandlerTestBase.java

示例5: testInitialRoleChangeOtherError

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
/** Start from scratch and reply with an unexpected error to the role
 * change request
 * Builds on doMoveToWaitInitialRole()
 * adds testing for WAIT_INITAL_ROLE state
 */
@Test
public void testInitialRoleChangeOtherError() throws Exception {
	// first, move us to WAIT_INITIAL_ROLE_STATE
	moveToWaitInitialRole();
	assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

	// Set the role
	long xid = setupSwitchSendRoleRequestAndVerify(null, OFControllerRole.ROLE_MASTER);
	assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

	OFMessage err = getBadActionErrorMessage(OFBadActionCode.BAD_TYPE, xid);

	verifyExceptionCaptured(err, SwitchStateException.class);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:OFSwitchHandlerTestBase.java

示例6: getBadActionErrorMessage

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
/** Return a bad action error message with the given xid/code */
private OFMessage getBadActionErrorMessage(OFBadActionCode code, long xid) {
    OFErrorMsg msg = factory.errorMsgs().buildBadActionErrorMsg()
            .setXid(xid)
            .setCode(code)
            .build();
    return msg;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:9,代码来源:OFSwitchHandlerTestBase.java

示例7: testInitialMoveToSlaveNoRole

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
/** Move the channel from scratch to SLAVE state
 * Builds on doMoveToWaitInitialRole()
 * adds testing for WAIT_INITAL_ROLE state
 *
 * This method tests the case that the switch does NOT support roles.
 * The channel handler still needs to send the initial request to find
 * out that whether the switch supports roles.
 *
 */
@Test
public void testInitialMoveToSlaveNoRole() throws Exception {
    // first, move us to WAIT_INITIAL_ROLE_STATE
    moveToWaitInitialRole();
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Set the role
    long xid = setupSwitchSendRoleRequestAndVerify(null, OFControllerRole.ROLE_SLAVE);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // prepare mocks and inject the role reply message
    reset(sw);
    sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
    expectLastCall().once();
    sw.setControllerRole(OFControllerRole.ROLE_SLAVE);
    expectLastCall().once();
    sw.disconnect(); // Make sure we disconnect
    expectLastCall().once();
    replay(sw);


    // FIXME: shouldn't use ordinal(), but OFError is broken

    // Error with incorrect xid and type. Should be ignored.
    OFMessage err = getBadActionErrorMessage(OFBadActionCode.BAD_TYPE, xid+1);

    // sendMessageToHandler will verify and rest controller mock
    switchHandler.processOFMessage(err);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Error with correct xid. Should trigger state transition
    err = getBadRequestErrorMessage(OFBadRequestCode.BAD_EXPERIMENTER, xid);
    // sendMessageToHandler will verify and rest controller mock
    switchHandler.processOFMessage(err);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:45,代码来源:OFSwitchHandlerTestBase.java

示例8: testInitialRoleChangeOtherError

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
/** Start from scratch and reply with an unexpected error to the role
 * change request
 * Builds on doMoveToWaitInitialRole()
 * adds testing for WAIT_INITAL_ROLE state
 */
@Test
public void testInitialRoleChangeOtherError() throws Exception {
    // first, move us to WAIT_INITIAL_ROLE_STATE
    moveToWaitInitialRole();
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Set the role
    long xid = setupSwitchSendRoleRequestAndVerify(null, OFControllerRole.ROLE_MASTER);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    OFMessage err = getBadActionErrorMessage(OFBadActionCode.BAD_TYPE, xid);

    verifyExceptionCaptured(err, SwitchStateException.class);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:20,代码来源:OFSwitchHandlerTestBase.java

示例9: readFrom

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
public static OFBadActionCode readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:8,代码来源:OFBadActionCodeSerializerVer12.java

示例10: ofWireValue

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
public static OFBadActionCode ofWireValue(short val) {
    switch(val) {
        case BAD_TYPE_VAL:
            return OFBadActionCode.BAD_TYPE;
        case BAD_LEN_VAL:
            return OFBadActionCode.BAD_LEN;
        case BAD_EXPERIMENTER_VAL:
            return OFBadActionCode.BAD_EXPERIMENTER;
        case BAD_EXPERIMENTER_TYPE_VAL:
            return OFBadActionCode.BAD_EXPERIMENTER_TYPE;
        case BAD_OUT_PORT_VAL:
            return OFBadActionCode.BAD_OUT_PORT;
        case BAD_ARGUMENT_VAL:
            return OFBadActionCode.BAD_ARGUMENT;
        case EPERM_VAL:
            return OFBadActionCode.EPERM;
        case TOO_MANY_VAL:
            return OFBadActionCode.TOO_MANY;
        case BAD_QUEUE_VAL:
            return OFBadActionCode.BAD_QUEUE;
        case BAD_OUT_GROUP_VAL:
            return OFBadActionCode.BAD_OUT_GROUP;
        case MATCH_INCONSISTENT_VAL:
            return OFBadActionCode.MATCH_INCONSISTENT;
        case UNSUPPORTED_ORDER_VAL:
            return OFBadActionCode.UNSUPPORTED_ORDER;
        case BAD_TAG_VAL:
            return OFBadActionCode.BAD_TAG;
        case BAD_SET_TYPE_VAL:
            return OFBadActionCode.BAD_SET_TYPE;
        case BAD_SET_LEN_VAL:
            return OFBadActionCode.BAD_SET_LEN;
        case BAD_SET_ARGUMENT_VAL:
            return OFBadActionCode.BAD_SET_ARGUMENT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadActionCode in version 1.2: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:39,代码来源:OFBadActionCodeSerializerVer12.java

示例11: toWireValue

import org.projectfloodlight.openflow.protocol.OFBadActionCode; //导入依赖的package包/类
public static short toWireValue(OFBadActionCode e) {
    switch(e) {
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_EXPERIMENTER_TYPE:
            return BAD_EXPERIMENTER_TYPE_VAL;
        case BAD_OUT_PORT:
            return BAD_OUT_PORT_VAL;
        case BAD_ARGUMENT:
            return BAD_ARGUMENT_VAL;
        case EPERM:
            return EPERM_VAL;
        case TOO_MANY:
            return TOO_MANY_VAL;
        case BAD_QUEUE:
            return BAD_QUEUE_VAL;
        case BAD_OUT_GROUP:
            return BAD_OUT_GROUP_VAL;
        case MATCH_INCONSISTENT:
            return MATCH_INCONSISTENT_VAL;
        case UNSUPPORTED_ORDER:
            return UNSUPPORTED_ORDER_VAL;
        case BAD_TAG:
            return BAD_TAG_VAL;
        case BAD_SET_TYPE:
            return BAD_SET_TYPE_VAL;
        case BAD_SET_LEN:
            return BAD_SET_LEN_VAL;
        case BAD_SET_ARGUMENT:
            return BAD_SET_ARGUMENT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadActionCode in version 1.2: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:39,代码来源:OFBadActionCodeSerializerVer12.java


注:本文中的org.projectfloodlight.openflow.protocol.OFBadActionCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。