本文整理汇总了Java中org.openflow.protocol.OFHello类的典型用法代码示例。如果您正苦于以下问题:Java OFHello类的具体用法?Java OFHello怎么用?Java OFHello使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFHello类属于org.openflow.protocol包,在下文中一共展示了OFHello类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.openflow.protocol.OFHello; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
factory = BasicFactory.getInstance();
cntx = new FloodlightContext();
sw1 = new OFMessageDamperMockSwitch();
sw2 = new OFMessageDamperMockSwitch();
echoRequst1 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
echoRequst1.setPayload(new byte[] { 1 });
echoRequst1Clone = (OFEchoRequest)
factory.getMessage(OFType.ECHO_REQUEST);
echoRequst1Clone.setPayload(new byte[] { 1 });
echoRequst2 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
echoRequst2.setPayload(new byte[] { 2 });
hello1 = (OFHello)factory.getMessage(OFType.HELLO);
hello1.setXid(1);
hello2 = (OFHello)factory.getMessage(OFType.HELLO);
hello2.setXid(2);
}
示例2: setUp
import org.openflow.protocol.OFHello; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
factory = new BasicFactory();
cntx = new FloodlightContext();
sw1 = new OFMessageDamperMockSwitch();
sw2 = new OFMessageDamperMockSwitch();
echoRequst1 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
echoRequst1.setPayload(new byte[] { 1 });
echoRequst1Clone = (OFEchoRequest)
factory.getMessage(OFType.ECHO_REQUEST);
echoRequst1Clone.setPayload(new byte[] { 1 });
echoRequst2 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
echoRequst2.setPayload(new byte[] { 2 });
hello1 = (OFHello)factory.getMessage(OFType.HELLO);
hello1.setXid(1);
hello2 = (OFHello)factory.getMessage(OFType.HELLO);
hello2.setXid(2);
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:23,代码来源:OFMessageDamperTest.java
示例3: setUp
import org.openflow.protocol.OFHello; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
factory = new BasicFactory();
cntx = new ListenerContext();
sw1 = new OFMessageDamperMockSwitch();
sw2 = new OFMessageDamperMockSwitch();
echoRequst1 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
echoRequst1.setPayload(new byte[] { 1 });
echoRequst1Clone = (OFEchoRequest)
factory.getMessage(OFType.ECHO_REQUEST);
echoRequst1Clone.setPayload(new byte[] { 1 });
echoRequst2 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
echoRequst2.setPayload(new byte[] { 2 });
hello1 = (OFHello)factory.getMessage(OFType.HELLO);
hello1.setXid(1);
hello2 = (OFHello)factory.getMessage(OFType.HELLO);
hello2.setXid(2);
}
示例4: testTranslate
import org.openflow.protocol.OFHello; //导入依赖的package包/类
public void testTranslate() {
final OVXSwitch vsw = new OVXSingleSwitch(1, 1);
// make a south-bound message....something simple.
final OFHello ofh = new OFHello();
ofh.setXid(0);
final int newXid = this.translator.translate(ofh.getXid(), vsw);
Assert.assertEquals(newXid, XidTranslator.MIN_XID);
}
示例5: testUntranslate
import org.openflow.protocol.OFHello; //导入依赖的package包/类
public void testUntranslate() {
final OVXSwitch vsw = new OVXSingleSwitch(1, 1);
final OFHello ofh = new OFHello();
ofh.setXid(0);
this.translator.translate(ofh.getXid(), vsw);
final XidPair<OVXSwitch> pair = this.translator
.untranslate(XidTranslator.MIN_XID);
Assert.assertEquals(pair.getSwitch().getSwitchId(), vsw.getSwitchId());
Assert.assertEquals(pair.getXid(), ofh.getXid());
}
示例6: processOFHello
import org.openflow.protocol.OFHello; //导入依赖的package包/类
@Override
void processOFHello(OFChannelHandler h, OFHello m)
throws IOException {
h.sendHandShakeMessage(OFType.FEATURES_REQUEST);
h.setState(WAIT_FEATURES_REPLY);
}
示例7: processOFMessage
import org.openflow.protocol.OFHello; //导入依赖的package包/类
/**
* Process an OF message received on the channel and
* update state accordingly.
*
* The main "event" of the state machine. Process the received message,
* send follow up message if required and update state if required.
*
* Switches on the message type and calls more specific event handlers
* for each individual OF message type. If we receive a message that
* is supposed to be sent from a controller to a switch we throw
* a SwitchStateExeption.
*
* The more specific handlers can also throw SwitchStateExceptions
*
* @param h The OFChannelHandler that received the message
* @param m The message we received.
* @throws SwitchStateException
* @throws IOException
*/
void processOFMessage(OFChannelHandler h, OFMessage m) throws IOException {
h.roleChanger.checkTimeout();
switch(m.getType()) {
case HELLO:
processOFHello(h, (OFHello)m);
break;
case BARRIER_REPLY:
processOFBarrierReply(h, (OFBarrierReply)m);
break;
case ECHO_REPLY:
processOFEchoReply(h, (OFEchoReply)m);
break;
case ECHO_REQUEST:
processOFEchoRequest(h, (OFEchoRequest)m);
break;
case ERROR:
processOFError(h, (OFError)m);
break;
case FEATURES_REPLY:
processOFFeaturesReply(h, (OFFeaturesReply)m);
break;
case FLOW_REMOVED:
processOFFlowRemoved(h, (OFFlowRemoved)m);
break;
case GET_CONFIG_REPLY:
processOFGetConfigReply(h, (OFGetConfigReply)m);
break;
case PACKET_IN:
processOFPacketIn(h, (OFPacketIn)m);
break;
case PORT_STATUS:
processOFPortStatus(h, (OFPortStatus)m);
break;
case QUEUE_GET_CONFIG_REPLY:
processOFQueueGetConfigReply(h, (OFQueueGetConfigReply)m);
break;
case STATS_REPLY:
processOFStatisticsReply(h, (OFStatisticsReply)m);
break;
case VENDOR:
processOFVendor(h, (OFVendor)m);
break;
// The following messages are sent to switches. The controller
// should never receive them
case SET_CONFIG:
case GET_CONFIG_REQUEST:
case PACKET_OUT:
case PORT_MOD:
case QUEUE_GET_CONFIG_REQUEST:
case BARRIER_REQUEST:
case STATS_REQUEST:
case FEATURES_REQUEST:
case FLOW_MOD:
illegalMessageReceived(h, m);
break;
}
}
示例8: processOFHello
import org.openflow.protocol.OFHello; //导入依赖的package包/类
@Override
void processOFHello(final SwitchChannelHandler h, final OFHello m)
throws IOException {
h.sendHandShakeMessage(OFType.FEATURES_REQUEST);
h.setState(WAIT_FEATURES_REPLY);
}
示例9: processOFMessage
import org.openflow.protocol.OFHello; //导入依赖的package包/类
/**
* Process an OF message received on the channel and update state
* accordingly.
*
* The main "event" of the state machine. Process the received message,
* send follow up message if required and update state if required.
*
* Switches on the message type and calls more specific event handlers
* for each individual OF message type. If we receive a message that is
* supposed to be sent from a controller to a switch we throw a
* SwitchStateExeption.
*
* The more specific handlers can also throw SwitchStateExceptions
*
* @param h
* The SwitchChannelHandler that received the message
* @param m
* The message we received.
* @throws SwitchStateException
* @throws IOException
*/
void processOFMessage(final SwitchChannelHandler h, final OFMessage m)
throws IOException {
switch (m.getType()) {
case HELLO:
this.processOFHello(h, (OFHello) m);
break;
case BARRIER_REPLY:
this.processOFBarrierReply(h, (OFBarrierReply) m);
break;
case ECHO_REPLY:
this.processOFEchoReply(h, (OFEchoReply) m);
break;
case ECHO_REQUEST:
this.processOFEchoRequest(h, (OFEchoRequest) m);
break;
case ERROR:
this.processOFError(h, (OFError) m);
break;
case FEATURES_REPLY:
this.processOFFeaturesReply(h, (OFFeaturesReply) m);
break;
case FLOW_REMOVED:
this.processOFFlowRemoved(h, (OFFlowRemoved) m);
break;
case GET_CONFIG_REPLY:
this.processOFGetConfigReply(h, (OFGetConfigReply) m);
break;
case PACKET_IN:
this.processOFPacketIn(h, (OFPacketIn) m);
break;
case PORT_STATUS:
this.processOFPortStatus(h, (OFPortStatus) m);
break;
case QUEUE_GET_CONFIG_REPLY:
this.processOFQueueGetConfigReply(h, (OFQueueGetConfigReply) m);
break;
case STATS_REPLY:
this.processOFStatisticsReply(h, (OFStatisticsReply) m);
break;
case VENDOR:
this.processOFVendor(h, (OFVendor) m);
break;
// The following messages are sent to switches. The controller
// should never receive them
case SET_CONFIG:
case GET_CONFIG_REQUEST:
case PACKET_OUT:
case PORT_MOD:
case QUEUE_GET_CONFIG_REQUEST:
case BARRIER_REQUEST:
case STATS_REQUEST:
case FEATURES_REQUEST:
case FLOW_MOD:
this.illegalMessageReceived(h, m);
break;
default:
break;
}
}
示例10: processOFMessage
import org.openflow.protocol.OFHello; //导入依赖的package包/类
@Override
void processOFMessage(final ControllerChannelHandler h,
final OFMessage m) throws IOException {
switch (m.getType()) {
case HELLO:
this.processOFHello(h, (OFHello) m);
break;
case ECHO_REPLY:
break;
case ECHO_REQUEST:
this.processOFEchoRequest(h, (OFEchoRequest) m);
break;
case FEATURES_REQUEST:
this.processOFFeaturesRequest(h, (OFFeaturesRequest) m);
break;
case BARRIER_REQUEST:
// TODO: actually implement barrier contract
final OFBarrierReply breply = new OFBarrierReply();
breply.setXid(m.getXid());
h.channel.write(Collections.singletonList(breply));
break;
case SET_CONFIG:
case ERROR:
case PACKET_OUT:
case PORT_MOD:
case QUEUE_GET_CONFIG_REQUEST:
case STATS_REQUEST:
case FLOW_MOD:
case GET_CONFIG_REQUEST:
h.sw.handleIO(m, h.channel);
break;
case VENDOR:
processOFVendor(h, (OFVendor) m);
break;
case FEATURES_REPLY:
case FLOW_REMOVED:
case PACKET_IN:
case PORT_STATUS:
case BARRIER_REPLY:
case GET_CONFIG_REPLY:
case STATS_REPLY:
case QUEUE_GET_CONFIG_REPLY:
this.illegalMessageReceived(h, m);
break;
default:
break;
}
}
示例11: processOFHello
import org.openflow.protocol.OFHello; //导入依赖的package包/类
void processOFHello(final ControllerChannelHandler h, final OFHello m)
throws IOException {
// we only expect hello in the WAIT_HELLO state
this.illegalMessageReceived(h, m);
}
示例12: alrdyOpenFlowed
import org.openflow.protocol.OFHello; //导入依赖的package包/类
/**
* Has provided ofSwitch had OpenFlow Messages? Needed e.g. for NOX: after
* successfull TCP Session, NOX does NOTHING, so each 'switch' has to send a
* OFHello for Handshake with Floodlight sending a OFHello at any time
* follows an immediate Disconnect from the Controller.
*
* @param ofSwitch
*/
public void alrdyOpenFlowed(IOFConnection ofSwitch) {
if (!ofSwitch.hadOFComm()) {
ofSwitch.send(new OFHello());
}
}