[VOL-3869] Changes ONOS BW profile representation
to reflect IETF representation
Sending PIR instead of EIR
Change-Id: Iab4639261411a67c9c317aa0316c7d5b0e88542c
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java b/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java
index 2acf10e..59aed0e 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java
@@ -320,9 +320,40 @@
private List<Band> createMeterBands(BandwidthProfileInformation bpInfo) {
List<Band> meterBands = new ArrayList<>();
- meterBands.add(createMeterBand(bpInfo.committedInformationRate(), bpInfo.committedBurstSize()));
- meterBands.add(createMeterBand(bpInfo.exceededInformationRate(), bpInfo.exceededBurstSize()));
- meterBands.add(createMeterBand(bpInfo.assuredInformationRate(), 0L));
+ // add cir
+ if (bpInfo.committedInformationRate() != 0) {
+ meterBands.add(createMeterBand(bpInfo.committedInformationRate(), bpInfo.committedBurstSize()));
+ }
+
+ // check if both air and gir are set together in sadis
+ // if they are, set air to 0
+ if (bpInfo.assuredInformationRate() != 0 && bpInfo.guaranteedInformationRate() != 0) {
+ bpInfo.setAssuredInformationRate(0);
+ }
+
+ // add pir
+ long pir = bpInfo.peakInformationRate() != 0 ? bpInfo.peakInformationRate() : (bpInfo.exceededInformationRate()
+ + bpInfo.committedInformationRate() + bpInfo.guaranteedInformationRate()
+ + bpInfo.assuredInformationRate());
+
+ Long pbs = bpInfo.peakBurstSize() != null ? bpInfo.peakBurstSize() :
+ (bpInfo.exceededBurstSize() != null ? bpInfo.exceededBurstSize() : 0) +
+ (bpInfo.committedBurstSize() != null ? bpInfo.committedBurstSize() : 0);
+
+ meterBands.add(createMeterBand(pir, pbs));
+
+ // add gir
+ if (bpInfo.guaranteedInformationRate() != 0) {
+ meterBands.add(createMeterBand(bpInfo.guaranteedInformationRate(), 0L));
+ }
+
+ // add air
+ // air is used in place of gir only if gir is
+ // not present and air is not 0, see line 330.
+ // Included for backwards compatibility, will be removed in VOLTHA 2.9.
+ if (bpInfo.assuredInformationRate() != 0) {
+ meterBands.add(createMeterBand(bpInfo.assuredInformationRate(), 0L));
+ }
return meterBands;
}