本文整理汇总了Java中org.openflow.protocol.OFSetConfig类的典型用法代码示例。如果您正苦于以下问题:Java OFSetConfig类的具体用法?Java OFSetConfig怎么用?Java OFSetConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFSetConfig类属于org.openflow.protocol包,在下文中一共展示了OFSetConfig类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendHandshakeSetConfig
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
* Send the configuration requests to tell the switch we want full
* packets
* @throws IOException
*/
private void sendHandshakeSetConfig() throws IOException {
List<OFMessage> msglist = new ArrayList<OFMessage>(3);
// Ensure we receive the full packet via PacketIn
// FIXME: We don't set the reassembly flags.
OFSetConfig configSet = (OFSetConfig) BasicFactory.getInstance()
.getMessage(OFType.SET_CONFIG);
configSet.setMissSendLength((short) 0xffff)
.setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
configSet.setXid(handshakeTransactionIds--);
msglist.add(configSet);
// Barrier
OFBarrierRequest barrier = (OFBarrierRequest) BasicFactory.getInstance()
.getMessage(OFType.BARRIER_REQUEST);
barrier.setXid(handshakeTransactionIds--);
msglist.add(barrier);
// Verify (need barrier?)
OFGetConfigRequest configReq = (OFGetConfigRequest)
BasicFactory.getInstance().getMessage(OFType.GET_CONFIG_REQUEST);
configReq.setXid(handshakeTransactionIds--);
msglist.add(configReq);
channel.write(msglist);
}
示例2: moveToWaitConfigReply
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/** Move the channel from scratch to WAIT_CONFIG_REPLY state
* Builds on moveToWaitFeaturesReply
* adds testing for WAIT_FEATURES_REPLY state
*/
@Test
public void moveToWaitConfigReply() throws Exception {
moveToWaitFeaturesReply();
resetChannel();
channel.write(capture(writeCapture));
expectLastCall().andReturn(null).atLeastOnce();
replay(channel);
sendMessageToHandlerWithControllerReset(Collections.<OFMessage>singletonList(featuresReply));
List<OFMessage> msgs = getMessagesFromCapture();
assertEquals(3, msgs.size());
assertEquals(OFType.SET_CONFIG, msgs.get(0).getType());
OFSetConfig sc = (OFSetConfig)msgs.get(0);
assertEquals((short)0xffff, sc.getMissSendLength());
assertEquals(OFType.BARRIER_REQUEST, msgs.get(1).getType());
assertEquals(OFType.GET_CONFIG_REQUEST, msgs.get(2).getType());
verifyUniqueXids(msgs);
assertEquals(OFChannelHandler.ChannelState.WAIT_CONFIG_REPLY,
handler.getStateForTesting());
}
示例3: sendFeatureReplyConfiguration
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
* Send the configuration requests we can only do after we have
* the features reply
* @throws IOException
*/
void sendFeatureReplyConfiguration() throws IOException {
// Ensure we receive the full packet via PacketIn
OFSetConfig config = (OFSetConfig) factory
.getMessage(OFType.SET_CONFIG);
config.setMissSendLength((short) 0xffff)
.setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
sw.write(config, null);
sw.write(factory.getMessage(OFType.GET_CONFIG_REQUEST),
null);
// Get Description to set switch-specific flags
OFStatisticsRequest req = new OFStatisticsRequest();
req.setStatisticType(OFStatisticsType.DESC);
req.setLengthU(req.getLengthU());
Future<List<OFStatistics>> dfuture =
sw.getStatistics(req);
sw.setAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE,
dfuture);
}
示例4: sendHandshakeSetConfig
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
* Sends the configuration requests to tell the switch we want full packets.
*
* @throws IOException
*/
private void sendHandshakeSetConfig() throws IOException {
final List<OFMessage> msglist = new ArrayList<OFMessage>(3);
// Ensure we receive the full packet via PacketIn
final OFSetConfig configSet = (OFSetConfig) BasicFactory.getInstance()
.getMessage(OFType.SET_CONFIG);
configSet.setMissSendLength(OVXSetConfig.MSL_FULL).setLengthU(
OFSwitchConfig.MINIMUM_LENGTH);
configSet.setXid(this.handshakeTransactionIds--);
msglist.add(configSet);
// Barrier
final OFBarrierRequest barrier = (OFBarrierRequest) BasicFactory
.getInstance().getMessage(OFType.BARRIER_REQUEST);
barrier.setXid(this.handshakeTransactionIds--);
msglist.add(barrier);
// Verify (need barrier?)
final OFGetConfigRequest configReq = (OFGetConfigRequest) BasicFactory
.getInstance().getMessage(OFType.GET_CONFIG_REQUEST);
configReq.setXid(this.handshakeTransactionIds--);
msglist.add(configReq);
this.channel.write(msglist);
}
示例5: processFeaturesReply
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
private void processFeaturesReply(OFFeaturesReply reply) {
if (this.state == SwitchState.WAIT_FEATURES_REPLY) {
this.sid = reply.getDatapathId();
this.buffers = reply.getBuffers();
this.capabilities = reply.getCapabilities();
this.tables = reply.getTables();
this.actions = reply.getActions();
// notify core of this error event
for (OFPhysicalPort port : reply.getPorts()) {
updatePhysicalPort(port);
}
// config the switch to send full data packet
OFSetConfig config = (OFSetConfig) factory
.getMessage(OFType.SET_CONFIG);
config.setMissSendLength((short) 0xffff).setLengthU(
OFSetConfig.MINIMUM_LENGTH);
asyncFastSend(config);
// send config request to make sure the switch can handle the set
// config
OFMessage getConfig = factory.getMessage(OFType.GET_CONFIG_REQUEST);
asyncFastSend(getConfig);
this.state = SwitchState.WAIT_CONFIG_REPLY;
// inform core that a new switch is now operational
reportSwitchStateChange(true);
}
}
示例6: sendFeatureReplyConfiguration
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
* Send the configuration requests we can only do after we have
* the features reply
* @throws IOException
*/
private void sendFeatureReplyConfiguration() throws IOException {
List<OFMessage> msglist = new ArrayList<OFMessage>(3);
// Ensure we receive the full packet via PacketIn
OFSetConfig configSet = (OFSetConfig) factory
.getMessage(OFType.SET_CONFIG);
configSet.setMissSendLength((short) 0xffff)
.setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
configSet.setXid(-4);
msglist.add(configSet);
// Verify (need barrier?)
OFGetConfigRequest configReq = (OFGetConfigRequest)
factory.getMessage(OFType.GET_CONFIG_REQUEST);
configReq.setXid(-3);
msglist.add(configReq);
// Get Description to set switch-specific flags
OFStatisticsRequest req = new OFStatisticsRequest();
req.setStatisticType(OFStatisticsType.DESC);
req.setXid(-2); // something "large"
req.setLengthU(req.getLengthU());
msglist.add(req);
channel.write(msglist);
}
示例7: processOFSetConfig
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
void processOFSetConfig(final ControllerChannelHandler h,
final OFSetConfig m) {
this.illegalMessageReceived(h, m);
}
示例8: setConfig
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
* Safe config set by Controller.
*
* @param config OFSetConfig
*/
private void setConfig(OFSetConfig config) {
this.config_reply = new OFGetConfigReply();
this.config_reply.setFlags(config.getFlags());
this.config_reply.setMissSendLength(config.getMissSendLength());
}
示例9: startSwitchTimer
import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
private void startSwitchTimer() {
this.periodicTimer = new Timer();
this.periodicTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
try {
Long now = System.currentTimeMillis();
if ((now - lastMsgReceivedTimeStamp) > switchLivenessTimeout) {
if (probeSent) {
// switch failed to respond to our probe, consider
// it down
logger.warn("{} is idle for too long, disconnect",
toString());
reportSwitchStateChange(false);
} else {
// send a probe to see if the switch is still alive
logger.debug(
"Send idle probe (Echo Request) to {}",
this);
probeSent = true;
OFMessage echo = factory
.getMessage(OFType.ECHO_REQUEST);
asyncFastSend(echo);
}
} else {
if (state == SwitchState.WAIT_FEATURES_REPLY) {
// send another features request
OFMessage request = factory
.getMessage(OFType.FEATURES_REQUEST);
asyncFastSend(request);
} else {
if (state == SwitchState.WAIT_CONFIG_REPLY) {
// send another config request
OFSetConfig config = (OFSetConfig) factory
.getMessage(OFType.SET_CONFIG);
config.setMissSendLength((short) 0xffff)
.setLengthU(OFSetConfig.MINIMUM_LENGTH);
asyncFastSend(config);
OFMessage getConfig = factory
.getMessage(OFType.GET_CONFIG_REQUEST);
asyncFastSend(getConfig);
}
}
}
} catch (Exception e) {
reportError(e);
}
}
}, SWITCH_LIVENESS_TIMER, SWITCH_LIVENESS_TIMER);
}