[SDFAB-500][SDFAB-527] Meters cleanup and leftovers
- Improve ONOS cli enabling CRUD of p4rt trtcm
- Improve ONOS rest enabling CRUD of p4rt trtcm
- Improve MeterService with scope defined reads and integrate in cli/rest
- Add support along the stack for BYTE_PER_SEC unit
- Add support along the stack for COMMITTED and PEAK bands
- Fix several bugs in ONOS cli/rest interfaces
- Improve REST codecs
- Fix NPE in MeterDriverProvider
- Improve PiMeterTransalation by enforcing trtcm config
- Implement explicit translation of the bands
- Fix ONOS reconciliation by removing from the mirror the wrong configs
- Remove unnecessary checks in MeterEntryCodec
- Update unit tests
It will follow a 2nd patch to complete SDFAB-527
Change-Id: I855235b17f60cb1d39f5b9a042c1015105a8a269
diff --git a/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java b/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java
index 0dbd4f7..617151d 100644
--- a/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java
@@ -33,8 +33,6 @@
*/
public final class DefaultMeterRequest extends AbstractAnnotated implements MeterRequest {
-
-
private final ApplicationId appId;
private final Meter.Unit unit;
private final boolean burst;
@@ -122,6 +120,8 @@
}
public static final class Builder implements MeterRequest.Builder {
+ // Relevant only for delete
+ private static final Band DUMMY_BAND = new DefaultBand(Band.Type.DROP, 0L, 0L, (short) 0);
private ApplicationId appId;
private Meter.Unit unit = Meter.Unit.KB_PER_SEC;
@@ -196,6 +196,11 @@
@Override
public MeterRequest remove() {
+ // Allow to create the removal request without specifying bands
+ if (bands == null || bands.isEmpty()) {
+ bands = ImmutableSet.of(DUMMY_BAND);
+ }
+
validate();
return new DefaultMeterRequest(deviceId, appId, unit, burst, bands, context,
Type.REMOVE, scope, desiredIndex, annotations);