VOL-948: Make gemport and alloc_id configurable from openolt adapter
Change-Id: I9e515cd744934f5a6501ad48ee845912de11c16e
diff --git a/common/core.h b/common/core.h
index be32f00..81b79ad 100644
--- a/common/core.h
+++ b/common/core.h
@@ -30,11 +30,13 @@
Status Enable_(int argc, char *argv[]);
Status ActivateOnu_(uint32_t intf_id, uint32_t onu_id,
- const char *vendor_id, const char *vendor_specific, uint32_t pir);
+ const char *vendor_id, const char *vendor_specific, uint32_t pir,
+ uint32_t agg_port_id, uint32_t alloc_id);
Status DeactivateOnu_(uint32_t intf_id, uint32_t onu_id,
const char *vendor_id, const char *vendor_specific);
Status DeleteOnu_(uint32_t intf_id, uint32_t onu_id,
- const char *vendor_id, const char *vendor_specific);
+ const char *vendor_id, const char *vendor_specific,
+ uint32_t agg_port_id, uint32_t alloc_id);
Status EnablePonIf_(uint32_t intf_id);
Status DisablePonIf_(uint32_t intf_id);
Status EnableUplinkIf_(uint32_t intf_id);
@@ -45,7 +47,7 @@
Status FlowAdd_(uint32_t onu_id,
uint32_t flow_id, const std::string flow_type,
uint32_t access_intf_id, uint32_t network_intf_id,
- uint32_t gemport_id, uint32_t priority,
+ uint32_t gemport_id, uint32_t alloc_id, uint32_t priority,
const ::openolt::Classifier& classifier,
const ::openolt::Action& action);
Status FlowRemove_(uint32_t flow_id, const std::string flow_type);
diff --git a/common/server.cc b/common/server.cc
index e1759cb..027c24b 100644
--- a/common/server.cc
+++ b/common/server.cc
@@ -68,7 +68,8 @@
request->onu_id(),
((request->serial_number()).vendor_id()).c_str(),
((request->serial_number()).vendor_specific()).c_str(),
- request->pir());
+ request->pir(), request->agg_port_id(),
+ request->sched_id());
}
Status DeactivateOnu(
@@ -90,7 +91,8 @@
request->intf_id(),
request->onu_id(),
((request->serial_number()).vendor_id()).c_str(),
- ((request->serial_number()).vendor_specific()).c_str());
+ ((request->serial_number()).vendor_specific()).c_str(),
+ request->agg_port_id(), request->sched_id());
}
Status OmciMsgOut(
@@ -133,6 +135,7 @@
request->access_intf_id(),
request->network_intf_id(),
request->gemport_id(),
+ request->alloc_id(),
request->priority(),
request->classifier(),
request->action());
diff --git a/protos/openolt.proto b/protos/openolt.proto
index 00509f6..d02b64f 100644
--- a/protos/openolt.proto
+++ b/protos/openolt.proto
@@ -204,6 +204,8 @@
fixed32 onu_id = 2;
SerialNumber serial_number = 3;
fixed32 pir = 4; // peak information rate assigned to onu
+ fixed32 agg_port_id = 5;
+ fixed32 sched_id = 6;
}
message OmciMsg {
@@ -264,6 +266,7 @@
string flow_type = 4; // upstream, downstream, broadcast, multicast
fixed32 network_intf_id = 5;
fixed32 gemport_id = 6;
+ fixed32 alloc_id = 10;
Classifier classifier = 7;
Action action = 8;
fixed32 priority = 9;
diff --git a/src/core.cc b/src/core.cc
index 2ae596d..458c93e 100644
--- a/src/core.cc
+++ b/src/core.cc
@@ -40,8 +40,8 @@
State state;
-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 Status SchedAdd_(int intf_id, int onu_id, int agg_port_id, int sched_id, int pir);
+static Status SchedRemove_(int intf_id, int onu_id, int agg_port_id, int sched_id);
static inline int mk_sched_id(int intf_id, int onu_id) {
return 1023 + intf_id * 112 + onu_id;
@@ -208,7 +208,8 @@
}
Status ActivateOnu_(uint32_t intf_id, uint32_t onu_id,
- const char *vendor_id, const char *vendor_specific, uint32_t pir) {
+ const char *vendor_id, const char *vendor_specific, uint32_t pir,
+ uint32_t agg_port_id, uint32_t sched_id) {
bcmbal_subscriber_terminal_cfg sub_term_obj = {};
bcmbal_subscriber_terminal_key subs_terminal_key;
@@ -246,7 +247,11 @@
return bcm_to_grpc_err(err, "Failed to enable ONU");
}
- return SchedAdd_(intf_id, onu_id, mk_agg_port_id(intf_id, onu_id), pir);
+ if (agg_port_id != 0) {
+ return SchedAdd_(intf_id, onu_id, agg_port_id, sched_id, pir);
+ } else {
+ return SchedAdd_(intf_id, onu_id, mk_agg_port_id(intf_id, onu_id), sched_id, pir);
+ }
//return Status::OK;
}
@@ -277,7 +282,8 @@
}
Status DeleteOnu_(uint32_t intf_id, uint32_t onu_id,
- const char *vendor_id, const char *vendor_specific) {
+ const char *vendor_id, const char *vendor_specific,
+ uint32_t agg_port_id, uint32_t sched_id) {
// Need to deactivate before removing it (BAL rules)
@@ -287,7 +293,11 @@
// 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(intf_id, onu_id));
+ if (agg_port_id != 0) {
+ SchedRemove_(intf_id, onu_id, agg_port_id, sched_id);
+ } else {
+ SchedRemove_(intf_id, onu_id, mk_agg_port_id(intf_id, onu_id), sched_id);
+ }
bcmos_errno err = BCM_ERR_OK;
bcmbal_subscriber_terminal_cfg cfg;
@@ -424,7 +434,8 @@
Status FlowAdd_(uint32_t onu_id,
uint32_t flow_id, const std::string flow_type,
uint32_t access_intf_id, uint32_t network_intf_id,
- uint32_t gemport_id, uint32_t priority_value,
+ uint32_t gemport_id, uint32_t sched_id,
+ uint32_t priority_value,
const ::openolt::Classifier& classifier,
const ::openolt::Action& action) {
bcmos_errno err;
@@ -608,7 +619,11 @@
{
bcmbal_tm_sched_id val;
+ if (sched_id != 0) {
+ val = sched_id;
+ } else {
val = (bcmbal_tm_sched_id) mk_sched_id(access_intf_id, onu_id);
+ }
BCMBAL_CFG_PROP_SET(&cfg, flow, dba_tm_sched_id, val);
}
@@ -660,7 +675,7 @@
return Status::OK;
}
-Status SchedAdd_(int intf_id, int onu_id, int agg_port_id, int pir) {
+Status SchedAdd_(int intf_id, int onu_id, int agg_port_id, int sched_id, int pir) {
bcmos_errno err;
@@ -733,7 +748,11 @@
bcmbal_tm_sched_key key = { };
bcmbal_tm_sched_type sched_type;
+ if (sched_id != 0) {
+ key.id = sched_id;
+ } else {
key.id = mk_sched_id(intf_id, onu_id);
+ }
key.dir = BCMBAL_TM_SCHED_DIR_US;
BCMBAL_CFG_INIT(&cfg, tm_sched, key);
@@ -768,7 +787,7 @@
return Status::OK;
}
-Status SchedRemove_(int intf_id, int onu_id, int agg_port_id) {
+Status SchedRemove_(int intf_id, int onu_id, int agg_port_id, int sched_id) {
bcmos_errno err;
@@ -777,7 +796,11 @@
bcmbal_tm_sched_cfg tm_cfg_us;
bcmbal_tm_sched_key tm_key_us = { };
+ if (sched_id != 0) {
+ tm_key_us.id = sched_id;
+ } else {
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);