本文整理汇总了Java中org.openflow.protocol.OFFeaturesReply类的典型用法代码示例。如果您正苦于以下问题:Java OFFeaturesReply类的具体用法?Java OFFeaturesReply怎么用?Java OFFeaturesReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFFeaturesReply类属于org.openflow.protocol包,在下文中一共展示了OFFeaturesReply类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
* Performs the serialization of a OFFeaturesReply object
*/
@Override
public void serialize(OFFeaturesReply reply, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException {
jGen.writeStartObject();
jGen.writeNumberField("actions", reply.getActions());
jGen.writeNumberField("buffers", reply.getBuffers());
jGen.writeNumberField("capabilities", reply.getCapabilities());
jGen.writeStringField("datapathId", HexString.toHexString(reply.getDatapathId()));
jGen.writeNumberField("length", reply.getLength());
serializer.defaultSerializeField("ports", reply.getPorts(), jGen);
jGen.writeNumberField("tables", reply.getTables());
jGen.writeStringField("type", reply.getType().toString());
jGen.writeNumberField("version", reply.getVersion());
jGen.writeNumberField("xid", reply.getXid());
jGen.writeEndObject();
}
示例2: getSwitchFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
protected OFFeaturesReply getSwitchFeaturesReply(long switchId) {
IFloodlightProviderService floodlightProvider =
(IFloodlightProviderService)getContext().getAttributes().
get(IFloodlightProviderService.class.getCanonicalName());
IOFSwitch sw = floodlightProvider.getSwitch(switchId);
Future<OFFeaturesReply> future;
OFFeaturesReply featuresReply = null;
if (sw != null) {
try {
future = sw.querySwitchFeaturesReply();
featuresReply = future.get(10, TimeUnit.SECONDS);
} catch (Exception e) {
log.error("Failure getting features reply from switch" + sw, e);
}
}
return featuresReply;
}
示例3: setFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
@JsonIgnore
public void setFeaturesReply(OFFeaturesReply featuresReply) {
if (stringId == null) {
/* ports are updated via port status message, so we
* only fill in ports on initial connection.
*/
List<ImmutablePort> immutablePorts = ImmutablePort
.immutablePortListOf(featuresReply.getPorts());
portManager.updatePorts(immutablePorts);
}
this.datapathId = featuresReply.getDatapathId();
this.stringId = HexString.toHexString(featuresReply.getDatapathId());
this.capabilities = featuresReply.getCapabilities();
this.buffers = featuresReply.getBuffers();
this.actions = featuresReply.getActions();
this.tables = featuresReply.getTables();
}
示例4: SwitchSyncRepresentation
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public SwitchSyncRepresentation(OFFeaturesReply fr,
OFDescriptionStatistics d) {
this.dpid = fr.getDatapathId();
this.buffers = fr.getBuffers();
this.tables = fr.getTables();
this.capabilities = fr.getCapabilities();
this.actions = fr.getActions();
this.ports = toSyncedPortList(
ImmutablePort.immutablePortListOf(fr.getPorts()));
this.manufacturerDescription = d.getManufacturerDescription();
this.hardwareDescription = d.getHardwareDescription();
this.softwareDescription = d.getSoftwareDescription();
this.serialNumber = d.getSerialNumber();
this.datapathDescription = d.getDatapathDescription();
}
示例5: processOFFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
throws IOException {
h.featuresReply = m;
if (m.getTables() > 1) {
log.debug("Have {} table for switch {}", m.getTables(),
h.getSwitchInfoString());
// likely supports L2 table extensions. Send set
h.sendHandshakeL2TableSet();
// TODO: no L2 SET reply yet, so fire and forget the set
// table message and move directly to sendHandshakeConfig
h.sendHandshakeSetConfig();
h.setState(WAIT_CONFIG_REPLY);
//h.setState(WAIT_SET_L2_TABLE_REPLY);
} else {
h.sendHandshakeSetConfig();
h.setState(WAIT_CONFIG_REPLY);
}
}
示例6: doAddSwitchToStore
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
* Create a switch sync representation and add it to the store and
* notify the store listener.
* If the description and/or features reply are null, we'll allocate
* the default one
*/
public void doAddSwitchToStore(long dpid,
OFDescriptionStatistics desc,
OFFeaturesReply featuresReply)
throws Exception {
if (featuresReply == null) {
featuresReply = createOFFeaturesReply();
featuresReply.setDatapathId(dpid);
}
if (desc == null) {
desc = createOFDescriptionStatistics();
}
SwitchSyncRepresentation ssr =
new SwitchSyncRepresentation(featuresReply, desc);
storeClient.put(dpid, ssr);
Iterator<Long> keysToNotify = Collections.singletonList(dpid).iterator();
controller.getStoreListener().keysModified(keysToNotify,
UpdateType.REMOTE);
}
示例7: setUpFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Before
public void setUpFeaturesReply() {
featuresReply = (OFFeaturesReply)BasicFactory.getInstance()
.getMessage(OFType.FEATURES_REPLY);
featuresReply.setDatapathId(0x42L);
featuresReply.setBuffers(1);
featuresReply.setTables((byte)1);
featuresReply.setCapabilities(3);
featuresReply.setActions(4);
List<OFPhysicalPort> ports = new ArrayList<OFPhysicalPort>();
// A dummy port.
OFPhysicalPort p = new OFPhysicalPort();
p.setName("Eth1");
p.setPortNumber((short)1);
ports.add(p);
featuresReply.setPorts(ports);
}
示例8: getSwitchFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
protected OFFeaturesReply getSwitchFeaturesReply(long switchId) {
IFloodlightProviderService floodlightProvider =
(IFloodlightProviderService)getContext().getAttributes().
get(IFloodlightProviderService.class.getCanonicalName());
IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
Future<OFFeaturesReply> future;
OFFeaturesReply featuresReply = null;
if (sw != null) {
try {
future = sw.getFeaturesReplyFromSwitch();
featuresReply = future.get(10, TimeUnit.SECONDS);
} catch (Exception e) {
log.error("Failure getting features reply from switch" + sw, e);
}
}
return featuresReply;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:20,代码来源:SwitchResourceBase.java
示例9: setFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
@JsonIgnore
public void setFeaturesReply(OFFeaturesReply featuresReply) {
synchronized(portLock) {
if (stringId == null) {
/* ports are updated via port status message, so we
* only fill in ports on initial connection.
*/
for (OFPhysicalPort port : featuresReply.getPorts()) {
setPort(port);
}
}
this.datapathId = featuresReply.getDatapathId();
this.capabilities = featuresReply.getCapabilities();
this.buffers = featuresReply.getBuffers();
this.actions = featuresReply.getActions();
this.tables = featuresReply.getTables();
this.stringId = HexString.toHexString(this.datapathId);
}
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:21,代码来源:OFSwitchImpl.java
示例10: getSwitchFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
protected OFFeaturesReply getSwitchFeaturesReply(long switchId) {
IControllerService controllerProvider =
(IControllerService)getContext().getAttributes().
get(IControllerService.class.getCanonicalName());
IOFSwitch sw = controllerProvider.getSwitches().get(switchId);
Future<OFFeaturesReply> future;
OFFeaturesReply featuresReply = null;
if (sw != null) {
try {
future = sw.querySwitchFeaturesReply();
featuresReply = future.get(10, TimeUnit.SECONDS);
} catch (Exception e) {
log.error("Failure getting features reply from switch" + sw, e);
}
}
return featuresReply;
}
示例11: processOFFeaturesRequest
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
void processOFFeaturesRequest(final ControllerChannelHandler h,
final OFFeaturesRequest m) {
final OFFeaturesReply reply = h.sw.getFeaturesReply();
if (reply == null) {
h.log.error("OVXSwitch failed to return a featuresReply message: {}"
+ h.sw.getSwitchName());
h.channel.disconnect();
}
reply.setXid(m.getXid());
h.channel.write(Collections.singletonList(reply));
h.log.info("Connected dpid {} to controller {}",
h.sw.getSwitchName(), h.channel.getRemoteAddress());
h.sw.setConnected(true);
h.setState(ACTIVE);
}
示例12: testAddSwitchNoClearFM
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Test
public void testAddSwitchNoClearFM() throws Exception {
controller.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();
OFSwitchImpl oldsw = new OFSwitchImpl();
OFFeaturesReply featuresReply = new OFFeaturesReply();
featuresReply.setDatapathId(0L);
featuresReply.setPorts(new ArrayList<OFPhysicalPort>());
oldsw.setFeaturesReply(featuresReply);
Channel channel = createMock(Channel.class);
oldsw.setChannel(channel);
expect(channel.getRemoteAddress()).andReturn(null);
expect(channel.close()).andReturn(null);
IOFSwitch newsw = createMock(IOFSwitch.class);
expect(newsw.getId()).andReturn(0L).anyTimes();
expect(newsw.getStringId()).andReturn("00:00:00:00:00:00:00").anyTimes();
controller.activeSwitches.put(0L, oldsw);
replay(newsw, channel);
controller.addSwitch(newsw, false);
verify(newsw, channel);
}
示例13: querySwitchFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
public Future<OFFeaturesReply> querySwitchFeaturesReply()
throws IOException {
OFMessage request =
floodlightProvider.getOFMessageFactory().
getMessage(OFType.FEATURES_REQUEST);
request.setXid(getNextTransactionId());
OFFeaturesReplyFuture future =
new OFFeaturesReplyFuture(threadPool, this, request.getXid());
this.featuresFutureMap.put(request.getXid(), future);
List<OFMessage> msglist = new ArrayList<OFMessage>(1);
msglist.add(request);
this.write(msglist);
return future;
}
示例14: getFeaturesReply
import org.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@JsonIgnore
public OFFeaturesReply getFeaturesReply() {
OFFeaturesReply fr = new OFFeaturesReply();
fr.setDatapathId(dpid);
fr.setBuffers(buffers);
fr.setTables(tables);
fr.setCapabilities(capabilities);
fr.setActions(actions);
fr.setPorts(toOFPhysicalPortList(ports));
return fr;
}
示例15: setupSwitchForAddSwitch
import org.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, long dpid,
OFDescriptionStatistics desc,
OFFeaturesReply featuresReply) {
String dpidString = HexString.toHexString(dpid);
if (desc == null) {
desc = createOFDescriptionStatistics();
}
if (featuresReply == null) {
featuresReply = createOFFeaturesReply();
featuresReply.setDatapathId(dpid);
}
List<ImmutablePort> ports =
ImmutablePort.immutablePortListOf(featuresReply.getPorts());
expect(sw.getId()).andReturn(dpid).anyTimes();
expect(sw.getStringId()).andReturn(dpidString).anyTimes();
expect(sw.getDescriptionStatistics()) .andReturn(desc).atLeastOnce();
expect(sw.getBuffers())
.andReturn(featuresReply.getBuffers()).atLeastOnce();
expect(sw.getTables())
.andReturn(featuresReply.getTables()).atLeastOnce();
expect(sw.getCapabilities())
.andReturn(featuresReply.getCapabilities()).atLeastOnce();
expect(sw.getActions())
.andReturn(featuresReply.getActions()).atLeastOnce();
expect(sw.getPorts())
.andReturn(ports).atLeastOnce();
expect(sw.attributeEquals(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true))
.andReturn(false).anyTimes();
expect(sw.getInetAddress()).andReturn(null).anyTimes();
}