本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFDescStatsReply类的典型用法代码示例。如果您正苦于以下问题:Java OFDescStatsReply类的具体用法?Java OFDescStatsReply怎么用?Java OFDescStatsReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFDescStatsReply类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFDescStatsReply类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OFSwitchImplSpringOpenTTP
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
public OFSwitchImplSpringOpenTTP(OFDescStatsReply desc, boolean usePipeline13) {
super();
haltStateMachine = new AtomicBoolean(false);
driverState = DriverState.INIT;
driverHandshakeComplete = new AtomicBoolean(false);
setSwitchDescription(desc);
neighbors = new ConcurrentHashMap<Dpid, Set<PortNumber>>();
portToNeighbors = new ConcurrentHashMap<PortNumber, Dpid>();
nsToGroups = new ConcurrentHashMap<NeighborSet, EcmpInfo>();
ecmpGroups = new ConcurrentHashMap<Integer, EcmpInfo>();
userDefinedGroups = new ConcurrentHashMap<Integer, EcmpInfo>();
portNeighborSetMap =
new ConcurrentHashMap<PortNumber, HashSet<NeighborSet>>();
segmentIds = new ArrayList<Integer>();
isEdgeRouter = false;
groupid = new AtomicInteger(0);
this.usePipeline13 = usePipeline13;
}
示例2: buildMockIOFSwitch
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
public IOFSwitch buildMockIOFSwitch(Long id, OFPortDesc portDesc, OFFactory factory,
OFDescStatsReply swDesc, InetSocketAddress inetAddr) {
IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
expect(sw.getId()).andReturn(DatapathId.of(id)).anyTimes();
expect(sw.getPort(OFPort.of(1))).andReturn(portDesc).anyTimes();
expect(sw.getOFFactory()).andReturn(factory).anyTimes();
expect(sw.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
expect(sw.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
expect(sw.getSwitchDescription()).andReturn(new SwitchDescription(swDesc)).anyTimes();
expect(sw.isActive()).andReturn(true).anyTimes();
expect(sw.getLatency()).andReturn(U64.of(10L)).anyTimes();
expect(sw.getInetAddress()).andReturn(inetAddr).anyTimes();
return sw;
}
示例3: OFSwitchImplSpringOpenTTPDellOSR
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
public OFSwitchImplSpringOpenTTPDellOSR(Dpid dpid, OFDescStatsReply desc) {
super(dpid, desc);
vlanTableId = DELL_TABLE_VLAN;
tmacTableId = DELL_TABLE_TMAC;
ipv4UnicastTableId = DELL_TABLE_IPV4_UNICAST;
mplsTableId = DELL_TABLE_MPLS;
aclTableId = DELL_TABLE_ACL;
}
示例4: getOFSwitchInstance
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
/**
* Forward to the driver-manager to get an IOFSwitch instance.
*
* @param dpid data path id
* @param desc switch description
* @param ofv OpenFlow version
* @return switch instance
*/
protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid,
OFDescStatsReply desc,
OFVersion ofv) {
Dpid dpidObj = new Dpid(dpid);
Driver driver;
try {
driver = driverService.getDriver(DeviceId.deviceId(Dpid.uri(dpidObj)));
} catch (ItemNotFoundException e) {
driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc());
}
if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) {
Dpid did = new Dpid(dpid);
DefaultDriverHandler handler =
new DefaultDriverHandler(new DefaultDriverData(driver, deviceId(uri(did))));
OpenFlowSwitchDriver ofSwitchDriver =
driver.createBehaviour(handler, OpenFlowSwitchDriver.class);
ofSwitchDriver.init(did, desc, ofv);
ofSwitchDriver.setAgent(agent);
ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver));
log.info("OpenFlow handshaker found for device {}: {}", dpid, ofSwitchDriver);
return ofSwitchDriver;
}
log.error("No OpenFlow driver for {} : {}", dpid, desc);
return null;
}
示例5: switchItemNotFoundTest
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
/**
* Tests fetching a driver that throws an ItemNotFoundException.
*/
@Test
public void switchItemNotFoundTest() {
controller.start(null, new MockDriverService());
OFDescStatsReply stats =
new OFDescStatsReplyAdapter();
OpenFlowSwitchDriver driver =
controller.getOFSwitchInstance(MockDriverService.ITEM_NOT_FOUND_DRIVER_ID,
stats,
null);
assertThat(driver, nullValue());
controller.stop();
}
示例6: driverExistsTest
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
/**
* Tests fetching a driver that throws an ItemNotFoundException.
*/
@Test
public void driverExistsTest() {
controller.start(null, new MockDriverService());
OFDescStatsReply stats =
new OFDescStatsReplyAdapter();
OpenFlowSwitchDriver driver =
controller.getOFSwitchInstance(MockDriverService.DRIVER_EXISTS_ID,
stats,
null);
assertThat(driver, notNullValue());
controller.stop();
}
示例7: serializeDescReply
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
jGen.writeObjectFieldStart("desc");
jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc());
jGen.writeStringField("hardwareDescription", descReply.getHwDesc());
jGen.writeStringField("softwareDescription", descReply.getSwDesc());
jGen.writeStringField("serialNumber", descReply.getSerialNum());
jGen.writeStringField("datapathDescription", descReply.getDpDesc());
jGen.writeEndObject(); // end match
}
示例8: processOFStatsReply
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
@Override
void processOFStatsReply(OFStatsReply m) {
// Read description, if it has been updated
if (m.getStatsType() != OFStatsType.DESC) {
illegalMessageReceived(m);
return;
}
OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
SwitchDescription description = new SwitchDescription(descStatsReply);
sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());
// set switch information
// set features reply and channel first so we a DPID and
// channel info.
sw.setFeaturesReply(featuresReply);
if (portDescStats != null) {
sw.setPortDescStats(portDescStats);
}
/*
* Need to add after setting the features.
*/
switchManager.switchAdded(sw);
// Handle pending messages now that we have a sw object
handlePendingPortStatusMessages(description);
setState(new WaitTableFeaturesReplyState());
}
示例9: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的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: createDescriptionStatsReply
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
protected OFDescStatsReply createDescriptionStatsReply() {
OFDescStatsReply statsReply = factory.buildDescStatsReply()
.setDpDesc("Datapath Description")
.setHwDesc("Hardware Description")
.setMfrDesc("Manufacturer Description")
.setSwDesc("Software Description")
.setSerialNum("Serial Number")
.build();
return statsReply;
}
示例11: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的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);
}
示例12: processOFStatsReply
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
@LogMessageDoc(message="Switch {switch info} bound to class " +
"{switch driver}, description {switch description}",
explanation="The specified switch has been bound to " +
"a switch driver based on the switch description" +
"received from the switch")
@Override
void processOFStatsReply(OFStatsReply m) {
// Read description, if it has been updated
if (m.getStatsType() != OFStatsType.DESC) {
illegalMessageReceived(m);
return;
}
OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
SwitchDescription description = new SwitchDescription(descStatsReply);
sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());
switchManager.switchAdded(sw);
// set switch information
// set features reply and channel first so we a DPID and
// channel info.
sw.setFeaturesReply(featuresReply);
if (portDescStats != null) {
sw.setPortDescStats(portDescStats);
}
// Handle pending messages now that we have a sw object
handlePendingPortStatusMessages(description);
sw.startDriverHandshake();
if (sw.isDriverHandshakeComplete()) {
setState(new WaitAppHandshakeState());
} else {
setState(new WaitSwitchDriverSubHandshakeState());
}
}
示例13: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的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);
}
示例14: createDescriptionStatsReply
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的package包/类
protected OFDescStatsReply createDescriptionStatsReply() {
OFDescStatsReply statsReply = factory.buildDescStatsReply()
.setDpDesc("Datapath Description")
.setHwDesc("Hardware Description")
.setMfrDesc("Manufacturer Description")
.setSwDesc("Software Description")
.setSerialNum("Serial Number")
.build();
return statsReply;
}
示例15: handleDescStatsAndCreateSwitch
import org.projectfloodlight.openflow.protocol.OFDescStatsReply; //导入依赖的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);
}