Search in sources :

Example 1 with OFLegacyMeterMod

use of org.projectfloodlight.openflow.protocol.OFLegacyMeterMod in project open-kilda by telstra.

the class SwitchManager method deleteLegacyMeter.

public long deleteLegacyMeter(final IOFSwitch sw, final DatapathId dpid, final long meterId) throws OFInstallException {
    logger.debug("deleting legacy meter {} from switch {}", meterId, dpid);
    OFFactory ofFactory = sw.getOFFactory();
    OFLegacyMeterMod meterDelete = ofFactory.buildLegacyMeterMod().setMeterId(meterId).setMeters(emptyList()).setCommand(OFLegacyMeterModCommand.DELETE).build();
    return pushFlow(sw, "--DeleteMeter--", meterDelete);
}
Also used : OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFLegacyMeterMod(org.projectfloodlight.openflow.protocol.OFLegacyMeterMod)

Example 2 with OFLegacyMeterMod

use of org.projectfloodlight.openflow.protocol.OFLegacyMeterMod in project open-kilda by telstra.

the class SwitchManager method installLegacyMeter.

private long installLegacyMeter(final IOFSwitch sw, final DatapathId dpid, final long bandwidth, final long burstSize, final long meterId) throws OFInstallException {
    logger.debug("installing legacy meter {} on OVS switch {} width bandwidth {}", meterId, dpid, bandwidth);
    Set<OFLegacyMeterFlags> flags = new HashSet<>(asList(OFLegacyMeterFlags.KBPS, OFLegacyMeterFlags.BURST));
    OFFactory ofFactory = sw.getOFFactory();
    OFLegacyMeterBandDrop.Builder bandBuilder = ofFactory.legacyMeterBandDrop(bandwidth, burstSize).createBuilder();
    OFLegacyMeterMod meterMod = ofFactory.buildLegacyMeterMod().setMeterId(meterId).setCommand(OFLegacyMeterModCommand.ADD).setMeters(singletonList(bandBuilder.build())).setFlags(flags).build();
    return pushFlow(sw, "--InstallMeter", meterMod);
}
Also used : OFLegacyMeterFlags(org.projectfloodlight.openflow.protocol.OFLegacyMeterFlags) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFLegacyMeterBandDrop(org.projectfloodlight.openflow.protocol.OFLegacyMeterBandDrop) OFLegacyMeterMod(org.projectfloodlight.openflow.protocol.OFLegacyMeterMod) HashSet(java.util.HashSet)

Aggregations

OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)2 OFLegacyMeterMod (org.projectfloodlight.openflow.protocol.OFLegacyMeterMod)2 HashSet (java.util.HashSet)1 OFLegacyMeterBandDrop (org.projectfloodlight.openflow.protocol.OFLegacyMeterBandDrop)1 OFLegacyMeterFlags (org.projectfloodlight.openflow.protocol.OFLegacyMeterFlags)1