[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/pi/runtime/PiMeterBand.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterBand.java
index b1dbcf5..ea8c34d 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterBand.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterBand.java
@@ -27,21 +27,33 @@
*/
@Beta
public final class PiMeterBand {
+ private final PiMeterBandType type;
private final long rate;
private final long burst;
/**
* Creates a band with rate and burst.
*
+ * @param type type of this band
* @param rate rate of this band
* @param burst burst of this band
*/
- public PiMeterBand(long rate, long burst) {
+ public PiMeterBand(PiMeterBandType type, long rate, long burst) {
+ this.type = type;
this.rate = rate;
this.burst = burst;
}
/**
+ * Returns the type of this band.
+ *
+ * @return type of this band
+ */
+ public PiMeterBandType type() {
+ return type;
+ }
+
+ /**
* Returns the rate of this band.
*
* @return rate of this band
@@ -61,7 +73,7 @@
@Override
public int hashCode() {
- return Objects.hash(rate, burst);
+ return Objects.hash(type, rate, burst);
}
@Override
@@ -71,7 +83,8 @@
}
if (obj instanceof PiMeterBand) {
PiMeterBand that = (PiMeterBand) obj;
- return Objects.equals(rate, that.rate) &&
+ return Objects.equals(type, that.type) &&
+ Objects.equals(rate, that.rate) &&
Objects.equals(burst, that.burst);
}
@@ -80,6 +93,7 @@
public String toString() {
return toStringHelper(this)
+ .add("type", type)
.add("rate", rate)
.add("burst", burst).toString();
}