本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFPortDescStatsReply类的典型用法代码示例。如果您正苦于以下问题:Java OFPortDescStatsReply类的具体用法?Java OFPortDescStatsReply怎么用?Java OFPortDescStatsReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFPortDescStatsReply类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFPortDescStatsReply类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processOFStatisticsReply
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
throws SwitchStateException {
// Read port description
if (m.getStatsType() != OFStatsType.PORT_DESC) {
log.warn("Expecting port description stats but received stats "
+ "type {} from {}. Ignoring ...", m.getStatsType(),
h.channel.getRemoteAddress());
return;
}
if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
log.warn("Stats reply indicates more stats from sw {} for "
+ "port description - not currently handled",
h.getSwitchInfoString());
}
h.portDescReply = (OFPortDescStatsReply) m; // temp store
log.info("Received port desc reply for switch at {}",
h.getSwitchInfoString());
try {
h.sendHandshakeSetConfig();
} catch (IOException e) {
log.error("Unable to send setConfig after PortDescReply. "
+ "Error: {}", e.getMessage());
}
h.setState(WAIT_CONFIG_REPLY);
}
示例2: switchAdded
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
@Override
public void switchAdded(Dpid dpid) {
OpenFlowSwitch sw = controller.getSwitch(dpid);
OFVersion version = sw.factory().getVersion();
Integer ofVersion = version.getWireVersion();
shimController.setSupportedProtocol(ofVersion.byteValue());
OFFeaturesReply featuresReply = shimController.getFeatureReply(sw);
controller.setRole(dpid, RoleState.MASTER);
shimController.sendOpenFlowMessageToCore(featuresReply,featuresReply.getXid(),sw.getId(),0);
//Create OFPortDescStatsReply for OF_13
if (sw.factory().getVersion() == OFVersion.OF_13) {
OFPortDescStatsReply.Builder statsReplyBuilder = sw.factory().buildPortDescStatsReply();
statsReplyBuilder.setEntries(sw.getPorts())
.setXid(0);
OFPortDescStatsReply ofPortStatsReply = statsReplyBuilder.build();
shimController.sendOpenFlowMessageToCore(ofPortStatsReply,ofPortStatsReply.getXid(),sw.getId(),0);
}
log.info("Switch {} connected", dpid);
}
示例3: isOChPort
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
/**
* Checks if given port is also part of the regular port desc stats, i.e., is the port a tap port.
*
* @param port given port number
* @return true if the port is a tap (OCh), false otherwise (OMS port)
*/
private boolean isOChPort(long port) {
for (OFPortDescStatsReply reply : this.ports) {
for (OFPortDesc p : reply.getEntries()) {
if (p.getPortNo().getPortNumber() == port) {
return true;
}
}
}
return false;
}
示例4: OFChannelHandler
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
/**
* Create a new unconnected OFChannelHandler.
* @param controller parent controller
*/
OFChannelHandler(Controller controller) {
this.controller = controller;
this.state = ChannelState.INIT;
this.pendingPortStatusMsg = new CopyOnWriteArrayList<OFPortStatus>();
this.portDescReplies = new ArrayList<OFPortDescStatsReply>();
factory13 = controller.getOFMessageFactory13();
factory10 = controller.getOFMessageFactory10();
duplicateDpidFound = Boolean.FALSE;
}
示例5: processOFStatisticsReply
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
throws SwitchStateException {
// Read port description
if (m.getStatsType() != OFStatsType.PORT_DESC) {
log.warn("Expecting port description stats but received stats "
+ "type {} from {}. Ignoring ...", m.getStatsType(),
h.channel.getRemoteAddress());
return;
}
if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
log.debug("Stats reply indicates more stats from sw {} for "
+ "port description",
h.getSwitchInfoString());
h.portDescReplies.add((OFPortDescStatsReply)m);
return;
}
else {
h.portDescReplies.add((OFPortDescStatsReply)m);
}
//h.portDescReply = (OFPortDescStatsReply) m; // temp store
log.info("Received port desc reply for switch at {}",
h.getSwitchInfoString());
try {
h.sendHandshakeSetConfig();
} catch (IOException e) {
log.error("Unable to send setConfig after PortDescReply. "
+ "Error: {}", e.getMessage());
}
h.setState(WAIT_CONFIG_REPLY);
}
示例6: setPortDescStats
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
/* ports are updated via port status message, so we
* only fill in ports on initial connection.
*/
List<OFPortDesc> OFPortDescs = reply.getEntries();
portManager.updatePorts(OFPortDescs);
}
示例7: processOFStatsReply
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
void processOFStatsReply(OFStatsReply m) {
switch(m.getStatsType()) {
case PORT_DESC:
processPortDescStatsReply((OFPortDescStatsReply) m);
break;
default:
unhandledMessageReceived(m);
}
}
示例8: getPortDescStatsReply
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
OFPortDescStatsReply getPortDescStatsReply() {
OFPortDesc portDesc = factory.buildPortDesc()
.setName("Eth1")
.setPortNo(OFPort.of(1))
.build();
return factory.buildPortDescStatsReply()
.setEntries(ImmutableList.<OFPortDesc>of(portDesc))
.build();
}
示例9: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
public void handleDescStatsAndCreateSwitch() throws Exception {
// build the stats reply
OFDescStatsReply sr = createDescriptionStatsReply();
reset(sw);
SwitchDescription switchDescription = new SwitchDescription(sr);
setupSwitchForInstantiationWithReset();
sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
expectLastCall().once();
expect(sw.getOFFactory()).andReturn(factory).once();
replay(sw);
reset(switchManager);
expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
expect(
switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
eq(switchDescription),
anyObject(OFFactory.class),
anyObject(DatapathId.class))).andReturn(sw).once();
expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes();
switchManager.switchAdded(sw);
expectLastCall().once();
replay(switchManager);
// send the description stats reply
switchHandler.processOFMessage(sr);
OFMessage msg = connection.retrieveMessage();
assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
verifyUniqueXids(msg);
verify(sw, switchManager);
}
示例10: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
// build the stats reply
OFDescStatsReply sr = createDescriptionStatsReply();
reset(sw);
SwitchDescription switchDescription = new SwitchDescription(sr);
setupSwitchForInstantiationWithReset();
sw.startDriverHandshake();
expectLastCall().once();
expect(sw.getOFFactory()).andReturn(factory).once();
sw.isDriverHandshakeComplete();
expectLastCall().andReturn(switchDriverComplete).once();
if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
expectLastCall().once();
}
replay(sw);
reset(switchManager);
expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
expect(
switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
eq(switchDescription),
anyObject(OFFactory.class),
anyObject(DatapathId.class))).andReturn(sw).once();
switchManager.switchAdded(sw);
expectLastCall().once();
replay(switchManager);
// send the description stats reply
switchHandler.processOFMessage(sr);
}
示例11: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
public void handleDescStatsAndCreateSwitch(boolean subHandShakeComplete) throws Exception {
// build the stats reply
OFDescStatsReply sr = createDescriptionStatsReply();
reset(sw);
SwitchDescription switchDescription = new SwitchDescription(sr);
setupSwitchForInstantiationWithReset();
sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
expectLastCall().once();
sw.startDriverHandshake();
expectLastCall().once();
expect(sw.isDriverHandshakeComplete()).andReturn(subHandShakeComplete).once();
replay(sw);
reset(switchManager);
expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
expect(
switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
eq(switchDescription),
anyObject(OFFactory.class),
anyObject(DatapathId.class))).andReturn(sw).once();
expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes();
switchManager.switchAdded(sw);
expectLastCall().once();
replay(switchManager);
// send the description stats reply
switchHandler.processOFMessage(sr);
verify(sw, switchManager);
}
示例12: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; //导入依赖的package包/类
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
// build the stats reply
OFDescStatsReply sr = createDescriptionStatsReply();
reset(sw);
SwitchDescription switchDescription = new SwitchDescription(sr);
setupSwitchForInstantiationWithReset();
sw.startDriverHandshake();
expectLastCall().once();
sw.isDriverHandshakeComplete();
expectLastCall().andReturn(switchDriverComplete).once();
if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
expectLastCall().once();
}
replay(sw);
reset(switchManager);
expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
expect(
switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
eq(switchDescription),
anyObject(OFFactory.class),
anyObject(DatapathId.class))).andReturn(sw).once();
switchManager.switchAdded(sw);
expectLastCall().once();
replay(switchManager);
// send the description stats reply
switchHandler.processOFMessage(sr);
}