VOL-1044 Make alloc_id and sched_id dependent on Pon port

Change-Id: I81794fde29d6f1befd4d782bef788a25751113dd
diff --git a/src/core.cc b/src/core.cc
index 8fc2c78..b0772cc 100644
--- a/src/core.cc
+++ b/src/core.cc
@@ -43,12 +43,12 @@
 static Status SchedAdd_(int intf_id, int onu_id, int agg_port_id, int pir);
 static Status SchedRemove_(int intf_id, int onu_id, int agg_port_id);
 
-static inline int mk_sched_id(int onu_id) {
-    return 1023 + onu_id;
+static inline int mk_sched_id(int intf_id, int onu_id) {
+    return 1023 + intf_id * 112 + onu_id;
 }
 
-static inline int mk_agg_port_id(int onu_id) {
-    return 1023 + onu_id;
+static inline int mk_agg_port_id(int intf_id, int onu_id) {
+    return 1023 + intf_id * 112 + onu_id;
 }
 
 Status Enable_(int argc, char *argv[]) {
@@ -246,7 +246,7 @@
         return bcm_to_grpc_err(err, "Failed to enable ONU");
     }
 
-    return SchedAdd_(intf_id, onu_id, mk_agg_port_id(onu_id), pir);
+    return SchedAdd_(intf_id, onu_id, mk_agg_port_id(intf_id, onu_id), pir);
 
     //return Status::OK;
 }
@@ -287,7 +287,7 @@
     // Without sleep the race condition is lost by ~ 20 ms
     std::this_thread::sleep_for(std::chrono::milliseconds(100));
 
-    SchedRemove_(intf_id, onu_id, mk_agg_port_id(onu_id));
+    SchedRemove_(intf_id, onu_id, mk_agg_port_id(intf_id, onu_id));
 
     bcmos_errno err = BCM_ERR_OK;
     bcmbal_subscriber_terminal_cfg cfg;
@@ -608,7 +608,7 @@
 
     {
         bcmbal_tm_sched_id val;
-        val = (bcmbal_tm_sched_id) mk_sched_id(onu_id);
+        val = (bcmbal_tm_sched_id) mk_sched_id(access_intf_id, onu_id);
         BCMBAL_CFG_PROP_SET(&cfg, flow, dba_tm_sched_id, val);
     }
 
@@ -733,7 +733,7 @@
     bcmbal_tm_sched_key key = { };
     bcmbal_tm_sched_type sched_type;
 
-    key.id = mk_sched_id(onu_id);
+    key.id = mk_sched_id(intf_id, onu_id);
     key.dir = BCMBAL_TM_SCHED_DIR_US;
 
     BCMBAL_CFG_INIT(&cfg, tm_sched, key);
@@ -777,7 +777,7 @@
     bcmbal_tm_sched_cfg tm_cfg_us;
     bcmbal_tm_sched_key tm_key_us = { };
 
-    tm_key_us.id = mk_sched_id(onu_id);
+    tm_key_us.id = mk_sched_id(intf_id, onu_id);
     tm_key_us.dir = BCMBAL_TM_SCHED_DIR_US;
 
     BCMBAL_CFG_INIT(&tm_cfg_us, tm_sched, tm_key_us);