[VOL-3869] Changes ONOS BW profile representation
to reflect IETF representation
* Addition of GIR
* Addition of PIR/PBS
Change-Id: Id97fd9cb85ee018ced73836ead8be4d653e0e55f
diff --git a/app/src/main/java/org/opencord/sadis/impl/BandwidthProfileCodec.java b/app/src/main/java/org/opencord/sadis/impl/BandwidthProfileCodec.java
index 8bd38f1..277246d 100644
--- a/app/src/main/java/org/opencord/sadis/impl/BandwidthProfileCodec.java
+++ b/app/src/main/java/org/opencord/sadis/impl/BandwidthProfileCodec.java
@@ -23,13 +23,23 @@
public class BandwidthProfileCodec extends JsonCodec<BandwidthProfileInformation> {
@Override
public ObjectNode encode(BandwidthProfileInformation entry, CodecContext context) {
- return context.mapper().createObjectNode()
+
+ ObjectNode node = context.mapper().createObjectNode()
.put("id", entry.id())
.put("cir", (entry.committedInformationRate()))
.put("cbs", (entry.committedBurstSize() == null) ? "" : entry.committedBurstSize().toString())
- .put("eir", entry.exceededInformationRate())
- .put("ebs", (entry.exceededBurstSize() == null) ? "" : entry.exceededBurstSize().toString())
- .put("air", entry.assuredInformationRate());
+ .put("air", entry.assuredInformationRate())
+ .put("gir", entry.guaranteedInformationRate());
+
+ if (entry.peakInformationRate() == 0 && entry.peakBurstSize() == null) {
+ node.put("eir", entry.exceededInformationRate());
+ node.put("ebs", (entry.exceededBurstSize() == null) ? "" : entry.exceededBurstSize().toString());
+ } else {
+ node.put("pir", entry.peakInformationRate());
+ node.put("pbs", (entry.peakBurstSize() == null) ? "" : entry.peakBurstSize().toString());
+ }
+
+ return node;
}
}