[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;
}
diff --git a/impl/src/test/java/org/opencord/olt/impl/TestBase.java b/impl/src/test/java/org/opencord/olt/impl/TestBase.java
index b6546d0..9e14ee7 100644
--- a/impl/src/test/java/org/opencord/olt/impl/TestBase.java
+++ b/impl/src/test/java/org/opencord/olt/impl/TestBase.java
@@ -59,7 +59,7 @@
protected void addBandwidthProfile(String id) {
BandwidthProfileInformation bpInfo = new BandwidthProfileInformation();
- bpInfo.setAssuredInformationRate(0);
+ bpInfo.setGuaranteedInformationRate(0);
bpInfo.setCommittedInformationRate(10000);
bpInfo.setCommittedBurstSize(1000L);
bpInfo.setExceededBurstSize(2000L);
diff --git a/pom.xml b/pom.xml
index e25268b..d78d1d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
<packaging>pom</packaging>
<properties>
- <sadis.api.version>5.3.0</sadis.api.version>
+ <sadis.api.version>5.4.0-SNAPSHOT</sadis.api.version>
<olt.api.version>4.5.0-SNAPSHOT</olt.api.version>
</properties>