本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}