use of org.openkilda.floodlight.switchmanager.factory.generator.MeteredFlowGenerator in project open-kilda by telstra.
the class SwitchManager method modifyDefaultMeter.
@Override
public void modifyDefaultMeter(DatapathId dpid, long meterId) throws SwitchNotFoundException, InvalidMeterIdException, UnsupportedSwitchOperationException, OfInstallException {
if (!DEFAULT_METERS.contains(meterId)) {
throw new InvalidMeterIdException(dpid, format("Could not modify meter '%d' onto switch '%s' because meter is invalid. " + "Valid default meter IDs are: %s", meterId, dpid, DEFAULT_METERS));
}
IOFSwitch sw = lookupSwitch(dpid);
verifySwitchSupportsMeters(sw);
MeteredFlowGenerator generator = getGeneratorByMeterId(meterId).orElseThrow(() -> new InvalidMeterIdException(dpid, format("Couldn't modify meter %d on switch %s. Meter ID is unknown.", meterId, dpid)));
logger.info("Modifying meter {} on Switch {}", meterId, dpid);
pushFlow(sw, "--ModifyMeter--", generator.generateMeterModify(sw));
}
Aggregations