本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFMeterMod.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java OFMeterMod.Builder方法的具体用法?Java OFMeterMod.Builder怎么用?Java OFMeterMod.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.projectfloodlight.openflow.protocol.OFMeterMod
的用法示例。
在下文中一共展示了OFMeterMod.Builder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteMeter
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public ImmutablePair<Long, Boolean> deleteMeter(IOFSwitch sw, final DatapathId dpid, final long meterId) {
logger.debug("deleting meter {} from switch {}", meterId, dpid);
OFFactory ofFactory = sw.getOFFactory();
OFMeterMod.Builder meterDeleteBuilder = ofFactory.buildMeterMod()
.setMeterId(meterId)
.setCommand(OFMeterModCommand.DELETE);
if (sw.getOFFactory().getVersion().compareTo(OF_13) > 0) {
meterDeleteBuilder.setBands(emptyList());
} else {
meterDeleteBuilder.setMeters(emptyList());
}
OFMeterMod meterDelete = meterDeleteBuilder.build();
boolean response = sw.write(meterDelete);
return new ImmutablePair<>(meterDelete.getXid(), response);
}
示例2: builderMeterMod
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
private OFMeterMod.Builder builderMeterMod() {
OFMeterMod.Builder builder = factory.buildMeterMod();
int flags = 0;
if (burst) {
// covering loxi short comings.
flags |= 1 << OFMeterFlags.BURST.ordinal();
}
switch (unit) {
case PKTS_PER_SEC:
flags |= 1 << OFMeterFlags.PKTPS.ordinal();
break;
case KB_PER_SEC:
flags |= 1 << OFMeterFlags.KBPS.ordinal();
break;
default:
log.warn("Unknown unit type {}", unit);
}
//FIXME: THIS WILL CHANGE IN OF1.4 to setBands.
builder.setMeters(buildBands());
builder.setFlags(flags)
.setMeterId(id)
.setXid(xid);
return builder;
}
示例3: installMeter
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
private ImmutablePair<Long, Boolean> installMeter(final IOFSwitch sw, final DatapathId dpid, final long bandwidth,
final long burstSize, final long meterId) {
logger.debug("installing meter {} on switch {} width bandwidth {}", meterId, dpid, bandwidth);
Set<OFMeterFlags> flags = new HashSet<>(Arrays.asList(OFMeterFlags.KBPS, OFMeterFlags.BURST));
OFFactory ofFactory = sw.getOFFactory();
OFMeterBandDrop.Builder bandBuilder = ofFactory.meterBands()
.buildDrop()
.setRate(bandwidth)
.setBurstSize(burstSize);
OFMeterMod.Builder meterModBuilder = ofFactory.buildMeterMod()
.setMeterId(meterId)
.setCommand(OFMeterModCommand.ADD)
.setFlags(flags);
if (sw.getOFFactory().getVersion().compareTo(OF_13) > 0) {
meterModBuilder.setBands(singletonList(bandBuilder.build()));
} else {
meterModBuilder.setMeters(singletonList(bandBuilder.build()));
}
OFMeterMod meterMod = meterModBuilder.build();
boolean response = sw.write(meterMod);
return new ImmutablePair<>(meterMod.getXid(), response);
}
示例4: builderMeterMod
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
private OFMeterMod.Builder builderMeterMod() {
OFMeterMod.Builder builder = factory.buildMeterMod();
Set<OFMeterFlags> flags = EnumSet.noneOf(OFMeterFlags.class);
if (burst) {
flags.add(OFMeterFlags.BURST);
}
switch (unit) {
case PKTS_PER_SEC:
flags.add(OFMeterFlags.PKTPS);
break;
case KB_PER_SEC:
flags.add(OFMeterFlags.KBPS);
break;
default:
log.warn("Unknown unit type {}", unit);
}
if (factory.getVersion().getWireVersion() >= OFVersion.OF_14.getWireVersion()) {
builder.setBands(buildBands());
} else {
builder.setMeters(buildBands());
}
builder.setFlags(flags)
.setMeterId(id)
.setXid(xid);
return builder;
}
示例5: add
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public OFMeterMod add() {
validate();
OFMeterMod.Builder builder = builderMeterMod();
builder.setCommand(OFMeterModCommand.ADD.ordinal());
return builder.build();
}
示例6: remove
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public OFMeterMod remove() {
validate();
OFMeterMod.Builder builder = builderMeterMod();
builder.setCommand(OFMeterModCommand.DELETE.ordinal());
return builder.build();
}
示例7: modify
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public OFMeterMod modify() {
validate();
OFMeterMod.Builder builder = builderMeterMod();
builder.setCommand(OFMeterModCommand.MODIFY.ordinal());
return builder.build();
}
示例8: add
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public OFMeterMod add() {
validate();
OFMeterMod.Builder builder = builderMeterMod();
builder.setCommand(OFMeterModCommand.ADD);
return builder.build();
}
示例9: remove
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public OFMeterMod remove() {
validate();
OFMeterMod.Builder builder = builderMeterMod();
builder.setCommand(OFMeterModCommand.DELETE);
return builder.build();
}
示例10: modify
import org.projectfloodlight.openflow.protocol.OFMeterMod; //导入方法依赖的package包/类
public OFMeterMod modify() {
validate();
OFMeterMod.Builder builder = builderMeterMod();
builder.setCommand(OFMeterModCommand.MODIFY);
return builder.build();
}