本文整理汇总了Java中org.openflow.protocol.OFPortStatus.setDesc方法的典型用法代码示例。如果您正苦于以下问题:Java OFPortStatus.setDesc方法的具体用法?Java OFPortStatus.setDesc怎么用?Java OFPortStatus.setDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFPortStatus
的用法示例。
在下文中一共展示了OFPortStatus.setDesc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testHandlePortStatus
import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
@Test
public void testHandlePortStatus() throws Exception {
IOFSwitch sw = createMock(IOFSwitch.class);
OFPhysicalPort port = new OFPhysicalPort();
port.setName("myPortName1");
port.setPortNumber((short)42);
OFPortStatus ofps = new OFPortStatus();
ofps.setDesc(port);
ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps, false);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps, false);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
sw.deletePort(port.getPortNumber());
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps, false);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:38,代码来源:ControllerTest.java
示例2: testHandlePortStatus
import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
@Test
public void testHandlePortStatus() throws Exception {
IOFSwitch sw = createMock(IOFSwitch.class);
OFPhysicalPort port = new OFPhysicalPort();
port.setName("myPortName1");
port.setPortNumber((short)42);
OFPortStatus ofps = new OFPortStatus();
ofps.setDesc(port);
ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
sw.deletePort(port.getPortNumber());
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
}
示例3: testHandlePortStatus
import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
@Test
public void testHandlePortStatus() throws Exception {
IOFSwitch sw = createMock(IOFSwitch.class);
OFPhysicalPort port = new OFPhysicalPort();
port.setName("myPortName1");
port.setPortNumber((short)42);
OFPortStatus ofps = new OFPortStatus();
ofps.setDesc(port);
ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
sw.deletePort(port.getPortNumber());
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps);
verify(sw);
verifyPortChangedUpdateInQueue(sw);
reset(sw);
}
示例4: testPortStatusMessageMaster
import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
/**
* Test port status message handling while MASTER
*
*/
@Test
public void testPortStatusMessageMaster() throws Exception {
long dpid = featuresReply.getDatapathId();
testInitialMoveToMasterWithRole();
OFPhysicalPort p = new OFPhysicalPort();
p.setName("Port1");
p.setPortNumber((short)1);
OFPortStatus ps = (OFPortStatus)
BasicFactory.getInstance().getMessage(OFType.PORT_STATUS);
ps.setDesc(p);
// The events we expect sw.handlePortStatus to return
// We'll just use the same list for all valid OFPortReasons and add
// arbitrary events for arbitrary ports that are not necessarily
// related to the port status message. Our goal
// here is not to return the correct set of events but the make sure
// that a) sw.handlePortStatus is called
// b) the list of events sw.handlePortStatus returns is sent
// as IOFSwitchListener notifications.
OrderedCollection<PortChangeEvent> events =
new LinkedHashSetWrapper<PortChangeEvent>();
ImmutablePort p1 = ImmutablePort.create("eth1", (short)1);
ImmutablePort p2 = ImmutablePort.create("eth2", (short)2);
ImmutablePort p3 = ImmutablePort.create("eth3", (short)3);
ImmutablePort p4 = ImmutablePort.create("eth4", (short)4);
ImmutablePort p5 = ImmutablePort.create("eth5", (short)5);
events.add(new PortChangeEvent(p1, PortChangeType.ADD));
events.add(new PortChangeEvent(p2, PortChangeType.DELETE));
events.add(new PortChangeEvent(p3, PortChangeType.UP));
events.add(new PortChangeEvent(p4, PortChangeType.DOWN));
events.add(new PortChangeEvent(p5, PortChangeType.OTHER_UPDATE));
for (OFPortReason reason: OFPortReason.values()) {
ps.setReason(reason.getReasonCode());
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
expect(sw.getId()).andReturn(dpid).anyTimes();
expect(sw.processOFPortStatus(ps)).andReturn(events).once();
replay(sw);
reset(controller);
controller.notifyPortChanged(sw, p1, PortChangeType.ADD);
controller.notifyPortChanged(sw, p2, PortChangeType.DELETE);
controller.notifyPortChanged(sw, p3, PortChangeType.UP);
controller.notifyPortChanged(sw, p4, PortChangeType.DOWN);
controller.notifyPortChanged(sw, p5, PortChangeType.OTHER_UPDATE);
sendMessageToHandlerNoControllerReset(
Collections.<OFMessage>singletonList(ps));
verify(sw);
verify(controller);
}
}
示例5: sendStatusMsg
import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
public void sendStatusMsg(OFPortReason reason) {
OFPortStatus status = new OFPortStatus();
status.setDesc(this);
status.setReason(reason.getReasonCode());
this.parentSwitch.sendMsg(status, this.parentSwitch);
}