[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/test/java/org/opencord/sadis/impl/BandwidthProfileManagerTest.java b/app/src/test/java/org/opencord/sadis/impl/BandwidthProfileManagerTest.java
index 9ea46c4..94ccf9a 100644
--- a/app/src/test/java/org/opencord/sadis/impl/BandwidthProfileManagerTest.java
+++ b/app/src/test/java/org/opencord/sadis/impl/BandwidthProfileManagerTest.java
@@ -23,17 +23,34 @@
 import org.opencord.sadis.BaseInformationService;
 
 import java.util.List;
+import java.util.Objects;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class BandwidthProfileManagerTest extends BaseSadis {
 
-    BandwidthProfileBuilder bp1 = BandwidthProfileBuilder.build("High Speed", 1000000000, 384000L,
-            100000000, 384000L, 100000000);
+    BandwidthProfileBuilder bp1 = BandwidthProfileBuilder.build("High Speed", 0, null, 1000000000,
+            384000L, 100000000, 384000L, 100000000);
 
-    BandwidthProfileBuilder bp2 = BandwidthProfileBuilder.build("Home User Speed", 1000000000, 200000L,
-            100000000, 200000L, 100000000);
+    BandwidthProfileBuilder bp2 = BandwidthProfileBuilder.build("Home User Speed", 0, null, 1000000000,
+            200000L, 100000000, 200000L, 100000000);
+
+    BandwidthProfileBuilder bp3 = BandwidthProfileBuilder.build("TCONT_TYPE1_100Mbps_Fixed", 100000, 10000L,
+            0, 0L, 0, null, 100000);
+
+    BandwidthProfileBuilder bp4 = BandwidthProfileBuilder.build("TCONT_TYPE2_50Mbps_Assured", 50000, 10000L,
+            50000, 10000L, 0, null, 0);
+
+    BandwidthProfileBuilder bp5 = BandwidthProfileBuilder.build("TCONT_TYPE3_50Mbps_Assured_100Mbps_Peak",
+            100000, 10000L, 50000, 10000L, 0, null, 0);
+
+    BandwidthProfileBuilder bp6 = BandwidthProfileBuilder.build("TCONT_TYPE4_200Mbps_Peak", 200000, 10000L,
+            0, 0L, 0, null, 0);
+
+    BandwidthProfileBuilder bp7 = BandwidthProfileBuilder.build(
+            "TCONT_TYPE5_100Mbps_Peak_50Mbps_Assured_10Mbps_Fixed", 100000, 10000L, 50000, 10000L,
+            0, null, 10000);
 
     @Before
     public void setUp() throws Exception {
@@ -54,6 +71,11 @@
         BaseInformationService<BandwidthProfileInformation> bpService = sadis.getBandwidthProfileService();
         checkGetForExisting("High Speed", bp1, bpService);
         checkGetForExisting("Home User Speed", bp2, bpService);
+        checkGetForExisting("TCONT_TYPE1_100Mbps_Fixed", bp3, bpService);
+        checkGetForExisting("TCONT_TYPE2_50Mbps_Assured", bp4, bpService);
+        checkGetForExisting("TCONT_TYPE3_50Mbps_Assured_100Mbps_Peak", bp5, bpService);
+        checkGetForExisting("TCONT_TYPE4_200Mbps_Peak", bp6, bpService);
+        checkGetForExisting("TCONT_TYPE5_100Mbps_Peak_50Mbps_Assured_10Mbps_Fixed", bp7, bpService);
 
         invalidateId("High Speed", bpService);
         checkFromBoth("High Speed", bp1, bpService);
@@ -79,23 +101,33 @@
 
     private void checkEntriesForBandwidthProfiles(BaseConfig config) {
         List<BandwidthProfileInformation> entries = config.getEntries();
-        assertEquals(2, entries.size());
+        assertEquals(7, entries.size());
 
-        BandwidthProfileInformation bpi = BandwidthProfileBuilder.build("High Speed", 1000000000, 384000L, 100000000,
-                384000L, 100000000);
+        BandwidthProfileInformation bpi = BandwidthProfileBuilder.build("High Speed", 0, null,
+                1000000000, 384000L, 100000000, 384000L, 100000000);
         assertTrue(checkEquality(bpi, entries.get(0)));
 
-        bpi = BandwidthProfileBuilder.build("Home User Speed", 1000000000, 200000L, 100000000,
-                200000L, 100000000);
+        bpi = BandwidthProfileBuilder.build("Home User Speed", 0, null, 1000000000, 200000L,
+                100000000, 200000L, 100000000);
         assertTrue(checkEquality(bpi, entries.get(1)));
+
+        bpi = BandwidthProfileBuilder.build("TCONT_TYPE1_100Mbps_Fixed", 100000, 10000L, 0, 0L,
+                0, null, 100000);
+        assertTrue(checkEquality(bpi, entries.get(2)));
     }
 
     private static final class BandwidthProfileBuilder extends BandwidthProfileInformation {
 
-        public static BandwidthProfileBuilder build(String id, long cir, Long cbs, long eir, Long ebs, long air) {
+        public static BandwidthProfileBuilder build(String id, long pir, Long pbs,
+                                                    long cir, Long cbs, long eir, Long ebs, long gir) {
             BandwidthProfileBuilder info = new BandwidthProfileBuilder();
             info.setId(id);
 
+            if (pir != 0) {
+                info.setPeakInformationRate(pir);
+                info.setPeakBurstSize(pbs);
+            }
+
             if (cbs != null) {
                 info.setCommittedBurstSize(cbs);
             } else {
@@ -103,14 +135,12 @@
             }
             info.setCommittedInformationRate(cir);
 
-            info.setExceededInformationRate(eir);
-            if (ebs != null) {
+            if (eir != 0) {
+                info.setExceededInformationRate(eir);
                 info.setExceededBurstSize(ebs);
-            } else {
-                info.setExceededBurstSize(0L);
             }
 
-            info.setAssuredInformationRate(air);
+            info.setGuaranteedInformationRate(gir);
             return info;
         }
     }
@@ -132,6 +162,15 @@
             return false;
         }
 
+        if (bpi.peakInformationRate() != other.peakInformationRate()) {
+            return false;
+        }
+
+        if (!Objects.equals(bpi.peakBurstSize(), other.peakBurstSize())) {
+            return false;
+        }
+
+
         if (bpi.committedInformationRate() != other.committedInformationRate()) {
             return false;
         }
@@ -144,11 +183,11 @@
             return false;
         }
 
-        if (!bpi.exceededBurstSize().equals(other.exceededBurstSize())) {
+        if (!Objects.equals(bpi.exceededBurstSize(), other.exceededBurstSize())) {
             return false;
         }
 
-        if (bpi.assuredInformationRate() != other.assuredInformationRate()) {
+        if (bpi.guaranteedInformationRate() != other.guaranteedInformationRate()) {
             return false;
         }