本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFFeaturesReply类的典型用法代码示例。如果您正苦于以下问题:Java OFFeaturesReply类的具体用法?Java OFFeaturesReply怎么用?Java OFFeaturesReply使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OFFeaturesReply类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFFeaturesReply类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processOFFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
throws IOException {
h.thisdpid = m.getDatapathId().getLong();
log.debug("Received features reply for switch at {} with dpid {}",
h.getSwitchInfoString(), h.thisdpid);
h.featuresReply = m; //temp store
if (h.ofVersion == OFVersion.OF_10) {
h.sendHandshakeSetConfig();
h.setState(WAIT_CONFIG_REPLY);
} else {
//version is 1.3, must get switchport information
h.sendHandshakeOFPortDescRequest();
h.setState(WAIT_PORT_DESC_REPLY);
}
}
示例2: getSwitchFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
protected OFFeaturesReply getSwitchFeaturesReply(DatapathId switchId) {
IOFSwitchService switchService =
(IOFSwitchService) getContext().getAttributes().
get(IOFSwitchService.class.getCanonicalName());
IOFSwitch sw = switchService.getSwitch(switchId);
Future<OFFeaturesReply> future;
OFFeaturesReply featuresReply = null;
OFFeaturesRequest featuresRequest = sw.getOFFactory().buildFeaturesRequest().build();
if (sw != null) {
try {
future = sw.writeRequest(featuresRequest);
featuresReply = future.get(10, TimeUnit.SECONDS);
} catch (Exception e) {
log.error("Failure getting features reply from switch" + sw, e);
}
}
return featuresReply;
}
示例3: serializeFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public static void serializeFeaturesReply(OFFeaturesReply fr, JsonGenerator jGen) throws IOException, JsonProcessingException {
/* Common to All OF Versions */
jGen.writeStringField("capabilities", fr.getCapabilities().toString());
jGen.writeStringField("dpid", fr.getDatapathId().toString());
jGen.writeNumberField("buffers", fr.getNBuffers());
jGen.writeNumberField("tables", fr.getNTables());
jGen.writeStringField("version", fr.getVersion().toString());
if (fr.getVersion().compareTo(OFVersion.OF_13) < 0) { // OF1.3+ break this out into port_config
serializePortDesc(fr.getPorts(), jGen);
}
if (fr.getVersion().compareTo(OFVersion.OF_10) == 0) {
String actions = "[";
for (OFActionType action : fr.getActions()) {
actions = actions + action.toString() + ", ";
}
actions = actions.substring(0, actions.length() - 2); // remove ending space+comma
actions = actions + "]";
jGen.writeStringField("actions", actions);
}
}
示例4: getFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@JsonIgnore
public OFFeaturesReply getFeaturesReply(OFFactory factory) {
/**
* FIXME Icky work around; if a null actions got written to storage
* then fake up an empty one so the builder() doesn't throw
* a NPE. Need to root cause why someone would write a null actions.
* This code will all be removed shortly -- needed to unblock BVS team.
*/
Set<OFActionType> workAroundActions;
if (actions != null)
workAroundActions = actions;
else
workAroundActions = Collections.<OFActionType> emptySet();
OFFeaturesReply featuresReply = factory.buildFeaturesReply()
.setXid(0)
.setDatapathId(dpid)
.setNBuffers(buffers)
.setNTables(tables)
.setCapabilities(capabilities)
.setActions(workAroundActions)
.setPorts(toOFPortDescList(factory, ports))
.build();
return featuresReply;
}
示例5: setFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
public void setFeaturesReply(OFFeaturesReply featuresReply) {
if (portManager.getPorts().isEmpty() && featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) {
/* ports are updated via port status message, so we
* only fill in ports on initial connection.
*/
List<OFPortDesc> OFPortDescs = featuresReply.getPorts();
portManager.updatePorts(OFPortDescs);
}
this.capabilities = featuresReply.getCapabilities();
this.buffers = featuresReply.getNBuffers();
if (featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0 ) {
/* OF1.3+ Per-table actions are set later in the OFTableFeaturesRequest/Reply */
this.actions = featuresReply.getActions();
}
this.nTables = featuresReply.getNTables();
}
示例6: doActivateSwitchInt
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
* Create and activate a switch, either completely new or reconnected
* The mocked switch instance will be returned. It will be reset.
*/
private IOFSwitchBackend doActivateSwitchInt(DatapathId datapathId,
SwitchDescription description,
OFFeaturesReply featuresReply,
boolean clearFlows)
throws Exception {
IOFSwitchBackend sw = createMock(IOFSwitchBackend.class);
if (featuresReply == null) {
featuresReply = createOFFeaturesReply(datapathId);
}
if (description == null) {
description = createSwitchDescription();
}
setupSwitchForAddSwitch(sw, datapathId, description, featuresReply);
replay(sw);
switchManager.switchAdded(sw);
switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.MASTER);
verify(sw);
assertEquals(sw, switchManager.getSwitch(datapathId));
// drain updates and ignore
controller.processUpdateQueueForTesting();
reset(sw);
return sw;
}
示例7: setFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
public void setFeaturesReply(OFFeaturesReply featuresReply) {
if (portManager.getPorts().isEmpty() && featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) {
/* ports are updated via port status message, so we
* only fill in ports on initial connection.
*/
List<OFPortDesc> OFPortDescs = featuresReply.getPorts();
portManager.updatePorts(OFPortDescs);
}
this.capabilities = featuresReply.getCapabilities();
this.buffers = featuresReply.getNBuffers();
if (featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0 ) {
// FIXME:LOJI: OF1.3 has per table actions. This needs to be modeled / handled here
this.actions = featuresReply.getActions();
}
this.tables = featuresReply.getNTables();
}
示例8: serializeFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public static void serializeFeaturesReply(OFFeaturesReply fr, JsonGenerator jGen) throws IOException, JsonProcessingException {
/* Common to All OF Versions */
jGen.writeStringField("capabilities", fr.getCapabilities().toString());
jGen.writeStringField("dpid", fr.getDatapathId().toString());
jGen.writeNumberField("buffers", fr.getNBuffers());
jGen.writeNumberField("tables", fr.getNTables());
jGen.writeStringField("version", fr.getVersion().toString());
if (fr.getVersion().compareTo(OFVersion.OF_13) < 0) { // OF1.3+ break this out into port_config
serializePortDesc(fr.getPorts(), jGen);
}
if (fr.getVersion().compareTo(OFVersion.OF_10) == 0) {
String actions = "[";
for (OFActionType action : fr.getActions()) {
actions = actions + action.toString() + ", ";
}
actions = actions.substring(0, actions.length() - 2); // remove ending space+comma
actions = actions + "]";
jGen.writeStringField("actions", actions);
}
}
示例9: serializeFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public static void serializeFeaturesReply(OFFeaturesReply fr, JsonGenerator jGen) throws IOException, JsonProcessingException {
/* Common to All OF Versions */
jGen.writeStringField("capabilities", fr.getCapabilities().toString());
jGen.writeStringField("dpid", fr.getDatapathId().toString());
jGen.writeNumberField("buffers", fr.getNBuffers());
jGen.writeNumberField("tables", fr.getNTables());
jGen.writeStringField("version", fr.getVersion().toString());
if (fr.getVersion().compareTo(OFVersion.OF_13) < 0) { // OF1.3+ break this out into port_config
serializePortDesc(fr.getPorts(), jGen);
}
if (fr.getVersion().compareTo(OFVersion.OF_10) == 0) {
String actions = "[";
for (OFActionType action : fr.getActions()) {
actions = actions + action.toString() + ", ";
}
actions = actions.substring(0, actions.length() - 2); // remove ending space+comma
actions = actions + "]";
jGen.writeStringField("actions", actions);
}
}
示例10: SwitchSyncRepresentation
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public SwitchSyncRepresentation(OFFeaturesReply fr,
SwitchDescription d) {
this.dpid = fr.getDatapathId();
this.buffers = fr.getNBuffers();
this.tables = fr.getNTables();
this.capabilities = fr.getCapabilities();
this.actions = fr.getActions();
this.ports = toSyncedPortList(fr.getPorts());
this.manufacturerDescription = d.getManufacturerDescription();
this.hardwareDescription = d.getHardwareDescription();
this.softwareDescription = d.getSoftwareDescription();
this.serialNumber = d.getSerialNumber();
this.datapathDescription = d.getDatapathDescription();
}
示例11: OFSwitchHandshakeHandler
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
* Create a new unconnected OFChannelHandler.
* @param controller
* @param broker
* @throws SwitchHandshakeHandlerException
*/
OFSwitchHandshakeHandler(@Nonnull IOFConnectionBackend connection,
@Nonnull OFFeaturesReply featuresReply,
@Nonnull IOFSwitchManager switchManager,
@Nonnull RoleManager roleManager,
@Nonnull Timer timer) {
Preconditions.checkNotNull(connection, "connection");
Preconditions.checkNotNull(featuresReply, "featuresReply");
Preconditions.checkNotNull(switchManager, "switchManager");
Preconditions.checkNotNull(roleManager, "roleManager");
Preconditions.checkNotNull(timer, "timer");
Preconditions.checkArgument(connection.getAuxId().equals(OFAuxId.MAIN),
"connection must be MAIN connection but is %s", connection);
this.switchManager = switchManager;
this.roleManager = roleManager;
this.mainConnection = connection;
this.auxConnections = new ConcurrentHashMap<OFAuxId, IOFConnectionBackend>();
this.featuresReply = featuresReply;
this.timer = timer;
this.switchManagerCounters = switchManager.getCounters();
this.factory = OFFactories.getFactory(featuresReply.getVersion());
this.roleChanger = new RoleChanger(DEFAULT_ROLE_TIMEOUT_NS);
setState(new InitState());
this.pendingPortStatusMsg = new ArrayList<OFPortStatus>();
connection.setListener(this);
}
示例12: processOFFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
void processOFFeaturesReply(OFFeaturesReply m)
throws IOException {
featuresReply = m;
featuresLatency = (System.currentTimeMillis() - featuresLatency) / 2;
// Mark handshake as completed
setState(new CompleteState());
}
示例13: createOFFeaturesReply
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
private OFFeaturesReply createOFFeaturesReply(DatapathId datapathId) {
OFFeaturesReply fr = factory.buildFeaturesReply()
.setXid(0)
.setDatapathId(datapathId)
.setPorts(ImmutableList.<OFPortDesc>of())
.build();
return fr;
}
示例14: setupSwitchForAddSwitch
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/** Set the mock expectations for sw when sw is passed to addSwitch
* The same expectations can be used when a new SwitchSyncRepresentation
* is created from the given mocked switch */
protected void setupSwitchForAddSwitch(IOFSwitch sw, DatapathId datapathId,
SwitchDescription description, OFFeaturesReply featuresReply) {
if (description == null) {
description = createSwitchDescription();
}
if (featuresReply == null) {
featuresReply = createOFFeaturesReply(datapathId);
}
List<OFPortDesc> ports = featuresReply.getPorts();
expect(sw.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_10)).anyTimes();
expect(sw.getStatus()).andReturn(SwitchStatus.MASTER).anyTimes();
expect(sw.getId()).andReturn(datapathId).anyTimes();
expect(sw.getSwitchDescription()).andReturn(description).anyTimes();
expect(sw.getBuffers())
.andReturn(featuresReply.getNBuffers()).anyTimes();
expect(sw.getNumTables())
.andReturn(featuresReply.getNTables()).anyTimes();
expect(sw.getCapabilities())
.andReturn(featuresReply.getCapabilities()).anyTimes();
expect(sw.getActions())
.andReturn(featuresReply.getActions()).anyTimes();
expect(sw.getPorts())
.andReturn(ports).anyTimes();
expect(sw.attributeEquals(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true))
.andReturn(false).anyTimes();
expect(sw.getInetAddress()).andReturn(null).anyTimes();
}
示例15: doActivateNewSwitch
import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
* Create and activate a new switch with the given dpid, features reply
* and description. If description and/or features reply are null we'll
* allocate the default one
* The mocked switch instance will be returned. It wil be reset.
*/
private IOFSwitchBackend doActivateNewSwitch(DatapathId dpid,
SwitchDescription description,
OFFeaturesReply featuresReply)
throws Exception {
return doActivateSwitchInt(dpid, description, featuresReply, true);
}