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


Java OFBadRequestCode类代码示例

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


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

示例1: processOFError

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
@Override
void processOFError(OFChannelHandler h, OFErrorMsg m)
        throws IOException, SwitchStateException {
    // if we get here, then the error message is for something else
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() ==
            OFBadRequestCode.EPERM) {
        // We are the master controller and the switch returned
        // a permission error. This is a likely indicator that
        // the switch thinks we are slave. Reassert our
        // role
        // FIXME: this could be really bad during role transitions
        // if two controllers are master (even if its only for
        // a brief period). We might need to see if these errors
        // persist before we reassert

        h.sw.reassertRole();
    } else if (m.getErrType() == OFErrorType.FLOW_MOD_FAILED &&
            ((OFFlowModFailedErrorMsg) m).getCode() ==
            OFFlowModFailedCode.ALL_TABLES_FULL) {
        h.sw.setTableFull(true);
    } else {
        logError(h, m);
    }
    h.dispatchMessage(m);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:OFChannelHandler.java

示例2: processOFError

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
@Override
void processOFError(OFErrorMsg m) {
	/*
	 * HP ProCurve switches do not support
	 * the ofpt_barrier_request message.
	 * 
	 * Look for an error from a bad ofpt_barrier_request,
	 * log a warning, but proceed.
	 */
	if (m.getErrType() == OFErrorType.BAD_REQUEST &&
			((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
			((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
		log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
	} else {
		logErrorDisconnect(m);
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:OFSwitchHandshakeHandler.java

示例3: testReassertMaster

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
	testInitialMoveToMasterWithRole();

	OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

	reset(roleManager);
	roleManager.reassertRole(switchHandler, HARole.ACTIVE);
	expectLastCall().once();
	replay(roleManager);

	reset(switchManager);
	switchManager.handleMessage(sw, err, null);
	expectLastCall().once();
	replay(switchManager);

	switchHandler.processOFMessage(err);

	verify(sw);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:25,代码来源:OFSwitchHandlerTestBase.java

示例4: testReassertMaster

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:25,代码来源:OFSwitchHandlerTestBase.java

示例5: processOFError

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
@Override
void processOFError(OFErrorMsg m) {
	/*
	 * HP ProCurve switches do not support
	 * the ofpt_barrier_request message.
	 *
	 * Look for an error from a bad ofpt_barrier_request,
	 * log a warning, but proceed.
	 */
	if (m.getErrType() == OFErrorType.BAD_REQUEST &&
			((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
			((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
		log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
	} else {
		logErrorDisconnect(m);
	}
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:18,代码来源:OFSwitchHandshakeHandler.java

示例6: ofWireValue

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
public static OFBadRequestCode ofWireValue(short val) {
    switch(val) {
        case BAD_VERSION_VAL:
            return OFBadRequestCode.BAD_VERSION;
        case BAD_TYPE_VAL:
            return OFBadRequestCode.BAD_TYPE;
        case BAD_STAT_VAL:
            return OFBadRequestCode.BAD_STAT;
        case BAD_EXPERIMENTER_VAL:
            return OFBadRequestCode.BAD_EXPERIMENTER;
        case BAD_SUBTYPE_VAL:
            return OFBadRequestCode.BAD_SUBTYPE;
        case EPERM_VAL:
            return OFBadRequestCode.EPERM;
        case BAD_LEN_VAL:
            return OFBadRequestCode.BAD_LEN;
        case BUFFER_EMPTY_VAL:
            return OFBadRequestCode.BUFFER_EMPTY;
        case BUFFER_UNKNOWN_VAL:
            return OFBadRequestCode.BUFFER_UNKNOWN;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.0: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:25,代码来源:OFBadRequestCodeSerializerVer10.java

示例7: toWireValue

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
public static short toWireValue(OFBadRequestCode e) {
    switch(e) {
        case BAD_VERSION:
            return BAD_VERSION_VAL;
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_STAT:
            return BAD_STAT_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_SUBTYPE:
            return BAD_SUBTYPE_VAL;
        case EPERM:
            return EPERM_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BUFFER_EMPTY:
            return BUFFER_EMPTY_VAL;
        case BUFFER_UNKNOWN:
            return BUFFER_UNKNOWN_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.0: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:25,代码来源:OFBadRequestCodeSerializerVer10.java

示例8: ofWireValue

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
public static OFBadRequestCode ofWireValue(short val) {
    switch(val) {
        case BAD_VERSION_VAL:
            return OFBadRequestCode.BAD_VERSION;
        case BAD_TYPE_VAL:
            return OFBadRequestCode.BAD_TYPE;
        case BAD_STAT_VAL:
            return OFBadRequestCode.BAD_STAT;
        case BAD_EXPERIMENTER_VAL:
            return OFBadRequestCode.BAD_EXPERIMENTER;
        case BAD_SUBTYPE_VAL:
            return OFBadRequestCode.BAD_SUBTYPE;
        case EPERM_VAL:
            return OFBadRequestCode.EPERM;
        case BAD_LEN_VAL:
            return OFBadRequestCode.BAD_LEN;
        case BUFFER_EMPTY_VAL:
            return OFBadRequestCode.BUFFER_EMPTY;
        case BUFFER_UNKNOWN_VAL:
            return OFBadRequestCode.BUFFER_UNKNOWN;
        case BAD_TABLE_ID_VAL:
            return OFBadRequestCode.BAD_TABLE_ID;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.1: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:27,代码来源:OFBadRequestCodeSerializerVer11.java

示例9: toWireValue

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
public static short toWireValue(OFBadRequestCode e) {
    switch(e) {
        case BAD_VERSION:
            return BAD_VERSION_VAL;
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_STAT:
            return BAD_STAT_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_SUBTYPE:
            return BAD_SUBTYPE_VAL;
        case EPERM:
            return EPERM_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BUFFER_EMPTY:
            return BUFFER_EMPTY_VAL;
        case BUFFER_UNKNOWN:
            return BUFFER_UNKNOWN_VAL;
        case BAD_TABLE_ID:
            return BAD_TABLE_ID_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.1: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:27,代码来源:OFBadRequestCodeSerializerVer11.java

示例10: processOFError

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的package包/类
@Override
void processOFError(OFChannelHandler h, OFErrorMsg m) {
    if (m.getErrType() == OFErrorType.BAD_REQUEST) {
        OFBadRequestErrorMsg badRequest = (OFBadRequestErrorMsg) m;
        if (badRequest.getCode() == OFBadRequestCode.BAD_TYPE) {
             log.debug("{} does not support GetConfig, moving on", h.getSwitchInfoString());
             try {
                nextState(h);
                return;
            } catch (IOException e) {
                log.error("Exception thrown transitioning to next", e);
                logErrorDisconnect(h, m);
            }
        }
    }
    logErrorDisconnect(h, m);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:OFChannelHandler.java

示例11: getBadRequestErrorMessage

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

示例12: testInitialMoveToSlaveNoRole

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的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

示例13: getBadRequestErrorMessage

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

示例14: testInitialMoveToSlaveNoRole

import org.projectfloodlight.openflow.protocol.OFBadRequestCode; //导入依赖的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


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