[VOL-1635] This OpenOLT agent supports the BAL V3.0.3.3 SDK.
The APIs call,variables and structures has been changed to BAL v3.0.
OLT activation from voltha-1.7 is successful.
Change-Id: I2096251262ef515a3dbf579eca806fc551bdecf1
diff --git a/agent/Makefile.in b/agent/Makefile.in
index 67ad514..f30f94f 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -27,14 +27,17 @@
# SW-BCM68620_<VER>.zip - Broadcom BAL source and Maple SDK.
# sdk-all-<SDK_VER>.tar.gz - Broadcom Qumran SDK.
# ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch.
-BAL_MAJOR_VER = 03.00
-BAL_VER = 3.0.3.3
+BAL_MAJOR_VER = 3
+BAL_MINOR_VER = 0
+BAL_REV_A_VER = 3
+BAL_REV_B_VER = 3
+BAL_API_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER)
+BAL_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER)
SDK_VER = 6.5.13
DEV_VER ?= 201904171432
#
# Version of Open Network Linux (ONL).
ONL_KERN_VER_MAJOR = 4.14
-ONL_KERN_VER_MINOR = 49
#
# Build directory
BUILD_DIR = build
@@ -98,7 +101,6 @@
## ONL
##
##
-ONL_KERN_VER = $(ONL_KERN_VER_MAJOR).$(ONL_KERN_VER_MINOR)
ONL_REPO = $(OPENOLTDEVICE)-onl
ONL_DIR = $(BUILD_DIR)/$(ONL_REPO)
onl:
@@ -106,7 +108,7 @@
mkdir -p $(ONL_DIR); \
git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
cp download/Makefile.onl $(ONL_DIR)/Makefile; \
- install -m 755 download/build-asfvolt16.sh $(ONL_DIR)/OpenNetworkLinux; \
+ install -m 755 download/build-$(OPENOLTDEVICE).sh $(ONL_DIR)/OpenNetworkLinux; \
make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR); \
fi;
onl-force:
@@ -117,51 +119,61 @@
########################################################################
##
##
+## Broadcom LIBRARY APIs
+##
+##
+BAL_API_DIR = $(BUILD_DIR)/bal-api-$(BAL_API_VER)
+
+bal-api-$(BAL_API_VER):
+ if [ ! -d "$(BAL_API_DIR)" ]; then \
+ mkdir -p $(BAL_API_DIR); \
+ git clone https://github.com/balapi/bal-api-3.0.git $(BAL_API_DIR); \
+ fi;
+bal-api-clean:
+ rm $(BAL_API_DIR)
+
+########################################################################
+##
+##
## BAL
##
##
BAL_ZIP = SW-BCM68620_$(subst .,_,$(BAL_VER)).tgz
SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
-OPENOLT_BAL_PATCH = OPENOLT_BAL_$(BAL_VER).patch
BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal
-BCM_SDK = $(BAL_DIR)/switch_sdk/6.5.13
-BALLIBDIR = $(BAL_DIR)/build/asfvolt16-bal/build/lib/libbal_core.so
-BALLIBNAME = bal_core.so
-BAL_INC = -I$(BAL_DIR)/bal_release/src/common/os_abstraction \
- -I$(BAL_DIR)/bal_release/src/common/os_abstraction/posix \
- -I$(BAL_DIR)/bal_release/src/common/config \
- -I$(BAL_DIR)/bal_release/src/core/platform \
- -I$(BAL_DIR)/bal_release/src/core/main \
- -I$(BAL_DIR)/bal_release/src/common/include \
- -I$(BAL_DIR)/bal_release/src/lib/libbalapi \
- -I$(BAL_DIR)/bal_release/src/balapiend \
- -I$(BAL_DIR)/bal_release/src/common/dev_log \
- -I$(BAL_DIR)/bal_release/src/common/bal_dist_utils \
- -I$(BAL_DIR)/bal_release/src/lib/libtopology \
- -I$(BAL_DIR)/bal_release/src/lib/libcmdline \
- -I$(BAL_DIR)/bal_release/src/lib/libutils \
- -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/utils \
- -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/model \
- -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/api \
- -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_reference/cli
+BCM_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER)
+BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api
+BALLIBNAME = bal_host_api
+BAL_INC = -I$(BAL_DIR)/host_driver/bal/bal_include \
+ -I$(BAL_DIR)/host_driver/topology \
+ -I$(BAL_DIR)/host_driver/utils \
+ -I$(BAL_DIR)/host_driver/api \
+ -I$(BAL_DIR)/host_customized/os_abstraction \
+ -I$(BAL_DIR)/host_customized/os_abstraction/posix \
+ -I$(BAL_DIR)/host_customized/config \
+ -I$(BAL_DIR)/host_driver/api_conn_mgr \
+ -I$(BAL_DIR)/host_driver/conn_mgr \
+ -I$(BAL_DIR)/host_driver/api/host/topology \
+ -I$(BAL_DIR)/host_reference/cli \
+ -I$(BAL_DIR)/host_reference/api_cli \
+ -I$(BAL_API_DIR)/include \
+ -I$(BAL_API_DIR)/include/object_model
CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline
-CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG
+CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG -DENABLE_CLI
-sdk: onl
+sdk: onl bal-api-$(BAL_API_VER)
ifeq ("$(wildcard $(BAL_DIR))","")
mkdir $(BAL_DIR)
tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR)
cp download/$(SDK_ZIP) $(BCM_SDK)
chmod -R 744 $(BAL_DIR)
cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR)
- make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux SW_UTIL_SHELL=y
- echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini
+ make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux SW_UTIL_SHELL=y OPEN_SOURCE=y
make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
endif
bal-release: sdk
- echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini
make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
bal-clean:
@@ -229,17 +241,15 @@
OBJS = $(SRCS:.cc=.o)
DEPS = $(SRCS:.cc=.d)
.DEFAULT_GOAL := all
-#all: $(BUILD_DIR)/openolt
-all: notes onl sdk
-notes:
- echo "\033[1;31m!!! The OpenOLT source codes is not yet support the BAL V3.0, so ignoring to build !!!\033[0m"
+all: $(BUILD_DIR)/openolt
$(BUILD_DIR)/openolt: sdk protos $(OBJS)
$(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc)
- ln -sf $(PWD)/$(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/.
- ln -sf $(PWD)/$(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/release/broadcom/libbal_api_dist.so $(BUILD_DIR)/.
- ln -sf $(PWD)/$(BAL_DIR)/bal_release/build/core/src/apps/bal_core_dist/bal_core_dist $(BUILD_DIR)/.
+ ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/.
+ ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_api.so $(BUILD_DIR)/.
+ ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_driver/dev_mgmt_daemon/dev_mgmt_daemon $(BUILD_DIR)/.
ln -sf $(LIBGRPC_PATH)/libgrpc.so.6 $(BUILD_DIR)/libgrpc.so.6
ln -sf $(LIBGRPC_PATH)/libgrpc++.so.1 $(BUILD_DIR)/libgrpc++.so.1
+ ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6
src/%.o: src/%.cc
$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I./common -c $< -o $@
diff --git a/agent/common/core.h b/agent/common/core.h
index 22ef8a9..3ded10e 100644
--- a/agent/common/core.h
+++ b/agent/common/core.h
@@ -45,7 +45,7 @@
Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, uint32_t gemport_id, const std::string pkt);
Status ProbeDeviceCapabilities_();
Status ProbePonIfTechnology_();
-Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt);
+Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt, uint16_t flow_id);
Status FlowAdd_(int32_t access_intf_id, int32_t onu_id, int32_t uni_id, uint32_t port_no,
uint32_t flow_id, const std::string flow_type,
int32_t alloc_id, int32_t network_intf_id,
@@ -60,6 +60,8 @@
Status CreateTrafficQueues_(const tech_profile::TrafficQueues *traffic_queues);
Status RemoveTrafficQueues_(const tech_profile::TrafficQueues *traffic_queues);
uint32_t GetPortNum_(uint32_t flow_id);
+int get_status_bcm_cli_quit(void);
+uint16_t get_dev_id(void);
void stats_collection();
#endif
diff --git a/agent/common/server.cc b/agent/common/server.cc
index f87b85e..a77f006 100644
--- a/agent/common/server.cc
+++ b/agent/common/server.cc
@@ -121,7 +121,8 @@
openolt::Empty* response) override {
return UplinkPacketOut_(
request->intf_id(),
- request->pkt());
+ request->pkt(),
+ request->flow_id());
}
Status FlowAdd(
@@ -243,7 +244,7 @@
const openolt::Empty* request,
openolt::Empty* response) override {
- system("shutdown -r now");
+ uint8_t ret = system("shutdown -r now");
return Status::OK;
diff --git a/agent/download/Makefile.onl b/agent/download/Makefile.onl
index a025194..20bff23 100644
--- a/agent/download/Makefile.onl
+++ b/agent/download/Makefile.onl
@@ -12,5 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+COMMIT_ID = dc0e007
+
asfvolt16-4.14:
- cd OpenNetworkLinux && docker/tools/onlbuilder --non-interactive -8 -c ./build-asfvolt16.sh
+ cd OpenNetworkLinux && git checkout -b $@ $(COMMIT_ID) && docker/tools/onlbuilder --non-interactive -8 -c ./build-asfvolt16.sh
diff --git a/agent/sim/core.h b/agent/sim/core.h
index 5d95997..f656b1f 100644
--- a/agent/sim/core.h
+++ b/agent/sim/core.h
@@ -38,7 +38,7 @@
Status DisableUplinkIf_(uint32_t intf_id);
Status OmciMsgOut_(uint32_t intf_id, uint32_t onu_id, const std::string pkt);
Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, const std::string pkt);
-Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt);
+Status UplinkPacketOut_(bcmolt_flow_id flow_id, uint32_t intf_id, const std::string pkt);
Status FlowAdd_(int32_t access_intf_id, int32_t onu_id, int32_t uni_id, uint32_t port_no,
uint32_t flow_id, const std::string flow_type,
int32_t alloc_id, int32_t network_intf_id,
diff --git a/agent/src/core.cc b/agent/src/core.cc
index cf44cd4..4175a7f 100644
--- a/agent/src/core.cc
+++ b/agent/src/core.cc
@@ -25,6 +25,7 @@
#include <chrono>
#include <thread>
#include <bitset>
+#include <inttypes.h>
#include "device.h"
#include "core.h"
@@ -36,21 +37,21 @@
extern "C"
{
-#include <bcmos_system.h>
-#include <bal_api.h>
-#include <bal_api_end.h>
+#include <bcmolt_api.h>
+#include <bcmolt_host_api.h>
+#include <bcmolt_api_model_supporting_enums.h>
+#include <bal_version.h>
+#include <bcmolt_api_conn_mgr.h>
+//CLI header files
+#include <bcmcli_session.h>
+#include <bcmcli.h>
+#include <bcm_api_cli.h>
+#include <bcmos_common.h>
+#include <bcm_config.h>
// FIXME : dependency problem
// #include <bcm_common_gpon.h>
// #include <bcm_dev_log_task.h>
}
-// These need patched into bal_model_types.h directly. But, with above extern "C", it cannot be done
-inline bcmbal_action_cmd_id& operator|=(bcmbal_action_cmd_id& a, bcmbal_action_cmd_id b) {return a = static_cast<bcmbal_action_cmd_id>(static_cast<int>(a) | static_cast<int>(b));}
-inline bcmbal_action_id& operator|=(bcmbal_action_id& a, bcmbal_action_id b) {return a = static_cast<bcmbal_action_id>(static_cast<int>(a) | static_cast<int>(b));}
-inline bcmbal_classifier_id& operator|=(bcmbal_classifier_id& a, bcmbal_classifier_id b) {return a = static_cast<bcmbal_classifier_id>(static_cast<int>(a) | static_cast<int>(b));}
-inline bcmbal_tm_sched_owner_agg_port_id& operator|=(bcmbal_tm_sched_owner_agg_port_id& a, bcmbal_tm_sched_owner_agg_port_id b) {return a = static_cast<bcmbal_tm_sched_owner_agg_port_id>(static_cast<int>(a) | static_cast<int>(b));}
-inline bcmbal_tm_sched_parent_id& operator|=(bcmbal_tm_sched_parent_id& a, bcmbal_tm_sched_parent_id b) {return a = static_cast<bcmbal_tm_sched_parent_id>(static_cast<int>(a) | static_cast<int>(b));}
-inline bcmbal_tm_shaping_id& operator|=(bcmbal_tm_shaping_id& a, bcmbal_tm_shaping_id b) {return a = static_cast<bcmbal_tm_shaping_id>(static_cast<int>(a) | static_cast<int>(b));}
-
dev_log_id openolt_log_id = bcm_dev_log_id_register("OPENOLT", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
dev_log_id omci_log_id = bcm_dev_log_id_register("OMCI", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
@@ -66,6 +67,7 @@
static const std::string UNKNOWN_TECH("unknown");
static const std::string MIXED_TECH("mixed");
static std::string board_technology(UNKNOWN_TECH);
+static std::string chip_family(UNKNOWN_TECH);
static unsigned int OPENOLT_FIELD_LEN = 200;
static std::string firmware_version = "Openolt.2018.10.04";
@@ -77,6 +79,13 @@
const uint32_t us_fixed_queue_id_list[8] = {4, 5, 6, 7, 8, 9, 10, 11};
const std::string upstream = "upstream";
const std::string downstream = "downstream";
+bcmolt_oltid dev_id = 0;
+/* Current session */
+static bcmcli_session *current_session;
+static bcmcli_entry *api_parent_dir;
+bcmos_bool status_bcm_cli_quit = BCMOS_FALSE;
+bcmos_task bal_cli_thread;
+const char *bal_cli_thread_name = "bal_cli_thread";
State state;
@@ -116,6 +125,10 @@
uint32_t priority, uint32_t gemport_id);
static bcmos_errno RemoveQueue(std::string direction, int intf_id, int onu_id, int uni_id, uint32_t port_no, int alloc_id);
+uint16_t get_dev_id(void) {
+ return dev_id;
+}
+
/**
* Returns the default NNI (Upstream direction) or PON (Downstream direction) scheduler
* Every NNI port and PON port have default scheduler.
@@ -316,7 +329,10 @@
/*Read the field value*/
if (fp) {
- fread(field_val, OPENOLT_FIELD_LEN, 1, fp);
+ uint8_t ret;
+ ret = fread(field_val, OPENOLT_FIELD_LEN, 1, fp);
+ if (ret >= OPENOLT_FIELD_LEN)
+ BCM_LOG(INFO, openolt_log_id, "Read data length %u\n", ret);
pclose(fp);
}
return field_val;
@@ -338,7 +354,7 @@
// Legacy, device-wide ranges. To be deprecated when adapter
// is upgraded to support per-interface ranges
- if (board_technology == "xgspon") {
+ if (board_technology == "XGPON") {
device_info->set_onu_id_start(1);
device_info->set_onu_id_end(255);
device_info->set_alloc_id_start(MIN_ALLOC_ID_XGSPON);
@@ -348,7 +364,7 @@
device_info->set_flow_id_start(1);
device_info->set_flow_id_end(16383);
}
- else if (board_technology == "gpon") {
+ else if (board_technology == "GPON") {
device_info->set_onu_id_start(1);
device_info->set_onu_id_end(127);
device_info->set_alloc_id_start(MIN_ALLOC_ID_GPON);
@@ -439,39 +455,173 @@
return Status::OK;
}
+#define CLI_HOST_PROMPT_FORMAT "BCM.%u> "
+
+/* Build CLI prompt */
+static void openolt_cli_get_prompt_cb(bcmcli_session *session, char *buf, uint32_t max_len)
+{
+ snprintf(buf, max_len, CLI_HOST_PROMPT_FORMAT, dev_id);
+}
+
+static int _bal_apiend_cli_thread_handler(long data)
+{
+ char init_string[]="\n";
+ bcmcli_session *sess = current_session;
+ bcmos_task_parm bal_cli_task_p_dummy;
+
+ /* Switch to interactive mode if not stopped in the init script */
+ if (!bcmcli_is_stopped(sess))
+ {
+ /* Force a CLI command prompt
+ * The string passed into the parse function
+ * must be modifiable, so a string constant like
+ * bcmcli_parse(current_session, "\n") will not
+ * work.
+ */
+ bcmcli_parse(sess, init_string);
+
+ /* Process user input until EOF or quit command */
+ bcmcli_driver(sess);
+ };
+ BCM_LOG(INFO, openolt_log_id, "BAL API End CLI terminated\n");
+
+ /* Cleanup */
+ bcmcli_session_close(current_session);
+ bcmcli_token_destroy(NULL);
+ return 0;
+}
+
+/* Init API CLI commands for the current device */
+bcmos_errno bcm_openolt_api_cli_init(bcmcli_entry *parent_dir, bcmcli_session *session)
+{
+ bcmos_errno rc;
+
+ api_parent_dir = parent_dir;
+
+ rc = bcm_api_cli_set_commands(session);
+
+#ifdef BCM_SUBSYSTEM_HOST
+ /* Subscribe for device change indication */
+ rc = rc ? rc : bcmolt_olt_sel_ind_register(_api_cli_olt_change_ind);
+#endif
+
+ return rc;
+}
+
+static bcmos_errno bcm_cli_quit(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmcli_stop(session);
+ bcmcli_session_print(session, "CLI terminated by 'Quit' command\n");
+ status_bcm_cli_quit = BCMOS_TRUE;
+
+ return BCM_ERR_OK;
+}
+
+int get_status_bcm_cli_quit(void) {
+ return status_bcm_cli_quit;
+}
+
+bcmos_errno bcmolt_apiend_cli_init() {
+ bcmos_errno ret;
+ bcmos_task_parm bal_cli_task_p = {};
+ bcmos_task_parm bal_cli_task_p_dummy;
+
+ /** before creating the task, check if it is already created by the other half of BAL i.e. Core side */
+ if (BCM_ERR_OK != bcmos_task_query(&bal_cli_thread, &bal_cli_task_p_dummy))
+ {
+ /* Create BAL CLI thread */
+ bal_cli_task_p.name = bal_cli_thread_name;
+ bal_cli_task_p.handler = _bal_apiend_cli_thread_handler;
+ bal_cli_task_p.priority = TASK_PRIORITY_CLI;
+
+ ret = bcmos_task_create(&bal_cli_thread, &bal_cli_task_p);
+ if (BCM_ERR_OK != ret)
+ {
+ bcmos_printf("Couldn't create BAL API end CLI thread\n");
+ return ret;
+ }
+ }
+}
+
Status Enable_(int argc, char *argv[]) {
- bcmbal_access_terminal_cfg acc_term_obj;
- bcmbal_access_terminal_key key = { };
+ bcmos_errno err;
+ bcmolt_host_init_parms init_parms = {};
+ init_parms.transport.type = BCM_HOST_API_CONN_LOCAL;
+ bcmcli_session_parm mon_session_parm;
if (!state.is_activated()) {
vendor_init();
- bcmbal_init(argc, argv, NULL);
- bcmos_fastlock_init(&data_lock, 0);
+ /* Initialize host subsystem */
+ err = bcmolt_host_init(&init_parms);
+ if (BCM_ERR_OK != err) {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to init OLT\n");
+ return bcm_to_grpc_err(err, "Failed to init OLT");
+ }
+ /* Create CLI session */
+ memset(&mon_session_parm, 0, sizeof(mon_session_parm));
+ mon_session_parm.get_prompt = openolt_cli_get_prompt_cb;
+ mon_session_parm.access_right = BCMCLI_ACCESS_ADMIN;
+ bcmos_errno rc = bcmcli_session_open(&mon_session_parm, ¤t_session);
+ BUG_ON(rc != BCM_ERR_OK);
+
+ /* API CLI */
+ bcm_openolt_api_cli_init(NULL, current_session);
+
+ /* Add quit command */
+ BCMCLI_MAKE_CMD_NOPARM(NULL, "quit", "Quit", bcm_cli_quit);
+
+ err = bcmolt_apiend_cli_init();
+ if (BCM_ERR_OK != err) {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to add apiend init\n");
+ return bcm_to_grpc_err(err, "Failed to add apiend init");
+ }
+
+ bcmos_fastlock_init(&data_lock, 0);
BCM_LOG(INFO, openolt_log_id, "Enable OLT - %s-%s\n", VENDOR_ID, MODEL_ID);
- Status status = SubscribeIndication();
- if (!status.ok()) {
- BCM_LOG(ERROR, openolt_log_id, "SubscribeIndication failed - %s : %s\n",
- grpc_status_code_to_string(status.error_code()).c_str(),
- status.error_message().c_str());
+ if (bcmolt_api_conn_mgr_is_connected(dev_id))
+ {
+ Status status = SubscribeIndication();
+ if (!status.ok()) {
+ BCM_LOG(ERROR, openolt_log_id, "SubscribeIndication failed - %s : %s\n",
+ grpc_status_code_to_string(status.error_code()).c_str(),
+ status.error_message().c_str());
- return status;
+ return status;
+ }
+ bcmos_errno err;
+ bcmolt_odid dev;
+ for (dev = 0; dev < BCM_MAX_DEVS_PER_LINE_CARD; dev++) {
+ bcmolt_device_cfg dev_cfg = { };
+ bcmolt_device_key dev_key = { };
+ dev_key.device_id = dev;
+ BCMOLT_CFG_INIT(&dev_cfg, device, dev_key);
+ BCMOLT_MSG_FIELD_GET(&dev_cfg, system_mode);
+ err = bcmolt_cfg_get(dev_id, &dev_cfg.hdr);
+ if (err == BCM_ERR_NOT_CONNECTED) {
+ bcmolt_device_key key = {.device_id = dev};
+ bcmolt_device_connect oper;
+ bcmolt_device_cfg cfg;
+ BCM_LOG(INFO, openolt_log_id, "Enable Maple - %d/%d\n", dev, BCM_MAX_DEVS_PER_LINE_CARD);
+ BCMOLT_OPER_INIT(&oper, device, connect, key);
+ BCMOLT_MSG_FIELD_SET(&oper, inni_config.mode, BCMOLT_INNI_MODE_ALL_10_G_XFI);
+ BCMOLT_MSG_FIELD_SET (&oper, system_mode, BCMOLT_SYSTEM_MODE_XGPON__2_X);
+ err = bcmolt_oper_submit(dev_id, &oper.hdr);
+ if (err)
+ BCM_LOG(ERROR, openolt_log_id, "Enable Maple deivce %d failed\n", dev);
+ bcmos_usleep(200000);
+ }
+ else
+ BCM_LOG(ERROR, openolt_log_id, "Maple deivce %d already connected\n", dev);
+ }
+ init_stats();
}
-
- key.access_term_id = DEFAULT_ATERM_ID;
- BCMBAL_CFG_INIT(&acc_term_obj, access_terminal, key);
- BCMBAL_CFG_PROP_SET(&acc_term_obj, access_terminal, admin_state, BCMBAL_STATE_UP);
- bcmos_errno err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(acc_term_obj.hdr));
- if (err) {
- BCM_LOG(ERROR, openolt_log_id, "Failed to enable OLT\n");
- return bcm_to_grpc_err(err, "Failed to enable OLT");
- }
-
- init_stats();
}
+ /* Start CLI */
+ BCM_LOG(INFO, def_log_id, "Starting CLI\n");
//If already enabled, generate an extra indication ????
return Status::OK;
}
@@ -524,26 +674,38 @@
return status;
}
+bcmos_errno get_pon_interface_status(bcmolt_interface pon_ni, bcmolt_interface_state *state) {
+ bcmos_errno err;
+ bcmolt_pon_interface_key pon_key;
+ bcmolt_pon_interface_cfg pon_cfg;
+ pon_key.pon_ni = pon_ni;
+
+ BCMOLT_CFG_INIT(&pon_cfg, pon_interface, pon_key);
+ BCMOLT_FIELD_SET_PRESENT(&pon_cfg.data, pon_interface_cfg_data, state);
+ BCMOLT_FIELD_SET_PRESENT(&pon_cfg.data, pon_interface_cfg_data, itu);
+ err = bcmolt_cfg_get(dev_id, &pon_cfg.hdr);
+ *state = pon_cfg.data.state;
+ return err;
+}
+
Status EnablePonIf_(uint32_t intf_id) {
- bcmbal_interface_cfg interface_obj;
- bcmbal_interface_key interface_key;
+ bcmos_errno err = BCM_ERR_OK;
+ bcmolt_pon_interface_key intf_key = {.pon_ni = (bcmolt_interface)intf_id};
+ bcmolt_pon_interface_set_pon_interface_state pon_interface_set_state;
+ bcmolt_interface_state state;
- interface_key.intf_id = intf_id;
- interface_key.intf_type = BCMBAL_INTF_TYPE_PON;
-
- BCMBAL_CFG_INIT(&interface_obj, interface, interface_key);
-
- BCMBAL_CFG_PROP_GET(&interface_obj, interface, admin_state);
- bcmos_errno err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &(interface_obj.hdr));
- if (err == BCM_ERR_OK && interface_obj.data.admin_state == BCMBAL_STATE_UP) {
- BCM_LOG(DEBUG, openolt_log_id, "PON interface: %d already enabled\n", intf_id);
- return Status::OK;
- }
-
- BCMBAL_CFG_PROP_SET(&interface_obj, interface, admin_state, BCMBAL_STATE_UP);
-
- err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(interface_obj.hdr));
- if (err) {
+ err = get_pon_interface_status((bcmolt_interface)intf_id, &state);
+ if (err == BCM_ERR_OK) {
+ if (state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) {
+ BCM_LOG(INFO, openolt_log_id, "PON interface: %d already enabled\n", intf_id);
+ return Status::OK;
+ }
+ }
+ BCMOLT_OPER_INIT(&pon_interface_set_state, pon_interface, set_pon_interface_state, intf_key);
+ BCMOLT_FIELD_SET(&pon_interface_set_state.data, pon_interface_set_pon_interface_state_data,
+ operation, BCMOLT_INTERFACE_OPERATION_ACTIVE_WORKING);
+ err = bcmolt_oper_submit(dev_id, &pon_interface_set_state.hdr);
+ if (err != BCM_ERR_OK) {
BCM_LOG(ERROR, openolt_log_id, "Failed to enable PON interface: %d\n", intf_id);
return bcm_to_grpc_err(err, "Failed to enable PON interface");
}
@@ -552,73 +714,94 @@
}
Status DisableUplinkIf_(uint32_t intf_id) {
- bcmbal_interface_cfg interface_obj;
- bcmbal_interface_key interface_key;
+ bcmolt_pon_interface_key intf_key = {.pon_ni = (uint8_t)intf_id};
+ bcmolt_pon_interface_set_pon_interface_state pon_interface_set_state;
- interface_key.intf_id = intf_id;
- interface_key.intf_type = BCMBAL_INTF_TYPE_NNI;
+ BCMOLT_OPER_INIT(&pon_interface_set_state, pon_interface, set_pon_interface_state, intf_key);
+ BCMOLT_MSG_FIELD_SET(&pon_interface_set_state, operation, BCMOLT_INTERFACE_OPERATION_ACTIVE_WORKING );
- BCMBAL_CFG_INIT(&interface_obj, interface, interface_key);
- BCMBAL_CFG_PROP_SET(&interface_obj, interface, admin_state, BCMBAL_STATE_DOWN);
-
- bcmos_errno err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(interface_obj.hdr));
- if (err) {
- BCM_LOG(ERROR, openolt_log_id, "Failed to disable Uplink interface: %d\n", intf_id);
- return bcm_to_grpc_err(err, "Failed to disable Uplink interface");
+ bcmos_errno err = bcmolt_oper_submit(dev_id, &pon_interface_set_state.hdr);
+ if (err == BCM_ERR_OK) {
+ /* Wait for the interface activation to successfully complete */
+ BCM_LOG(DEBUG, openolt_log_id, "PON interface: %d already enabled\n", intf_id);
+ return Status::OK;
+ } else {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to enable PON interface: %d\n", intf_id);
+ return bcm_to_grpc_err(err, "Failed to enable PON interface");
}
return Status::OK;
}
Status ProbeDeviceCapabilities_() {
- bcmbal_access_terminal_cfg acc_term_obj;
- bcmbal_access_terminal_key key = { };
+ bcmos_errno err;
+ bcmolt_device_cfg dev_cfg = { };
+ bcmolt_device_key dev_key = { };
+ bcmolt_olt_cfg olt_cfg = { };
+ bcmolt_olt_key olt_key = { };
- key.access_term_id = DEFAULT_ATERM_ID;
- BCMBAL_CFG_INIT(&acc_term_obj, access_terminal, key);
- BCMBAL_CFG_PROP_GET(&acc_term_obj, access_terminal, admin_state);
- BCMBAL_CFG_PROP_GET(&acc_term_obj, access_terminal, oper_status);
- BCMBAL_CFG_PROP_GET(&acc_term_obj, access_terminal, topology);
- BCMBAL_CFG_PROP_GET(&acc_term_obj, access_terminal, sw_version);
- BCMBAL_CFG_PROP_GET(&acc_term_obj, access_terminal, conn_id);
- bcmos_errno err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &(acc_term_obj.hdr));
- if (err) {
- BCM_LOG(ERROR, openolt_log_id, "Failed to query OLT\n");
- return bcm_to_grpc_err(err, "Failed to query OLT");
+ dev_key.device_id = dev_id;
+ BCMOLT_CFG_INIT(&dev_cfg, device, dev_key);
+ BCMOLT_MSG_FIELD_GET(&dev_cfg, firmware_sw_version);
+ BCMOLT_MSG_FIELD_GET(&dev_cfg, chip_family);
+ BCMOLT_MSG_FIELD_GET(&dev_cfg, system_mode);
+ err = bcmolt_cfg_get(dev_id, &dev_cfg.hdr);
+ if (err) {
+ BCM_LOG(ERROR, openolt_log_id, "device: Failed to query OLT\n");
+ return bcm_to_grpc_err(err, "device: Failed to query OLT");
}
- BCM_LOG(INFO, openolt_log_id, "OLT capabilitites, admin_state: %s oper_state: %s\n",
- acc_term_obj.data.admin_state == BCMBAL_STATE_UP ? "up" : "down",
- acc_term_obj.data.oper_status == BCMBAL_STATUS_UP ? "up" : "down");
+ bcmolt_topology_map topo_map[BCM_MAX_PONS_PER_OLT] = { };
+ bcmolt_topology topo = { };
+ topo.topology_maps.len = BCM_MAX_PONS_PER_OLT;
+ topo.topology_maps.arr = &topo_map[0];
+ BCMOLT_CFG_INIT(&olt_cfg, olt, olt_key);
+ BCMOLT_MSG_FIELD_GET(&olt_cfg, bal_state);
+ BCMOLT_FIELD_SET_PRESENT(&olt_cfg.data, olt_cfg_data, topology);
+ BCMOLT_CFG_LIST_BUF_SET(&olt_cfg, olt, topo.topology_maps.arr,
+ sizeof(bcmolt_topology_map) * topo.topology_maps.len);
+ err = bcmolt_cfg_get(dev_id, &olt_cfg.hdr);
+ if (err) {
+ BCM_LOG(ERROR, openolt_log_id, "cfg: Failed to query OLT\n");
+ return bcm_to_grpc_err(err, "cfg: Failed to query OLT");
+ }
std::string bal_version;
- bal_version += std::to_string(acc_term_obj.data.sw_version.major_rev)
- + "." + std::to_string(acc_term_obj.data.sw_version.minor_rev)
- + "." + std::to_string(acc_term_obj.data.sw_version.release_rev);
+ bal_version += std::to_string(dev_cfg.data.firmware_sw_version.major)
+ + "." + std::to_string(dev_cfg.data.firmware_sw_version.minor)
+ + "." + std::to_string(dev_cfg.data.firmware_sw_version.revision);
firmware_version = "BAL." + bal_version + "__" + firmware_version;
- BCM_LOG(INFO, openolt_log_id, "--------------- version %s object model: %d\n", bal_version.c_str(),
- acc_term_obj.data.sw_version.om_version);
-
- BCM_LOG(INFO, openolt_log_id, "--------------- topology nni:%d pon:%d dev:%d ppd:%d family: %d:%d\n",
- acc_term_obj.data.topology.num_of_nni_ports,
- acc_term_obj.data.topology.num_of_pon_ports,
- acc_term_obj.data.topology.num_of_mac_devs,
- acc_term_obj.data.topology.num_of_pons_per_mac_dev,
- acc_term_obj.data.topology.pon_family,
- acc_term_obj.data.topology.pon_sub_family
- );
-
- switch(acc_term_obj.data.topology.pon_sub_family)
- {
- case BCMBAL_PON_SUB_FAMILY_GPON: board_technology = "gpon"; break;
- case BCMBAL_PON_SUB_FAMILY_XGS: board_technology = "xgspon"; break;
+ switch(dev_cfg.data.system_mode) {
+ case 9 ... 12: board_technology = "GPON"; break;
+ case 13 ... 16: board_technology = "XGPON"; break;
+ case 18 ... 20: board_technology = "XGS-PON"; break;
}
- num_of_nni_ports = acc_term_obj.data.topology.num_of_nni_ports;
- num_of_pon_ports = acc_term_obj.data.topology.num_of_pon_ports;
+ switch(dev_cfg.data.chip_family) {
+ case BCMOLT_CHIP_FAMILY_CHIP_FAMILY_6862_X_: chip_family = "Maple"; break;
+ case BCMOLT_CHIP_FAMILY_CHIP_FAMILY_6865_X_: chip_family = "Aspen"; break;
+ }
- BCM_LOG(INFO, openolt_log_id, "PON num_intfs: %d global board_technology: %s\n", num_of_pon_ports, board_technology.c_str());
+ num_of_nni_ports = olt_cfg.data.topology.num_switch_ports;
+ num_of_pon_ports = olt_cfg.data.topology.topology_maps.len;
+
+ BCM_LOG(INFO, openolt_log_id, "OLT capabilitites, oper_state: %s\n",
+ olt_cfg.data.bal_state == BCMOLT_BAL_STATE_BAL_AND_SWITCH_READY
+ ? "up" : "down");
+
+ BCM_LOG(INFO, openolt_log_id, "--------------- version %s object model: %d\n",
+ bal_version.c_str(), BAL_API_VERSION);
+
+ BCM_LOG(INFO, openolt_log_id, "--------------- topology nni:%d pon:%d dev:%d ppd:%d family: %s\n",
+ num_of_nni_ports,
+ num_of_pon_ports,
+ BCM_MAX_DEVS_PER_LINE_CARD,
+ BCM_MAX_PONS_PER_DEV,
+ chip_family.c_str());
+
+ BCM_LOG(INFO, openolt_log_id, "PON num_intfs: %d global board_technology: %s\n",
+ num_of_pon_ports, board_technology.c_str());
return Status::OK;
}
@@ -628,36 +811,43 @@
// which are active in the current BAL topology. And for those
// that are active, determine each port's access technology, i.e. "gpon" or "xgspon".
for (uint32_t intf_id = 0; intf_id < num_of_pon_ports; ++intf_id) {
- bcmbal_interface_cfg interface_obj;
- bcmbal_interface_key interface_key;
+ bcmolt_pon_interface_cfg interface_obj;
+ bcmolt_pon_interface_key interface_key;
- interface_key.intf_id = intf_id;
- interface_key.intf_type = BCMBAL_INTF_TYPE_PON;
+ interface_key.pon_ni = intf_id;
+ BCMOLT_CFG_INIT(&interface_obj, pon_interface, interface_key);
+ BCMOLT_MSG_FIELD_GET(&interface_obj, gpon_trx);
+ BCMOLT_MSG_FIELD_GET(&interface_obj, xgpon_trx);
- BCMBAL_CFG_INIT(&interface_obj, interface, interface_key);
- BCMBAL_CFG_PROP_GET(&interface_obj, interface, admin_state);
- BCMBAL_CFG_PROP_GET(&interface_obj, interface, transceiver_type);
-
- bcmos_errno err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &(interface_obj.hdr));
+ bcmos_errno err = bcmolt_cfg_get(dev_id, &interface_obj.hdr);
if (err != BCM_ERR_OK) {
intf_technologies[intf_id] = UNKNOWN_TECH;
if(err != BCM_ERR_RANGE) BCM_LOG(ERROR, openolt_log_id, "Failed to get PON config: %d\n", intf_id);
}
else {
- switch(interface_obj.data.transceiver_type) {
- case BCMBAL_TRX_TYPE_GPON_SPS_43_48:
- case BCMBAL_TRX_TYPE_GPON_SPS_SOG_4321:
- case BCMBAL_TRX_TYPE_GPON_LTE_3680_M:
- case BCMBAL_TRX_TYPE_GPON_SOURCE_PHOTONICS:
- case BCMBAL_TRX_TYPE_GPON_LTE_3680_P:
- intf_technologies[intf_id] = "gpon";
- break;
- default:
- intf_technologies[intf_id] = "xgspon";
- break;
+ if (board_technology == "XGPON") {
+ switch(interface_obj.data.xgpon_trx.transceiver_type) {
+ case BCMOLT_XGPON_TRX_TYPE_LTH_7222_PC:
+ case BCMOLT_XGPON_TRX_TYPE_WTD_RTXM266_702:
+ case BCMOLT_XGPON_TRX_TYPE_LTH_7222_BC_PLUS:
+ case BCMOLT_XGPON_TRX_TYPE_LTH_7226_PC:
+ case BCMOLT_XGPON_TRX_TYPE_LTH_5302_PC:
+ case BCMOLT_XGPON_TRX_TYPE_LTH_7226_A_PC_PLUS:
+ case BCMOLT_XGPON_TRX_TYPE_D272RR_SSCB_DM:
+ intf_technologies[intf_id] = "XGPON";
+ break;
+ }
+ } else if (board_technology == "GPON") {
+ switch(interface_obj.data.gpon_trx.transceiver_type) {
+ case BCMOLT_TRX_TYPE_SPS_43_48_H_HP_CDE_SD_2013:
+ case BCMOLT_TRX_TYPE_LTE_3680_M:
+ case BCMOLT_TRX_TYPE_SOURCE_PHOTONICS:
+ case BCMOLT_TRX_TYPE_LTE_3680_P_TYPE_C_PLUS:
+ case BCMOLT_TRX_TYPE_LTE_3680_P_BC:
+ intf_technologies[intf_id] = "GPON";
+ break;
+ }
}
- BCM_LOG(INFO, openolt_log_id, "PON intf_id: %d intf_technologies: %d:%s\n", intf_id,
- interface_obj.data.transceiver_type, intf_technologies[intf_id].c_str());
if (board_technology != UNKNOWN_TECH) {
board_technology = intf_technologies[intf_id];
@@ -674,44 +864,53 @@
unsigned NumNniIf_() {return num_of_nni_ports;}
unsigned NumPonIf_() {return num_of_pon_ports;}
+bcmos_errno get_nni_interface_status(bcmolt_interface id, bcmolt_interface_state *state) {
+ bcmos_errno err;
+ bcmolt_nni_interface_key nni_key;
+ bcmolt_nni_interface_cfg nni_cfg;
+ nni_key.id = id;
+
+ BCMOLT_CFG_INIT(&nni_cfg, nni_interface, nni_key);
+ BCMOLT_FIELD_SET_PRESENT(&nni_cfg.data, nni_interface_cfg_data, state);
+ err = bcmolt_cfg_get(dev_id, &nni_cfg.hdr);
+ *state = nni_cfg.data.state;
+ return err;
+}
+
Status EnableUplinkIf_(uint32_t intf_id) {
- bcmbal_interface_cfg interface_obj;
- bcmbal_interface_key interface_key;
+ bcmos_errno err = BCM_ERR_OK;
+ bcmolt_nni_interface_key intf_key = {.id = (bcmolt_interface)intf_id};
+ bcmolt_nni_interface_set_nni_state nni_interface_set_state;
+ bcmolt_interface_state state;
- interface_key.intf_id = intf_id;
- interface_key.intf_type = BCMBAL_INTF_TYPE_NNI;
-
- BCMBAL_CFG_INIT(&interface_obj, interface, interface_key);
-
- BCMBAL_CFG_PROP_GET(&interface_obj, interface, admin_state);
- bcmos_errno err = bcmbal_cfg_get(DEFAULT_ATERM_ID, &(interface_obj.hdr));
- if (err == BCM_ERR_OK && interface_obj.data.admin_state == BCMBAL_STATE_UP) {
- BCM_LOG(DEBUG, openolt_log_id, "Uplink interface: %d already enabled\n", intf_id);
- return Status::OK;
+ err = get_nni_interface_status((bcmolt_interface)intf_id, &state);
+ if (err == BCM_ERR_OK) {
+ if (state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) {
+ BCM_LOG(INFO, openolt_log_id, "NNI interface: %d already enabled\n", intf_id);
+ return Status::OK;
+ }
}
- BCMBAL_CFG_PROP_SET(&interface_obj, interface, admin_state, BCMBAL_STATE_UP);
-
- err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(interface_obj.hdr));
- if (err) {
- BCM_LOG(ERROR, openolt_log_id, "Failed to enable Uplink interface: %d\n", intf_id);
- return bcm_to_grpc_err(err, "Failed to enable Uplink interface");
+ BCMOLT_OPER_INIT(&nni_interface_set_state, nni_interface, set_nni_state, intf_key);
+ BCMOLT_FIELD_SET(&nni_interface_set_state.data, nni_interface_set_nni_state_data,
+ nni_state, BCMOLT_INTERFACE_OPERATION_ACTIVE_WORKING);
+ err = bcmolt_oper_submit(dev_id, &nni_interface_set_state.hdr);
+ if (err != BCM_ERR_OK) {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to enable NNI interface: %d, err %d\n", intf_id, err);
+ return bcm_to_grpc_err(err, "Failed to enable NNI interface");
}
return Status::OK;
}
Status DisablePonIf_(uint32_t intf_id) {
- bcmbal_interface_cfg interface_obj;
- bcmbal_interface_key interface_key;
+ bcmolt_pon_interface_cfg interface_obj;
+ bcmolt_pon_interface_key interface_key;
- interface_key.intf_id = intf_id;
- interface_key.intf_type = BCMBAL_INTF_TYPE_PON;
-
- BCMBAL_CFG_INIT(&interface_obj, interface, interface_key);
- BCMBAL_CFG_PROP_SET(&interface_obj, interface, admin_state, BCMBAL_STATE_DOWN);
-
- bcmos_errno err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(interface_obj.hdr));
+ interface_key.pon_ni = intf_id;
+ BCMOLT_CFG_INIT(&interface_obj, pon_interface, interface_key);
+ BCMOLT_MSG_FIELD_GET(&interface_obj, state);
+ bcmos_errno err = bcmolt_cfg_get(dev_id, &interface_obj.hdr);
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Failed to disable PON interface: %d\n", intf_id);
return bcm_to_grpc_err(err, "Failed to disable PON interface");
@@ -723,57 +922,52 @@
Status ActivateOnu_(uint32_t intf_id, uint32_t onu_id,
const char *vendor_id, const char *vendor_specific, uint32_t pir) {
- bcmbal_subscriber_terminal_cfg sub_term_obj = {};
- bcmbal_subscriber_terminal_key subs_terminal_key;
- bcmbal_serial_number serial_num = {};
- bcmbal_registration_id registration_id = {};
+ bcmolt_onu_cfg cfg_obj;
+ bcmolt_onu_key key;
+ bcmolt_serial_number serial_number; /**< ONU serial number */
+ bcmolt_bin_str_36 registration_id; /**< ONU registration ID */
BCM_LOG(INFO, openolt_log_id, "Enabling ONU %d on PON %d : vendor id %s, vendor specific %s, pir %d\n",
onu_id, intf_id, vendor_id, vendor_specific_to_str(vendor_specific).c_str(), pir);
- subs_terminal_key.sub_term_id = onu_id;
- subs_terminal_key.intf_id = intf_id;
- BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, subs_terminal_key);
+ key.onu_id = onu_id;
+ key.pon_ni = intf_id;
+ BCMOLT_CFG_INIT(&cfg_obj, onu, key);
+ memcpy(serial_number.vendor_id.arr, vendor_id, 4);
+ memcpy(serial_number.vendor_specific.arr, vendor_specific, 4);
+ BCMOLT_MSG_FIELD_SET(&cfg_obj, itu.serial_number, serial_number);
+ BCMOLT_MSG_FIELD_SET(&cfg_obj, itu.auto_learning, BCMOS_TRUE);
+ /*set burst and data profiles to fec disabled*/
+ BCMOLT_MSG_FIELD_SET(&cfg_obj, itu.xgpon.ranging_burst_profile, 0);
+ BCMOLT_MSG_FIELD_SET(&cfg_obj, itu.xgpon.data_burst_profile, 1);
- memcpy(serial_num.vendor_id, vendor_id, 4);
- memcpy(serial_num.vendor_specific, vendor_specific, 4);
- BCMBAL_CFG_PROP_SET(&sub_term_obj, subscriber_terminal, serial_number, serial_num);
-
-#if 0
- // Commenting out as this is causing issues with onu activation
- // with BAL 2.6 (Broadcom CS5248819).
-
- // FIXME - Use a default (all zeros) registration id.
- memset(registration_id.arr, 0, sizeof(registration_id.arr));
- BCMBAL_CFG_PROP_SET(&sub_term_obj, subscriber_terminal, registration_id, registration_id);
-#endif
-
- BCMBAL_CFG_PROP_SET(&sub_term_obj, subscriber_terminal, admin_state, BCMBAL_STATE_UP);
-
- bcmos_errno err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(sub_term_obj.hdr));
+ bcmos_errno err = bcmolt_cfg_set(dev_id, &cfg_obj.hdr);
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Failed to enable ONU %d on PON %d\n", onu_id, intf_id);
return bcm_to_grpc_err(err, "Failed to enable ONU");
}
+
return Status::OK;
}
Status DeactivateOnu_(uint32_t intf_id, uint32_t onu_id,
const char *vendor_id, const char *vendor_specific) {
- bcmbal_subscriber_terminal_cfg sub_term_obj = {};
- bcmbal_subscriber_terminal_key subs_terminal_key;
+ bcmolt_onu_cfg cfg_obj;
+ bcmolt_onu_key key;
+ bcmolt_serial_number serial_number; /**< ONU serial number */
+ bcmolt_bin_str_36 registration_id; /**< ONU registration ID */
BCM_LOG(INFO, openolt_log_id, "Deactivating ONU %d on PON %d : vendor id %s, vendor specific %s\n",
onu_id, intf_id, vendor_id, vendor_specific_to_str(vendor_specific).c_str());
- subs_terminal_key.sub_term_id = onu_id;
- subs_terminal_key.intf_id = intf_id;
- BCMBAL_CFG_INIT(&sub_term_obj, subscriber_terminal, subs_terminal_key);
+ key.onu_id= onu_id;
+ key.pon_ni = intf_id;
+ BCMOLT_CFG_INIT(&cfg_obj, onu, key);
+ BCMOLT_MSG_FIELD_SET(&cfg_obj, onu_state, BCMOLT_ONU_STATE_INACTIVE);
- BCMBAL_CFG_PROP_SET(&sub_term_obj, subscriber_terminal, admin_state, BCMBAL_STATE_DOWN);
-
- if (bcmbal_cfg_set(DEFAULT_ATERM_ID, &(sub_term_obj.hdr))) {
+ bcmos_errno err = bcmolt_cfg_set(dev_id, &cfg_obj.hdr);
+ if (err) {
BCM_LOG(ERROR, openolt_log_id, "Failed to deactivate ONU %d on PON %d\n", onu_id, intf_id);
return Status(grpc::StatusCode::INTERNAL, "Failed to deactivate ONU");
}
@@ -797,26 +991,17 @@
// TODO: Delete the schedulers and queues.
- bcmos_errno err = BCM_ERR_OK;
- bcmbal_subscriber_terminal_cfg cfg;
- bcmbal_subscriber_terminal_key key = { };
+ bcmolt_onu_cfg cfg_obj;
+ bcmolt_onu_key key;
BCM_LOG(INFO, openolt_log_id, "Processing subscriber terminal cfg clear for sub_term_id %d and intf_id %d\n",
onu_id, intf_id);
- key.sub_term_id = onu_id ;
- key.intf_id = intf_id ;
+ key.onu_id = onu_id;
+ key.pon_ni = intf_id;
+ BCMOLT_CFG_INIT(&cfg_obj, onu, key);
- if (0 == key.sub_term_id)
- {
- BCM_LOG(INFO, openolt_log_id,"Invalid Key to handle subscriber terminal clear subscriber_terminal_id %d, \
- Interface ID %d\n", onu_id, intf_id);
- return Status(grpc::StatusCode::INTERNAL, "Failed to delete ONU");
- }
-
- BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);
-
- err = bcmbal_cfg_clear(DEFAULT_ATERM_ID, &cfg.hdr);
+ bcmos_errno err = bcmolt_cfg_clear(dev_id, &cfg_obj.hdr);
if (err != BCM_ERR_OK)
{
BCM_LOG(ERROR, openolt_log_id, "Failed to clear information for BAL subscriber_terminal_id %d, Interface ID %d\n",
@@ -824,21 +1009,22 @@
return Status(grpc::StatusCode::INTERNAL, "Failed to delete ONU");
}
- return Status::OK;;
+ return Status::OK;
}
#define MAX_CHAR_LENGTH 20
#define MAX_OMCI_MSG_LENGTH 44
Status OmciMsgOut_(uint32_t intf_id, uint32_t onu_id, const std::string pkt) {
- bcmbal_u8_list_u32_max_2048 buf; /* A structure with a msg pointer and length value */
- bcmos_errno err = BCM_ERR_OK;
+ bcmolt_bin_str buf = {};
+ bcmolt_onu_cpu_packets omci_cpu_packets;
+ bcmolt_onu_key key;
- /* The destination of the OMCI packet is a registered ONU on the OLT PON interface */
- bcmbal_dest proxy_pkt_dest;
+ key.pon_ni = intf_id;
+ key.onu_id = onu_id;
- proxy_pkt_dest.type = BCMBAL_DEST_TYPE_ITU_OMCI_CHANNEL;
- proxy_pkt_dest.u.itu_omci_channel.sub_term_id = onu_id;
- proxy_pkt_dest.u.itu_omci_channel.intf_id = intf_id;
+ BCMOLT_OPER_INIT(&omci_cpu_packets, onu, cpu_packets, key);
+ BCMOLT_MSG_FIELD_SET(&omci_cpu_packets, packet_type, BCMOLT_PACKET_TYPE_OMCI);
+ BCMOLT_MSG_FIELD_SET(&omci_cpu_packets, calc_crc, BCMOS_TRUE);
// ???
if ((pkt.size()/2) > MAX_OMCI_MSG_LENGTH) {
@@ -862,27 +1048,31 @@
arraySend[idx2] = strtol(str1, NULL, 16);
}
- buf.val = (uint8_t *)malloc((buf.len)*sizeof(uint8_t));
- memcpy(buf.val, (uint8_t *)arraySend, buf.len);
+ buf.arr = (uint8_t *)malloc((buf.len)*sizeof(uint8_t));
+ memcpy(buf.arr, (uint8_t *)arraySend, buf.len);
- err = bcmbal_pkt_send(0, proxy_pkt_dest, (const char *)(buf.val), buf.len);
+ BCMOLT_MSG_FIELD_SET(&omci_cpu_packets, number_of_packets, 1);
+ BCMOLT_MSG_FIELD_SET(&omci_cpu_packets, packet_size, buf.len);
+ BCMOLT_MSG_FIELD_SET(&omci_cpu_packets, buffer, buf);
+ bcmos_errno err = bcmolt_oper_submit(dev_id, &omci_cpu_packets.hdr);
if (err) {
BCM_LOG(ERROR, omci_log_id, "Error sending OMCI message to ONU %d on PON %d\n", onu_id, intf_id);
} else {
BCM_LOG(DEBUG, omci_log_id, "OMCI request msg of length %d sent to ONU %d on PON %d : %s\n",
buf.len, onu_id, intf_id, pkt.c_str());
}
-
- free(buf.val);
+ free(buf.arr);
return Status::OK;
}
Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, uint32_t gemport_id, const std::string pkt) {
- bcmos_errno err = BCM_ERR_OK;
- bcmbal_dest proxy_pkt_dest;
- bcmbal_u8_list_u32_max_2048 buf;
+ bcmolt_pon_interface_cpu_packets pon_interface_cpu_packets; /**< declare main API struct */
+ bcmolt_pon_interface_key key = {.pon_ni = (bcmolt_interface)intf_id}; /**< declare key */
+ bcmolt_bin_str buf = {};
+ bcmolt_gem_port_id gem_port_id_array[1];
+ bcmolt_gem_port_id_list_u8_max_16 gem_port_list = {};
if (port_no > 0) {
bool found = false;
@@ -910,55 +1100,65 @@
gemport_id, onu_id, port_no, intf_id);
}
- proxy_pkt_dest.type = BCMBAL_DEST_TYPE_SVC_PORT;
- proxy_pkt_dest.u.svc_port.svc_port_id = gemport_id;
- proxy_pkt_dest.u.svc_port.intf_id = intf_id;
+ gem_port_id_array[0] = gemport_id;
+ gem_port_list.len = 1;
+ gem_port_list.arr = gem_port_id_array;
+ buf.len = pkt.size();
+ buf.arr = (uint8_t *)malloc((buf.len)*sizeof(uint8_t));
+ memcpy(buf.arr, (uint8_t *)pkt.data(), buf.len);
+
+ /* init the API struct */
+ BCMOLT_OPER_INIT(&pon_interface_cpu_packets, pon_interface, cpu_packets, key);
+ BCMOLT_MSG_FIELD_SET(&pon_interface_cpu_packets, packet_type, BCMOLT_PACKET_TYPE_ETH);
+ BCMOLT_MSG_FIELD_SET(&pon_interface_cpu_packets, calc_crc, BCMOS_TRUE);
+ BCMOLT_MSG_FIELD_SET(&pon_interface_cpu_packets, gem_port_list, gem_port_list);
+ BCMOLT_MSG_FIELD_SET(&pon_interface_cpu_packets, buffer, buf);
+
BCM_LOG(INFO, openolt_log_id, "Packet out of length %d sent to gemport %d on pon %d port_no %u\n",
- pkt.size(), gemport_id, intf_id, port_no);
+ (uint8_t)pkt.size(), gemport_id, intf_id, port_no);
+
+ /* call API */
+ bcmolt_oper_submit(0, &pon_interface_cpu_packets.hdr);
}
else {
- proxy_pkt_dest.type = BCMBAL_DEST_TYPE_SUB_TERM,
- proxy_pkt_dest.u.sub_term.sub_term_id = onu_id;
- proxy_pkt_dest.u.sub_term.intf_id = intf_id;
- BCM_LOG(INFO, openolt_log_id, "Packet out of length %d sent to onu %d on pon %d\n",
- pkt.size(), onu_id, intf_id);
+ //TODO: Port No is 0, it is coming sender requirement.
+ BCM_LOG(INFO, openolt_log_id, "port_no %d onu %d on pon %d\n",
+ port_no, onu_id, intf_id);
}
-
- buf.len = pkt.size();
- buf.val = (uint8_t *)malloc((buf.len)*sizeof(uint8_t));
- memcpy(buf.val, (uint8_t *)pkt.data(), buf.len);
-
- err = bcmbal_pkt_send(0, proxy_pkt_dest, (const char *)(buf.val), buf.len);
-
- free(buf.val);
+ free(buf.arr);
return Status::OK;
}
-Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt) {
- bcmos_errno err = BCM_ERR_OK;
- bcmbal_dest proxy_pkt_dest;
- bcmbal_u8_list_u32_max_2048 buf;
+Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt, bcmolt_flow_id flow_id) {
+ bcmolt_flow_cfg cfg;
+ bcmolt_flow_key key = {}; /* declare key */
+ bcmolt_bin_str buffer = {};
+ bcmolt_flow_send_eth_packet oper; /* declare main API struct */
- proxy_pkt_dest.type = BCMBAL_DEST_TYPE_NNI,
- proxy_pkt_dest.u.nni.intf_id = intf_id;
+ key.flow_id = flow_id;
+ key.flow_type = BCMOLT_FLOW_TYPE_UPSTREAM; /* send from uplink dirction */
- buf.len = pkt.size();
- buf.val = (uint8_t *)malloc((buf.len)*sizeof(uint8_t));
- memcpy(buf.val, (uint8_t *)pkt.data(), buf.len);
+ /* Initialize the API struct. */
+ BCMOLT_OPER_INIT(&oper, flow, send_eth_packet, key);
- err = bcmbal_pkt_send(0, proxy_pkt_dest, (const char *)(buf.val), buf.len);
+ buffer.len = pkt.size();
+ buffer.arr = (uint8_t *)malloc((buffer.len)*sizeof(uint8_t));
+ memcpy(buffer.arr, (uint8_t *)pkt.data(), buffer.len);
+ if (buffer.arr == NULL) {
+ BCM_LOG(ERROR, openolt_log_id, "allocate pakcet buffer failed\n");
+ return bcm_to_grpc_err(BCM_ERR_PARM, "allocate pakcet buffer failed");
+ }
+ BCMOLT_FIELD_SET(&oper.data, flow_send_eth_packet_data, buffer, buffer);
- BCM_LOG(INFO, openolt_log_id, "Packet out of length %d sent through uplink port %d\n",
- buf.len, intf_id);
-
- free(buf.val);
+ bcmos_errno err = bcmolt_oper_submit(dev_id, &oper.hdr);
+ if (err)
+ BCM_LOG(ERROR, omci_log_id, "Error sending packets to port %d\n", intf_id);
return Status::OK;
}
-uint32_t GetPortNum_(uint32_t flow_id)
-{
+uint32_t GetPortNum_(uint32_t flow_id) {
bcmos_fastlock_lock(&data_lock);
uint32_t port_no = 0;
std::map<uint32_t, uint32_t >::const_iterator it = flowid_to_port.find(flow_id);
@@ -974,47 +1174,57 @@
int32_t alloc_id, int32_t network_intf_id,
int32_t gemport_id, const ::openolt::Classifier& classifier,
const ::openolt::Action& action, int32_t priority_value, uint64_t cookie) {
- bcmos_errno err;
- bcmbal_flow_cfg cfg;
- bcmbal_flow_key key = { };
+ bcmolt_flow_cfg cfg;
+ bcmolt_flow_key key = { }; /**< Object key. */
int32_t o_vid = -1;
bool single_tag = false;
uint32_t ether_type = 0;
BCM_LOG(INFO, openolt_log_id, "flow add - intf_id %d, onu_id %d, uni_id %d, port_no %u, flow_id %d, flow_type %s, \
- gemport_id %d, network_intf_id %d, cookie %llu\n", \
+ gemport_id %d, network_intf_id %d, cookie %"PRIu64"\n", \
access_intf_id, onu_id, uni_id, port_no, flow_id, flow_type.c_str(), gemport_id, network_intf_id, cookie);
key.flow_id = flow_id;
if (flow_type.compare(upstream) == 0 ) {
- key.flow_type = BCMBAL_FLOW_TYPE_UPSTREAM;
+ key.flow_type = BCMOLT_FLOW_TYPE_UPSTREAM;
} else if (flow_type.compare(downstream) == 0) {
- key.flow_type = BCMBAL_FLOW_TYPE_DOWNSTREAM;
+ key.flow_type = BCMOLT_FLOW_TYPE_DOWNSTREAM;
} else {
BCM_LOG(WARNING, openolt_log_id, "Invalid flow type %s\n", flow_type.c_str());
return bcm_to_grpc_err(BCM_ERR_PARM, "Invalid flow type");
}
- BCMBAL_CFG_INIT(&cfg, flow, key);
-
- BCMBAL_CFG_PROP_SET(&cfg, flow, admin_state, BCMBAL_STATE_UP);
- BCMBAL_CFG_PROP_SET(&cfg, flow, cookie, cookie);
+ BCMOLT_CFG_INIT(&cfg, flow, key);
+ BCMOLT_MSG_FIELD_SET(&cfg, cookie, cookie);
if (access_intf_id >= 0) {
- BCMBAL_CFG_PROP_SET(&cfg, flow, access_int_id, access_intf_id);
+ if (key.flow_type == BCMOLT_FLOW_TYPE_UPSTREAM) {
+ BCMOLT_MSG_FIELD_SET(&cfg, ingress_intf.intf_type, BCMOLT_FLOW_INTERFACE_TYPE_PON);
+ BCMOLT_MSG_FIELD_SET(&cfg, ingress_intf.intf_id, access_intf_id);
+ } else if (key.flow_type == BCMOLT_FLOW_TYPE_DOWNSTREAM) {
+ BCMOLT_MSG_FIELD_SET(&cfg, egress_intf.intf_type, BCMOLT_FLOW_INTERFACE_TYPE_PON);
+ BCMOLT_MSG_FIELD_SET(&cfg, egress_intf.intf_id, access_intf_id);
+ }
}
if (network_intf_id >= 0) {
- BCMBAL_CFG_PROP_SET(&cfg, flow, network_int_id, network_intf_id);
+ if (key.flow_type == BCMOLT_FLOW_TYPE_DOWNSTREAM) {
+ //TODO: The ingress type is NNI condition
+ //BCMOLT_MSG_FIELD_SET(&cfg, ingress_intf.access_int_id.intf_type, BCMOLT_FLOW_INTERFACE_TYPE_NNI);
+ //BCMOLT_MSG_FIELD_SET(&cfg, ingress_intf.access_int_id.intf_id, network_intf_id);
+ //The egress type is PON condition
+ BCMOLT_MSG_FIELD_SET(&cfg, egress_intf.intf_type, BCMOLT_FLOW_INTERFACE_TYPE_PON);
+ BCMOLT_MSG_FIELD_SET(&cfg, egress_intf.intf_id, access_intf_id);
+ }
}
if (onu_id >= 0) {
- BCMBAL_CFG_PROP_SET(&cfg, flow, sub_term_id, onu_id);
+ BCMOLT_MSG_FIELD_SET(&cfg, onu_id, onu_id);
}
if (gemport_id >= 0) {
- BCMBAL_CFG_PROP_SET(&cfg, flow, svc_port_id, gemport_id);
+ BCMOLT_MSG_FIELD_SET(&cfg, svc_port_id, gemport_id);
}
if (gemport_id >= 0 && port_no != 0) {
bcmos_fastlock_lock(&data_lock);
- if (key.flow_type == BCMBAL_FLOW_TYPE_DOWNSTREAM) {
+ if (key.flow_type == BCMOLT_FLOW_TYPE_DOWNSTREAM) {
port_to_flows[port_no].insert(key.flow_id);
flowid_to_gemport[key.flow_id] = gemport_id;
}
@@ -1025,36 +1235,36 @@
bcmos_fastlock_unlock(&data_lock, 0);
}
if (priority_value >= 0) {
- BCMBAL_CFG_PROP_SET(&cfg, flow, priority, priority_value);
+ BCMOLT_MSG_FIELD_SET(&cfg, priority, priority_value);
}
{
- bcmbal_classifier val = { };
-
+ bcmolt_classifier val = { };
+ /* removed by BAL v3.0
if (classifier.o_tpid()) {
BCM_LOG(DEBUG, openolt_log_id, "classify o_tpid 0x%04x\n", classifier.o_tpid());
BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, o_tpid, classifier.o_tpid());
}
-
+ */
if (classifier.o_vid()) {
BCM_LOG(DEBUG, openolt_log_id, "classify o_vid %d\n", classifier.o_vid());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, o_vid, classifier.o_vid());
+ BCMOLT_FIELD_SET(&val, classifier, o_vid, classifier.o_vid());
}
-
+ /* removed by BAL v3.0
if (classifier.i_tpid()) {
BCM_LOG(DEBUG, openolt_log_id, "classify i_tpid 0x%04x\n", classifier.i_tpid());
BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, i_tpid, classifier.i_tpid());
}
-
+ */
if (classifier.i_vid()) {
BCM_LOG(DEBUG, openolt_log_id, "classify i_vid %d\n", classifier.i_vid());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, i_vid, classifier.i_vid());
+ BCMOLT_FIELD_SET(&val, classifier, i_vid, classifier.i_vid());
}
if (classifier.eth_type()) {
ether_type = classifier.eth_type();
BCM_LOG(DEBUG, openolt_log_id, "classify ether_type 0x%04x\n", classifier.eth_type());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, ether_type, classifier.eth_type());
+ BCMOLT_FIELD_SET(&val, classifier, ether_type, classifier.eth_type());
}
/*
@@ -1069,7 +1279,7 @@
if (classifier.ip_proto()) {
BCM_LOG(DEBUG, openolt_log_id, "classify ip_proto %d\n", classifier.ip_proto());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, ip_proto, classifier.ip_proto());
+ BCMOLT_FIELD_SET(&val, classifier, ip_proto, classifier.ip_proto());
}
/*
@@ -1084,140 +1294,143 @@
if (classifier.src_port()) {
BCM_LOG(DEBUG, openolt_log_id, "classify src_port %d\n", classifier.src_port());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, src_port, classifier.src_port());
+ BCMOLT_FIELD_SET(&val, classifier, src_port, classifier.src_port());
}
if (classifier.dst_port()) {
BCM_LOG(DEBUG, openolt_log_id, "classify dst_port %d\n", classifier.dst_port());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, dst_port, classifier.dst_port());
+ BCMOLT_FIELD_SET(&val, classifier, dst_port, classifier.dst_port());
}
if (!classifier.pkt_tag_type().empty()) {
BCM_LOG(DEBUG, openolt_log_id, "classify tag_type %s\n", classifier.pkt_tag_type().c_str());
if (classifier.pkt_tag_type().compare("untagged") == 0) {
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, pkt_tag_type, BCMBAL_PKT_TAG_TYPE_UNTAGGED);
+ BCMOLT_FIELD_SET(&val, classifier, pkt_tag_type, BCMOLT_PKT_TAG_TYPE_UNTAGGED);
} else if (classifier.pkt_tag_type().compare("single_tag") == 0) {
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, pkt_tag_type, BCMBAL_PKT_TAG_TYPE_SINGLE_TAG);
+ BCMOLT_FIELD_SET(&val, classifier, pkt_tag_type, BCMOLT_PKT_TAG_TYPE_SINGLE_TAG);
single_tag = true;
- BCM_LOG(DEBUG, openolt_log_id, "classify o_pbits 0x%x\n", classifier.o_pbits());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, o_pbits, classifier.o_pbits());
+ BCM_LOG(DEBUG, openolt_log_id, "classify o_pbits 0x%x\n", classifier.o_pbits());
+ BCMOLT_FIELD_SET(&val, classifier, o_pbits, classifier.o_pbits());
} else if (classifier.pkt_tag_type().compare("double_tag") == 0) {
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, pkt_tag_type, BCMBAL_PKT_TAG_TYPE_DOUBLE_TAG);
+ BCMOLT_FIELD_SET(&val, classifier, pkt_tag_type, BCMOLT_PKT_TAG_TYPE_DOUBLE_TAG);
- BCM_LOG(DEBUG, openolt_log_id, "classify o_pbits 0x%x\n", classifier.o_pbits());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, classifier, o_pbits, classifier.o_pbits());
+ BCM_LOG(DEBUG, openolt_log_id, "classify o_pbits 0x%x\n", classifier.o_pbits());
+ BCMOLT_FIELD_SET(&val, classifier, o_pbits, classifier.o_pbits());
}
}
-
- BCMBAL_CFG_PROP_SET(&cfg, flow, classifier, val);
+ BCMOLT_MSG_FIELD_SET(&cfg, classifier, val);
}
{
- bcmbal_action val = { };
+ bcmolt_action val = { };
+ bcmolt_api_prop_path path;
const ::openolt::ActionCmd& cmd = action.cmd();
if (cmd.add_outer_tag()) {
BCM_LOG(INFO, openolt_log_id, "action add o_tag\n");
- BCMBAL_ATTRIBUTE_PROP_SET(&val, action, cmds_bitmask, BCMBAL_ACTION_CMD_ID_ADD_OUTER_TAG);
+ BCMOLT_FIELD_SET(&val, action, cmds_bitmask, BCMOLT_ACTION_CMD_ID_ADD_OUTER_TAG);
}
if (cmd.remove_outer_tag()) {
BCM_LOG(INFO, openolt_log_id, "action pop o_tag\n");
- BCMBAL_ATTRIBUTE_PROP_SET(&val, action, cmds_bitmask, BCMBAL_ACTION_CMD_ID_REMOVE_OUTER_TAG);
+ BCMOLT_FIELD_SET(&val, action, cmds_bitmask, BCMOLT_ACTION_CMD_ID_REMOVE_OUTER_TAG);
}
-
+ /* removed by BAL v3.0
if (cmd.trap_to_host()) {
BCM_LOG(INFO, openolt_log_id, "action trap-to-host\n");
BCMBAL_ATTRIBUTE_PROP_SET(&val, action, cmds_bitmask, BCMBAL_ACTION_CMD_ID_TRAP_TO_HOST);
}
-
+ */
if (action.o_vid()) {
BCM_LOG(INFO, openolt_log_id, "action o_vid=%d\n", action.o_vid());
o_vid = action.o_vid();
- BCMBAL_ATTRIBUTE_PROP_SET(&val, action, o_vid, action.o_vid());
+ BCMOLT_FIELD_SET(&val, action, o_vid, action.o_vid());
}
if (action.o_pbits()) {
BCM_LOG(INFO, openolt_log_id, "action o_pbits=0x%x\n", action.o_pbits());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, action, o_pbits, action.o_pbits());
+ BCMOLT_FIELD_SET(&val, action, o_pbits, action.o_pbits());
}
-
+ /* removed by BAL v3.0
if (action.o_tpid()) {
BCM_LOG(INFO, openolt_log_id, "action o_tpid=0x%04x\n", action.o_tpid());
BCMBAL_ATTRIBUTE_PROP_SET(&val, action, o_tpid, action.o_tpid());
}
-
+ */
if (action.i_vid()) {
BCM_LOG(INFO, openolt_log_id, "action i_vid=%d\n", action.i_vid());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, action, i_vid, action.i_vid());
+ BCMOLT_FIELD_SET(&val, action, i_vid, action.i_vid());
}
if (action.i_pbits()) {
BCM_LOG(DEBUG, openolt_log_id, "action i_pbits=0x%x\n", action.i_pbits());
- BCMBAL_ATTRIBUTE_PROP_SET(&val, action, i_pbits, action.i_pbits());
+ BCMOLT_FIELD_SET(&val, action, i_pbits, action.i_pbits());
}
-
+ /* removed by BAL v3.0
if (action.i_tpid()) {
BCM_LOG(DEBUG, openolt_log_id, "action i_tpid=0x%04x\n", action.i_tpid());
BCMBAL_ATTRIBUTE_PROP_SET(&val, action, i_tpid, action.i_tpid());
}
-
- BCMBAL_CFG_PROP_SET(&cfg, flow, action, val);
+ */
+ BCMOLT_MSG_FIELD_SET(&cfg, action, val);
}
if ((access_intf_id >= 0) && (onu_id >= 0)) {
+ bcmolt_tm_queue_ref val = { };
- if (key.flow_type == BCMBAL_FLOW_TYPE_DOWNSTREAM) {
- bcmbal_tm_queue_ref val = { };
+ if (key.flow_type == BCMOLT_FLOW_TYPE_DOWNSTREAM) {
if (single_tag && ether_type == EAP_ETHER_TYPE) {
val.sched_id = get_default_tm_sched_id(access_intf_id, downstream);
val.queue_id = 0;
-
} else {
val.sched_id = get_tm_sched_id(access_intf_id, onu_id, uni_id, downstream); // Subscriber Scheduler
val.queue_id = get_tm_queue_id(access_intf_id, onu_id, uni_id, gemport_id, downstream);
}
BCM_LOG(INFO, openolt_log_id, "direction = %s, queue_id = %d, sched_id = %d\n", \
downstream.c_str(), val.queue_id, val.sched_id);
- BCMBAL_CFG_PROP_SET(&cfg, flow, queue, val);
- } else if (key.flow_type == BCMBAL_FLOW_TYPE_UPSTREAM) {
+
+ BCMOLT_MSG_FIELD_SET(&cfg , egress_qos.type, BCMOLT_EGRESS_QOS_TYPE_FIXED_QUEUE);
+ BCMOLT_MSG_FIELD_SET(&cfg , egress_qos.tm_sched.id, val.sched_id);
+ BCMOLT_MSG_FIELD_SET(&cfg , egress_qos.u.fixed_queue.queue_id, val.queue_id);
+ } else if (key.flow_type == BCMOLT_FLOW_TYPE_UPSTREAM) {
+ /* removed by BAL v3.0. N/A - Alloc ID is out of the scope of BAL. Used for OMCI only.
bcmbal_tm_sched_id val1;
val1 = get_tm_sched_id(access_intf_id, onu_id, uni_id, upstream); // DBA Scheduler ID
BCMBAL_CFG_PROP_SET(&cfg, flow, dba_tm_sched_id, val1);
-
- bcmbal_tm_queue_ref val2 = { };
- val2.sched_id = get_default_tm_sched_id(network_intf_id, upstream); // NNI Scheduler ID
- val2.queue_id = get_tm_queue_id(access_intf_id, onu_id, uni_id, gemport_id, upstream); // Queue on NNI
+ */
+ val.sched_id = get_default_tm_sched_id(network_intf_id, upstream); // NNI Scheduler ID
+ val.queue_id = get_tm_queue_id(access_intf_id, onu_id, uni_id, gemport_id, upstream); // Queue on NNI
BCM_LOG(INFO, openolt_log_id, "direction = %s, queue_id = %d, sched_id = %d\n", \
- upstream.c_str(), val2.queue_id, val2.sched_id);
- BCMBAL_CFG_PROP_SET(&cfg, flow, queue, val2);
+ upstream.c_str(), val.queue_id, val.sched_id);
}
+ BCMOLT_MSG_FIELD_SET(&cfg , egress_qos.type, BCMOLT_EGRESS_QOS_TYPE_FIXED_QUEUE);
+ BCMOLT_MSG_FIELD_SET(&cfg , egress_qos.tm_sched.id, val.sched_id);
+ BCMOLT_MSG_FIELD_SET(&cfg , egress_qos.u.fixed_queue.queue_id, val.queue_id);
}
- err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(cfg.hdr));
+ BCMOLT_MSG_FIELD_SET(&cfg, state, BCMOLT_FLOW_STATE_ENABLE);
+ bcmos_errno err = bcmolt_cfg_set(dev_id, &cfg.hdr);
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Flow add failed\n");
return bcm_to_grpc_err(err, "flow add failed");
}
- // register_new_flow(key);
-
return Status::OK;
}
Status FlowRemove_(uint32_t flow_id, const std::string flow_type) {
- bcmbal_flow_cfg cfg;
- bcmbal_flow_key key = { };
+ bcmolt_flow_cfg cfg;
+ bcmolt_flow_key key = { };
- key.flow_id = (bcmbal_flow_id) flow_id;
+ key.flow_id = (bcmolt_flow_id) flow_id;
key.flow_id = flow_id;
if (flow_type.compare(upstream) == 0 ) {
- key.flow_type = BCMBAL_FLOW_TYPE_UPSTREAM;
+ key.flow_type = BCMOLT_FLOW_TYPE_UPSTREAM;
} else if (flow_type.compare(downstream) == 0) {
- key.flow_type = BCMBAL_FLOW_TYPE_DOWNSTREAM;
+ key.flow_type = BCMOLT_FLOW_TYPE_DOWNSTREAM;
} else {
BCM_LOG(WARNING, openolt_log_id, "Invalid flow type %s\n", flow_type.c_str());
return bcm_to_grpc_err(BCM_ERR_PARM, "Invalid flow type");
@@ -1225,7 +1438,7 @@
bcmos_fastlock_lock(&data_lock);
uint32_t port_no = flowid_to_port[key.flow_id];
- if (key.flow_type == BCMBAL_FLOW_TYPE_DOWNSTREAM) {
+ if (key.flow_type == BCMOLT_FLOW_TYPE_DOWNSTREAM) {
flowid_to_gemport.erase(key.flow_id);
port_to_flows[port_no].erase(key.flow_id);
if (port_to_flows[port_no].empty()) port_to_flows.erase(port_no);
@@ -1236,10 +1449,9 @@
}
bcmos_fastlock_unlock(&data_lock, 0);
- BCMBAL_CFG_INIT(&cfg, flow, key);
+ BCMOLT_CFG_INIT(&cfg, flow, key);
-
- bcmos_errno err = bcmbal_cfg_clear(DEFAULT_ATERM_ID, &cfg.hdr);
+ bcmos_errno err = bcmolt_cfg_clear(dev_id, &cfg.hdr);
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Error %d while removing flow %d, %s\n",
err, flow_id, flow_type.c_str());
@@ -1258,62 +1470,55 @@
if (direction == downstream) {
- bcmbal_tm_sched_cfg cfg;
- bcmbal_tm_sched_key key = { };
+ bcmolt_tm_sched_cfg cfg;
+ bcmolt_tm_sched_key key = { };
key.id = get_tm_sched_id(intf_id, onu_id, uni_id, direction);
- key.dir = BCMBAL_TM_SCHED_DIR_DS;
- BCMBAL_CFG_INIT(&cfg, tm_sched, key);
+ BCMOLT_CFG_INIT(&cfg, tm_sched, key);
{
// bcmbal_tm_sched_owner
// In downstream it is sub_term scheduler
- bcmbal_tm_sched_owner tm_sched_owner = { };
- tm_sched_owner.type = BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM;
+ bcmolt_tm_sched_attachment_point attachment_point; /**< The output of the tm_sched object instance */
+ BCMOLT_MSG_FIELD_SET(&cfg , attachment_point.u.interface.interface_ref.intf_type, BCMOLT_INTERFACE_TYPE_PON);
+ BCMOLT_MSG_FIELD_SET(&cfg , attachment_point.u.interface.interface_ref.intf_id, intf_id);
+ /* removed by BAL v3.0, N/A - No direct attachment point of type ONU, same functionality may
+ be achieved using the' virtual' type of attachment.
tm_sched_owner.u.sub_term.intf_id = intf_id;
tm_sched_owner.u.sub_term.sub_term_id = onu_id;
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, owner, tm_sched_owner);
+ */
// bcmbal_tm_sched_type
// set the deafult policy to strict priority
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_type, BCMBAL_TM_SCHED_TYPE_SP);
+ BCMOLT_MSG_FIELD_SET(&cfg, sched_type, BCMOLT_TM_SCHED_TYPE_SP);
// bcmbal_tm_sched_parent
// The parent for the sub_term scheduler is the PON scheduler in the downstream
- bcmbal_tm_sched_parent tm_sched_parent = { };
- tm_sched_parent.presence_mask |= (BCMBAL_TM_SCHED_PARENT_ID_SCHED_ID);
- tm_sched_parent.sched_id = get_default_tm_sched_id(intf_id, downstream);
- tm_sched_parent.presence_mask |= (BCMBAL_TM_SCHED_PARENT_ID_PRIORITY);
- tm_sched_parent.priority = 1; // TODO: Hardcoded priority as 1
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_parent, tm_sched_parent);
+
+ BCMOLT_MSG_FIELD_SET(&cfg , attachment_point.u.tm_sched.tm_sched_id, get_default_tm_sched_id(intf_id, downstream));
+ BCMOLT_FIELD_SET_PRESENT(&cfg.data.attachment_point.u.tm_sched.tm_sched_param.u.priority, tm_sched_param_priority, priority);
+ BCMOLT_MSG_FIELD_SET(&cfg , attachment_point.u.tm_sched.tm_sched_param.u.priority.priority, 1);
// num_priorities: Max number of strict priority scheduling elements
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, num_priorities, 8); // TODO: hardcoded 8 priorities.
+ BCMOLT_MSG_FIELD_SET(&cfg, num_priorities, 8);
// bcmbal_tm_shaping
if (tf_sh_info.cir() >= 0 && tf_sh_info.pir() > 0) {
- bcmbal_tm_shaping rate = {};
uint32_t cir = tf_sh_info.cir();
uint32_t pir = tf_sh_info.pir();
uint32_t burst = tf_sh_info.pbs();
BCM_LOG(INFO, openolt_log_id, "applying traffic shaping in DL cir=%u, pir=%u, burst=%u\n",
cir, pir, burst);
- rate.presence_mask = BCMBAL_TM_SHAPING_ID_NONE;
- rate.presence_mask |= BCMBAL_TM_SHAPING_ID_PIR;
- rate.presence_mask |= BCMBAL_TM_SHAPING_ID_BURST;
+ BCMOLT_FIELD_SET_PRESENT(&cfg.data.rate, tm_shaping, pir);
+ BCMOLT_FIELD_SET_PRESENT(&cfg.data.rate, tm_shaping, burst);
// FIXME: Setting CIR, results in BAL throwing error 'tm_sched minimum rate is not supported yet'
- // rate.cir = cir;
- rate.pir = pir;
- rate.burst = burst;
-
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, rate, rate);
+ BCMOLT_MSG_FIELD_SET(&cfg , rate.cir, cir);
+ BCMOLT_MSG_FIELD_SET(&cfg , rate.pir, pir);
+ BCMOLT_MSG_FIELD_SET(&cfg , rate.burst, burst);
}
-
- // creation_mode
- // BCMBAL_CFG_PROP_SET(&cfg, tm_sched, creation_mode, BCMBAL_TM_CREATION_MODE_MANUAL);
}
- err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(cfg.hdr));
+ err = bcmolt_cfg_set(dev_id, &(cfg.hdr));
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Failed to create downstream subscriber scheduler, id %d, intf_id %d, \
onu_id %d, uni_id %d, port_no %u\n", key.id, intf_id, onu_id,uni_id,port_no);
@@ -1323,49 +1528,50 @@
uni_id %d, port_no %u\n", key.id,intf_id,onu_id,uni_id,port_no);
} else { //upstream
- bcmbal_tm_sched_cfg cfg;
- bcmbal_tm_sched_key key = { };
+ bcmolt_itupon_alloc_cfg cfg;
+ bcmolt_itupon_alloc_key key = { };
+ key.pon_ni = intf_id;
+ key.alloc_id = alloc_id;
- key.id = get_tm_sched_id(intf_id, onu_id, uni_id, direction);
- key.dir = BCMBAL_TM_SCHED_DIR_US;
+ BCMOLT_CFG_INIT(&cfg, itupon_alloc, key);
+ BCMOLT_MSG_FIELD_SET(&cfg, onu_id, onu_id);
+ if (additional_bw == 2) //AdditionalBW_BestEffort
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.additional_bw_eligibility,
+ BCMOLT_ADDITIONAL_BW_ELIGIBILITY_BEST_EFFORT);
+ else if (additional_bw == 3) //AdditionalBW_Auto
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.additional_bw_eligibility,
+ BCMOLT_ADDITIONAL_BW_ELIGIBILITY_NON_ASSURED);
+ /* CBR Real Time Bandwidth which require shaping of the bandwidth allocations
+ in a fine granularity. */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.cbr_rt_bw, 0);
+ /* Fixed Bandwidth with no critical requirement of shaping */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.cbr_nrt_bw, 0);
+ /* Dynamic bandwidth which the OLT is committed to allocate upon demand */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.guaranteed_bw, 0);
+ /* Maximum allocated bandwidth allowed for this alloc ID */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.maximum_bw, tf_sh_info.pir());
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.alloc_type, BCMOLT_ALLOC_TYPE_NSR);
+ /* Set to True for AllocID with CBR RT Bandwidth that requires compensation
+ for skipped allocations during quiet window */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.cbr_rt_compensation, BCMOS_FALSE);
+ /**< Allocation Profile index for CBR non-RT Bandwidth */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.cbr_nrt_ap_index, 0);
+ /**< Allocation Profile index for CBR RT Bandwidth */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.cbr_rt_ap_index, 0);
+ /**< Alloc ID Weight used in case of Extended DBA mode */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.weight, 0);
+ /**< Alloc ID Priority used in case of Extended DBA mode */
+ BCMOLT_MSG_FIELD_SET(&cfg, sla.priority, 0);
+ BCMOLT_MSG_FIELD_SET(&cfg, onu_id, 2);
- BCMBAL_CFG_INIT(&cfg, tm_sched, key);
-
- {
- // bcmbal_tm_sched_owner: AGG PORT
- bcmbal_tm_sched_owner tm_sched_owner = { };
- tm_sched_owner.type = BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT;
- tm_sched_owner.u.agg_port.presence_mask |= bcmbal_tm_sched_owner_agg_port_id_all;
- tm_sched_owner.u.agg_port.intf_id = intf_id;
- tm_sched_owner.u.agg_port.sub_term_id = onu_id;
- tm_sched_owner.u.agg_port.agg_port_id = alloc_id;
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, owner, tm_sched_owner);
-
- // bcmbal_tm_shaping
- if (tf_sh_info.cir() >= 0 && tf_sh_info.pir() > 0) {
- bcmbal_tm_shaping rate = {};
- uint32_t cir = tf_sh_info.cir();
- uint32_t pir = tf_sh_info.pir();
- uint32_t burst = tf_sh_info.pbs();
- BCM_LOG(INFO, openolt_log_id, "applying traffic shaping in UL cir=%u, pir=%u, burst=%u\n",
- cir, pir, burst);
- rate.presence_mask = BCMBAL_TM_SHAPING_ID_ALL;
- rate.cir = cir;
- rate.pir = pir;
- rate.burst = burst;
-
- BCMBAL_CFG_PROP_SET(&cfg, tm_sched, rate, rate);
- }
- }
-
- err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(cfg.hdr));
+ err = bcmolt_cfg_set(dev_id, &(cfg.hdr));
if (err) {
- BCM_LOG(ERROR, openolt_log_id, "Failed to create upstream DBA sched, id %d, intf_id %d, onu_id %d, uni_id %d,\
- port_no %u, alloc_id %d\n", key.id, intf_id, onu_id,uni_id,port_no,alloc_id);
+ BCM_LOG(ERROR, openolt_log_id, "Failed to create upstream DBA sched, intf_id %d, onu_id %d, uni_id %d,\
+ port_no %u, alloc_id %d\n", intf_id, onu_id,uni_id,port_no,alloc_id);
return err;
}
- BCM_LOG(INFO, openolt_log_id, "Create upstream DBA sched, id %d, intf_id %d, onu_id %d, uni_id %d, port_no %u, \
- alloc_id %d\n", key.id,intf_id,onu_id,uni_id,port_no,alloc_id);
+ BCM_LOG(INFO, openolt_log_id, "Create upstream DBA sched, intf_id %d, onu_id %d, uni_id %d, port_no %u, \
+ alloc_id %d\n", intf_id,onu_id,uni_id,port_no,alloc_id);
}
return BCM_ERR_OK;
@@ -1416,36 +1622,45 @@
bcmos_errno RemoveSched(int intf_id, int onu_id, int uni_id, std::string direction) {
bcmos_errno err;
-
- bcmbal_tm_sched_cfg tm_cfg_us;
- bcmbal_tm_sched_key tm_key_us = { };
-
- if (is_tm_sched_id_present(intf_id, onu_id, uni_id, direction)) {
- tm_key_us.id = get_tm_sched_id(intf_id, onu_id, uni_id, direction);
- } else {
- BCM_LOG(INFO, openolt_log_id, "schduler not present in %s\n", direction.c_str());
- return BCM_ERR_OK;
- }
+
if (direction == upstream) {
- tm_key_us.dir = BCMBAL_TM_SCHED_DIR_US;
- } else {
- tm_key_us.dir = BCMBAL_TM_SCHED_DIR_DS;
- }
+ bcmolt_itupon_alloc_cfg cfg;
+ bcmolt_itupon_alloc_key key = { };
+ key.pon_ni = intf_id;
- BCMBAL_CFG_INIT(&tm_cfg_us, tm_sched, tm_key_us);
+ BCMOLT_CFG_INIT(&cfg, itupon_alloc, key);
+ BCMOLT_MSG_FIELD_SET(&cfg, onu_id, onu_id);
+ BCMOLT_CFG_INIT(&cfg, itupon_alloc, key);
+ err = bcmolt_cfg_clear(dev_id, &(cfg.hdr));
+ if (err) {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to remove scheduler sched, direction = %s, intf_id %d, onu_id %d\n", \
+ direction.c_str(), intf_id, onu_id);
+ return err;
+ }
+ BCM_LOG(INFO, openolt_log_id, "Removed sched, direction = %s, intf_id %d, onu_id %d\n", \
+ direction.c_str(), intf_id, onu_id);
+ } else if (direction == downstream) {
+ bcmolt_tm_sched_cfg cfg;
+ bcmolt_tm_sched_key key = { };
- err = bcmbal_cfg_clear(DEFAULT_ATERM_ID, &(tm_cfg_us.hdr));
- if (err) {
- BCM_LOG(ERROR, openolt_log_id, "Failed to remove scheduler sched, direction = %s, id %d, intf_id %d, onu_id %d\n", \
- direction.c_str(), tm_key_us.id, intf_id, onu_id);
- return err;
+ if (is_tm_sched_id_present(intf_id, onu_id, uni_id, direction)) {
+ key.id = get_tm_sched_id(intf_id, onu_id, uni_id, direction);
+ } else {
+ BCM_LOG(INFO, openolt_log_id, "schduler not present in %s\n", direction.c_str());
+ return BCM_ERR_OK;
+ }
+ BCMOLT_CFG_INIT(&cfg, tm_sched, key);
+ err = bcmolt_cfg_clear(dev_id, &(cfg.hdr));
+ if (err) {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to remove scheduler sched, direction = %s, id %d, intf_id %d, onu_id %d\n", \
+ direction.c_str(), key.id, intf_id, onu_id);
+ return err;
+ }
+ BCM_LOG(INFO, openolt_log_id, "Removed sched, direction = %s, id %d, intf_id %d, onu_id %d\n", \
+ direction.c_str(), key.id, intf_id, onu_id);
}
free_tm_sched_id(intf_id, onu_id, uni_id, direction);
-
- BCM_LOG(INFO, openolt_log_id, "Removed sched, direction = %s, id %d, intf_id %d, onu_id %d\n", \
- direction.c_str(), tm_key_us.id, intf_id, onu_id);
-
return BCM_ERR_OK;
}
@@ -1478,14 +1693,12 @@
bcmos_errno CreateQueue(std::string direction, uint32_t access_intf_id, uint32_t onu_id, uint32_t uni_id, uint32_t priority,
uint32_t gemport_id) {
bcmos_errno err;
- bcmbal_tm_queue_cfg cfg;
- bcmbal_tm_queue_key key = { };
+ bcmolt_tm_queue_cfg cfg;
+ bcmolt_tm_queue_key key = { };
BCM_LOG(INFO, openolt_log_id, "creating queue. access_intf_id = %d, onu_id = %d, uni_id = %d \
gemport_id = %d, direction = %s\n", access_intf_id, onu_id, uni_id, gemport_id, direction.c_str());
if (direction == downstream) {
- // In the downstream, the queues are on the 'sub term' scheduler
// There is one queue per gem port
- key.sched_dir = BCMBAL_TM_SCHED_DIR_DS;
key.sched_id = get_tm_sched_id(access_intf_id, onu_id, uni_id, direction);
key.id = get_tm_queue_id(access_intf_id, onu_id, uni_id, gemport_id, direction);
@@ -1496,7 +1709,6 @@
access_intf_id, onu_id, uni_id);
return BCM_ERR_OK;
}
- key.sched_dir = BCMBAL_TM_SCHED_DIR_US;
key.sched_id = get_default_tm_sched_id(nni_intf_id, direction);
if (priority > 7) {
return BCM_ERR_RANGE;
@@ -1512,14 +1724,10 @@
}
BCM_LOG(INFO, openolt_log_id, "queue assigned queue_id = %d\n", key.id);
- BCMBAL_CFG_INIT(&cfg, tm_queue, key);
+ BCMOLT_CFG_INIT(&cfg, tm_queue, key);
+ BCMOLT_MSG_FIELD_SET(&cfg, tm_sched_param.u.priority.priority, priority);
- BCMBAL_CFG_PROP_SET(&cfg, tm_queue, priority, priority);
-
- // BCMBAL_CFG_PROP_SET(&cfg, tm_queue, creation_mode, BCMBAL_TM_CREATION_MODE_MANUAL);
-
-
- err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &cfg.hdr);
+ err = bcmolt_cfg_set(dev_id, &cfg.hdr);
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Failed to create subscriber tm queue, direction = %s, id %d, sched_id %d, \
intf_id %d, onu_id %d, uni_id %d\n", \
@@ -1562,19 +1770,17 @@
return Status::OK;
}
-
bcmos_errno RemoveQueue(std::string direction, uint32_t access_intf_id, uint32_t onu_id, uint32_t uni_id, uint32_t priority,
uint32_t gemport_id) {
- bcmbal_tm_queue_cfg queue_cfg;
- bcmbal_tm_queue_key queue_key = { };
+ bcmolt_tm_queue_cfg cfg;
+ bcmolt_tm_queue_key key = { };
bcmos_errno err;
if (direction == downstream) {
- queue_key.sched_dir = BCMBAL_TM_SCHED_DIR_DS;
if (is_tm_queue_id_present(access_intf_id, onu_id, uni_id, gemport_id, direction) && \
is_tm_sched_id_present(access_intf_id, onu_id, uni_id, direction)) {
- queue_key.sched_id = get_tm_sched_id(access_intf_id, onu_id, uni_id, direction);
- queue_key.id = get_tm_queue_id(access_intf_id, onu_id, uni_id, gemport_id, direction);
+ key.sched_id = get_tm_sched_id(access_intf_id, onu_id, uni_id, direction);
+ key.id = get_tm_queue_id(access_intf_id, onu_id, uni_id, gemport_id, direction);
} else {
BCM_LOG(INFO, openolt_log_id, "queue not present in DS. Not clearing");
return BCM_ERR_OK;
@@ -1586,13 +1792,13 @@
return BCM_ERR_OK;
}
- BCMBAL_CFG_INIT(&queue_cfg, tm_queue, queue_key);
+ BCMOLT_CFG_INIT(&cfg, tm_queue, key);
- err = bcmbal_cfg_clear(DEFAULT_ATERM_ID, &(queue_cfg.hdr));
+ err = bcmolt_cfg_clear(dev_id, &(cfg.hdr));
if (err) {
BCM_LOG(ERROR, openolt_log_id, "Failed to remove queue, direction = %s, id %d, sched_id %d, intf_id %d, onu_id %d, uni_id %d\n",
- direction.c_str(), queue_key.id, queue_key.sched_id, access_intf_id, onu_id, uni_id);
+ direction.c_str(), key.id, key.sched_id, access_intf_id, onu_id, uni_id);
return err;
}
diff --git a/agent/src/error_format.h b/agent/src/error_format.h
index 9736456..3928dc1 100644
--- a/agent/src/error_format.h
+++ b/agent/src/error_format.h
@@ -24,8 +24,7 @@
extern "C"
{
#include <bcmos_system.h>
-#include <bal_api.h>
-#include <bal_api_end.h>
+#include <bcmolt_api.h>
}
grpc::Status bcm_to_grpc_err(bcmos_errno bcm_err, std::string message);
diff --git a/agent/src/indications.cc b/agent/src/indications.cc
index 30a04ab..664c79a 100644
--- a/agent/src/indications.cc
+++ b/agent/src/indications.cc
@@ -26,8 +26,9 @@
extern "C"
{
#include <bcmos_system.h>
-#include <bal_api.h>
-#include <bal_api_end.h>
+#include <bcmolt_api.h>
+#include <bcmolt_host_api.h>
+#include <bcmolt_api_model_api_structs.h>
}
using grpc::Status;
@@ -38,80 +39,83 @@
bool subscribed = false;
uint32_t nni_intf_id = 0;
+#define current_device 0
-bcmos_errno OmciIndication(bcmbal_obj *obj);
+static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg);
-std::string bcmbal_to_grpc_intf_type(bcmbal_intf_type intf_type)
+#define INTERFACE_STATE_IF_DOWN(state) \
+ ((state == BCMOLT_INTERFACE_STATE_INACTIVE || \
+ state == BCMOLT_INTERFACE_STATE_PROCESSING || \
+ state == BCMOLT_INTERFACE_STATE_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE)
+#define INTERFACE_STATE_IF_UP(state) \
+ ((state == BCMOLT_INTERFACE_STATE_ACTIVE_WORKING) ? BCMOS_TRUE : BCMOS_FALSE)
+#define ONU_STATE_IF_DOWN(state) \
+ ((state == BCMOLT_ONU_OPERATION_INACTIVE || \
+ state == BCMOLT_ONU_OPERATION_DISABLE || \
+ state == BCMOLT_ONU_OPERATION_ACTIVE_STANDBY) ? BCMOS_TRUE : BCMOS_FALSE)
+#define ONU_STATE_IF_UP(state) \
+ ((state == BCMOLT_ONU_OPERATION_ACTIVE) ? BCMOS_TRUE : BCMOS_FALSE)
+
+std::string bcmbal_to_grpc_intf_type(bcmolt_interface_type intf_type)
{
- if (intf_type == BCMBAL_INTF_TYPE_NNI) {
+ if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) {
return "nni";
- } else if (intf_type == BCMBAL_INTF_TYPE_PON) {
+ } else if (intf_type == BCMOLT_INTERFACE_TYPE_PON) {
return "pon";
}
return "unknown";
}
-bcmos_errno OltOperIndication(bcmbal_obj *obj) {
+static void OltOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::OltIndication* olt_ind = new openolt::OltIndication;
Status status;
-
- bcmbal_access_terminal_oper_status_change *acc_term_ind = (bcmbal_access_terminal_oper_status_change *)obj;
std::string admin_state;
- if (acc_term_ind->data.admin_state == BCMBAL_STATE_UP) {
- admin_state = "up";
- } else {
- admin_state = "down";
- }
- if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
- // Determine device capabilities before transitionto acive state
- ProbeDeviceCapabilities_();
- olt_ind->set_oper_state("up");
- } else {
- olt_ind->set_oper_state("down");
+ switch (msg->subgroup) {
+ case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE:
+ ProbeDeviceCapabilities_();
+ admin_state = "up";
+ olt_ind->set_oper_state("up");
+ break;
+ case BCMOLT_DEVICE_AUTO_SUBGROUP_DISCONNECTION_COMPLETE:
+ admin_state = "down";
+ olt_ind->set_oper_state("down");
+ break;
+ case BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_FAILURE:
+ admin_state = "failure";
+ olt_ind->set_oper_state("failure");
+ break;
}
ind.set_allocated_olt_ind(olt_ind);
- BCM_LOG(INFO, openolt_log_id, "Olt oper status indication, admin_state: %s oper_state: %s\n",
- admin_state.c_str(),
- olt_ind->oper_state().c_str());
-
- oltIndQ.push(ind);
-
- // Enable all PON interfaces.
- //
- for (int i = 0; i < NumPonIf_(); i++) {
- status = EnablePonIf_(i);
- if (!status.ok()) {
- // FIXME - raise alarm to report error in enabling PON
+ if (msg->subgroup == BCMOLT_DEVICE_AUTO_SUBGROUP_CONNECTION_COMPLETE) {
+ // Enable all PON interfaces.
+ for (int i = 0; i < NumPonIf_(); i++) {
+ status = EnablePonIf_(i);
+ if (!status.ok()) {
+ // FIXME - raise alarm to report error in enabling PON
+ }
}
- }
- // Enable all NNI interfaces.
- //
- for (int i = 0; i < NumNniIf_(); i++) {
- status = EnableUplinkIf_(i);
- if (!status.ok()) {
- // FIXME - raise alarm to report error in enabling PON
+ // Enable all NNI interfaces.
+ for (int i = 0; i < NumNniIf_(); i++) {
+ status = EnableUplinkIf_(i);
+ if (!status.ok()) {
+ // FIXME - raise alarm to report error in enabling PON
+ }
}
- }
- /* register for omci indication */
- {
- bcmbal_cb_cfg cb_cfg = {};
- uint16_t ind_subgroup;
+ /* register for omci indication */
+ {
+ bcmolt_rx_cfg rx_cfg = {};
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OmciIndication;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_omci_packet;
+ rx_cfg.module = BCMOS_MODULE_ID_OMCI_TRANSPORT;
+ bcmolt_ind_subscribe(current_device, &rx_cfg);
+ }
- cb_cfg.module = BCMOS_MODULE_ID_NONE;
- cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
- ind_subgroup = BCMBAL_IND_SUBGROUP(packet, itu_omci_channel_rx);
- cb_cfg.p_object_key_info = NULL;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OmciIndication;
- bcmbal_subscribe_ind(0, &cb_cfg);
- }
-
- if (acc_term_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
ProbePonIfTechnology_();
state.activate();
}
@@ -119,477 +123,619 @@
state.deactivate();
}
- return BCM_ERR_OK;
+ oltIndQ.push(ind);
+ bcmolt_msg_free(msg);
}
-bcmos_errno LosIndication(bcmbal_obj *obj) {
+static void LosIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::LosIndication* los_ind = new openolt::LosIndication;
- bcmbal_interface_los* bcm_los_ind = (bcmbal_interface_los *) obj;
- int intf_id = interface_key_to_port_no(bcm_los_ind->key);
- std::string status = alarm_status_to_string(bcm_los_ind->data.status);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_PON_INTERFACE:
+ switch (msg->subgroup) {
+ case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_LOS:
+ {
+ bcmolt_pon_interface_los* bcm_los_ind = (bcmolt_pon_interface_los *) msg;
+ int intf_id = interface_key_to_port_no(bcm_los_ind->key.pon_ni,
+ BCMOLT_INTERFACE_TYPE_PON);
+ std::string status = alarm_status_to_string(bcm_los_ind->data.status);
- BCM_LOG(INFO, openolt_log_id, "LOS indication : intf_type: %d intf_id: %d port: %d status %s\n",
- bcm_los_ind->key.intf_type, bcm_los_ind->key.intf_id, intf_id, status.c_str());
+ BCM_LOG(INFO, openolt_log_id, "LOS indication : intf_id: %d port: %d status %s\n",
+ bcm_los_ind->key.pon_ni, intf_id, status.c_str());
- los_ind->set_intf_id(intf_id);
- los_ind->set_status(status);
+ los_ind->set_intf_id(intf_id);
+ los_ind->set_status(status);
- alarm_ind->set_allocated_los_ind(los_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ alarm_ind->set_allocated_los_ind(los_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ break;
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno IfIndication(bcmbal_obj *obj) {
+static void IfIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::IntfIndication* intf_ind = new openolt::IntfIndication;
- BCM_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
- ((bcmbal_interface_oper_status_change *)obj)->key.intf_id );
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_PON_INTERFACE:
+ switch (msg->subgroup) {
+ case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED:
+ {
+ BCM_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
+ ((bcmolt_pon_interface_state_change_completed *)msg)->key.pon_ni);
+ bcmolt_pon_interface_key *key =
+ &((bcmolt_pon_interface_state_change_completed*)msg)->key;
+ bcmolt_pon_interface_state_change_completed_data *data =
+ &((bcmolt_pon_interface_state_change_completed*)msg)->data;
- intf_ind->set_intf_id(((bcmbal_interface_oper_status_change *)obj)->key.intf_id);
- if (((bcmbal_interface_oper_status_change *)obj)->data.new_oper_status == BCMBAL_STATUS_UP) {
- intf_ind->set_oper_state("up");
- } else {
- intf_ind->set_oper_state("down");
+ intf_ind->set_intf_id(key->pon_ni);
+ if (INTERFACE_STATE_IF_UP(data->new_state))
+ intf_ind->set_oper_state("up");
+ if (INTERFACE_STATE_IF_DOWN(data->new_state))
+ intf_ind->set_oper_state("down");
+ ind.set_allocated_intf_ind(intf_ind);
+ break;
+ }
+ }
+ break;
+ case BCMOLT_OBJ_ID_NNI_INTERFACE:
+ switch (msg->subgroup) {
+ case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE:
+ {
+ BCM_LOG(INFO, openolt_log_id, "intf indication, intf_id: %d\n",
+ ((bcmolt_nni_interface_state_change *)msg)->key.id);
+ bcmolt_nni_interface_key *key =
+ &((bcmolt_nni_interface_state_change *)msg)->key;
+ bcmolt_nni_interface_state_change_data *data =
+ &((bcmolt_nni_interface_state_change *)msg)->data;
+
+ intf_ind->set_intf_id(key->id);
+ if (INTERFACE_STATE_IF_UP(data->new_state))
+ intf_ind->set_oper_state("up");
+ if (INTERFACE_STATE_IF_DOWN(data->new_state))
+ intf_ind->set_oper_state("down");
+ ind.set_allocated_intf_ind(intf_ind);
+ break;
+ }
+ }
}
- ind.set_allocated_intf_ind(intf_ind);
oltIndQ.push(ind);
-
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno IfOperIndication(bcmbal_obj *obj) {
+static void IfOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::IntfOperIndication* intf_oper_ind = new openolt::IntfOperIndication;
- bcmbal_interface_oper_status_change* bcm_if_oper_ind = (bcmbal_interface_oper_status_change *) obj;
- intf_oper_ind->set_type(bcmbal_to_grpc_intf_type(bcm_if_oper_ind->key.intf_type));
- intf_oper_ind->set_intf_id(bcm_if_oper_ind->key.intf_id);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_PON_INTERFACE:
+ switch (msg->subgroup) {
+ case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE_COMPLETED:
+ {
+ bcmolt_pon_interface_key *key = &((bcmolt_pon_interface_state_change_completed*)msg)->key;
+ bcmolt_pon_interface_state_change_completed_data *data = &((bcmolt_pon_interface_state_change_completed*)msg)->data;
+ intf_oper_ind->set_intf_id(key->pon_ni);
+ intf_oper_ind->set_type(bcmbal_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_PON));
+ if (INTERFACE_STATE_IF_UP(data->new_state))
+ intf_oper_ind->set_oper_state("up");
+ if (INTERFACE_STATE_IF_DOWN(data->new_state))
+ intf_oper_ind->set_oper_state("down");
- if (bcm_if_oper_ind->data.new_oper_status == BCMBAL_STATUS_UP) {
- intf_oper_ind->set_oper_state("up");
- if (bcm_if_oper_ind->key.intf_type == BCMBAL_INTF_TYPE_NNI) {
- nni_intf_id = bcm_if_oper_ind->key.intf_id;
- }
- } else {
- intf_oper_ind->set_oper_state("down");
+ BCM_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n",
+ intf_oper_ind->type().c_str(), key->pon_ni, intf_oper_ind->oper_state().c_str());
+ ind.set_allocated_intf_oper_ind(intf_oper_ind);
+ break;
+ }
+ }
+ case BCMOLT_OBJ_ID_NNI_INTERFACE:
+ switch (msg->subgroup) {
+ case BCMOLT_NNI_INTERFACE_AUTO_SUBGROUP_STATE_CHANGE:
+ {
+ bcmolt_nni_interface_key *key = &((bcmolt_nni_interface_state_change *)msg)->key;
+ bcmolt_nni_interface_state_change_data *data = &((bcmolt_nni_interface_state_change *)msg)->data;
+ bcmolt_interface intf_id = key->id;
+ bcmolt_interface_type intf_type = BCMOLT_INTERFACE_TYPE_NNI;
+ intf_oper_ind->set_intf_id(key->id);
+ intf_oper_ind->set_type(bcmbal_to_grpc_intf_type(BCMOLT_INTERFACE_TYPE_NNI));
+
+ if (INTERFACE_STATE_IF_UP(data->new_state))
+ intf_oper_ind->set_oper_state("up");
+ if (INTERFACE_STATE_IF_DOWN(data->new_state))
+ intf_oper_ind->set_oper_state("down");
+
+ BCM_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s\n",
+ intf_oper_ind->type().c_str(), key->id, intf_oper_ind->oper_state().c_str());
+ ind.set_allocated_intf_oper_ind(intf_oper_ind);
+ break;
+ }
+ }
}
- BCM_LOG(INFO, openolt_log_id, "intf oper state indication, intf_type %s, intf_id %d, oper_state %s, admin_state %d\n",
- intf_oper_ind->type().c_str(),
- bcm_if_oper_ind->key.intf_id,
- intf_oper_ind->oper_state().c_str(),
- bcm_if_oper_ind->data.admin_state);
-
- ind.set_allocated_intf_oper_ind(intf_oper_ind);
-
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuAlarmIndication(bcmbal_obj *obj) {
+static void OnuAlarmIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuAlarmIndication* onu_alarm_ind = new openolt::OnuAlarmIndication;
- bcmbal_subscriber_terminal_key *key =
- &((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->key;
-
- bcmbal_subscriber_terminal_alarms *alarms =
- &(((bcmbal_subscriber_terminal_sub_term_alarm*)obj)->data.alarm);
-
- BCM_LOG(WARNING, openolt_log_id, "onu alarm indication intf_id %d, onu_id %d, alarm: los %d, lob %d, lopc_miss %d, lopc_mic_error %d\n",
- key->intf_id, key->sub_term_id, alarms->los, alarms->lob, alarms->lopc_miss, alarms->lopc_mic_error);
-
- onu_alarm_ind->set_intf_id(key->intf_id);
- onu_alarm_ind->set_onu_id(key->sub_term_id);
- onu_alarm_ind->set_los_status(alarm_status_to_string(alarms->los));
- onu_alarm_ind->set_lob_status(alarm_status_to_string(alarms->lob));
- onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(alarms->lopc_miss));
- onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(alarms->lopc_mic_error));
-
- alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_XGPON_ALARM:
+ {
+ bcmolt_xgpon_onu_alarms *onu_alarms =
+ &((bcmolt_onu_xgpon_alarm_data *)msg)->xgpon_onu_alarm;
+ onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi));
+ onu_alarm_ind->set_lob_status(alarm_status_to_string(onu_alarms->lobi));
+ onu_alarm_ind->set_lopc_miss_status(alarm_status_to_string(
+ onu_alarms->lopci_miss));
+ onu_alarm_ind->set_lopc_mic_error_status(alarm_status_to_string(
+ onu_alarms->lopci_mic_error));
+
+ alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ break;
+ }
+ case BCMOLT_ONU_AUTO_SUBGROUP_GPON_ALARM:
+ {
+ bcmolt_gpon_onu_alarms *onu_alarms =
+ &((bcmolt_onu_gpon_alarm_data *)msg)->gpon_onu_alarm;
+ onu_alarm_ind->set_los_status(alarm_status_to_string(onu_alarms->losi));
+ /* TODO: need to set lofi and loami
+ onu_alarm_ind->set_lof_status(alarm_status_to_string(onu_alarms->lofi));
+ onu_alarm_ind->set_loami_status(alarm_status_to_string(
+ onu_alarms->loami));
+ */
+ alarm_ind->set_allocated_onu_alarm_ind(onu_alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ break;
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuDyingGaspIndication(bcmbal_obj *obj) {
+static void OnuDyingGaspIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
- openolt::DyingGaspIndication* dg_ind = new openolt::DyingGaspIndication;
+ openolt::DyingGaspIndication* dgi_ind = new openolt::DyingGaspIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_dgi*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_DGI:
+ {
+ bcmolt_onu_dgi_data* dgi_data = (bcmolt_onu_dgi_data *)msg;
+ dgi_ind->set_status(alarm_status_to_string(dgi_data->alarm_status));
- bcmbal_subscriber_terminal_dgi_data *data =
- &(((bcmbal_subscriber_terminal_dgi*)obj)->data);
-
-
- BCM_LOG(WARNING, openolt_log_id, "onu dying-gasp indication, intf_id %d, onu_id %d, alarm %d\n",
- key->intf_id, key->sub_term_id, data->dgi_status);
-
- dg_ind->set_intf_id(key->intf_id);
- dg_ind->set_onu_id(key->sub_term_id);
- dg_ind->set_status(alarm_status_to_string(data->dgi_status));
-
- alarm_ind->set_allocated_dying_gasp_ind(dg_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ alarm_ind->set_allocated_dying_gasp_ind(dgi_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ break;
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuDiscoveryIndication(bcmbal_cfg *obj) {
+static void OnuDiscoveryIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::OnuDiscIndication* onu_disc_ind = new openolt::OnuDiscIndication;
openolt::SerialNumber* serial_number = new openolt::SerialNumber;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_PON_INTERFACE:
+ switch (msg->subgroup) {
+ case BCMOLT_PON_INTERFACE_AUTO_SUBGROUP_ONU_DISCOVERED:
+ {
+ bcmolt_pon_interface_key *key =
+ &((bcmolt_pon_interface_onu_discovered *)msg)->key;
- bcmbal_subscriber_terminal_sub_term_disc_data *data =
- &(((bcmbal_subscriber_terminal_sub_term_disc*)obj)->data);
+ bcmolt_pon_interface_onu_discovered_data *data =
+ &((bcmolt_pon_interface_onu_discovered *)msg)->data;
- bcmbal_serial_number *in_serial_number = &(data->serial_number);
+ bcmolt_serial_number *in_serial_number = &(data->serial_number);
- BCM_LOG(INFO, openolt_log_id, "onu discover indication, intf_id %d, serial_number %s\n",
- key->intf_id, serial_number_to_str(in_serial_number).c_str());
+ BCM_LOG(INFO, openolt_log_id, "onu discover indication, pon_ni %d, serial_number %s\n",
+ key->pon_ni, serial_number_to_str(in_serial_number).c_str());
- onu_disc_ind->set_intf_id(key->intf_id);
- serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id), 4);
- serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific), 8);
- onu_disc_ind->set_allocated_serial_number(serial_number);
- ind.set_allocated_onu_disc_ind(onu_disc_ind);
+ onu_disc_ind->set_intf_id(key->pon_ni);
+ serial_number->set_vendor_id(reinterpret_cast<const char *>(in_serial_number->vendor_id.arr), 4);
+ serial_number->set_vendor_specific(reinterpret_cast<const char *>(in_serial_number->vendor_specific.arr), 8);
+ onu_disc_ind->set_allocated_serial_number(serial_number);
+ ind.set_allocated_onu_disc_ind(onu_disc_ind);
+ break;
+ }
+ }
+ }
oltIndQ.push(ind);
-
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuIndication(bcmbal_obj *obj) {
+static void OnuIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_STATE_CHANGE:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_state_change*)msg)->key;
+ bcmolt_onu_state_change_data *data = &((bcmolt_onu_state_change*)msg)->data;
- bcmbal_subscriber_terminal_oper_status_change_data *data =
- &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
+ BCM_LOG(INFO, openolt_log_id, "onu indication, pon_ni %d, onu_id %d, onu_state %d\n", key->pon_ni, key->onu_id, data->new_onu_state);
- BCM_LOG(INFO, openolt_log_id, "onu indication, intf_id %d, onu_id %d, oper_state %d, admin_state %d\n",
- key->intf_id, key->sub_term_id, data->new_oper_status, data->admin_state);
+ onu_ind->set_intf_id(key->pon_ni);
+ onu_ind->set_onu_id(key->onu_id);
+ if (ONU_STATE_IF_UP(data->new_onu_state))
+ onu_ind->set_oper_state("up");
+ if (ONU_STATE_IF_DOWN(data->new_onu_state))
+ onu_ind->set_oper_state("down");
- onu_ind->set_intf_id(key->intf_id);
- onu_ind->set_onu_id(key->sub_term_id);
- if (data->new_oper_status == BCMBAL_STATUS_UP) {
- onu_ind->set_oper_state("up");
- } else {
- onu_ind->set_oper_state("down");
+ ind.set_allocated_onu_ind(onu_ind);
+ }
+ }
}
- if (data->admin_state == BCMBAL_STATE_UP) {
- onu_ind->set_admin_state("up");
- } else {
- onu_ind->set_admin_state("down");
- }
-
- ind.set_allocated_onu_ind(onu_ind);
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuOperIndication(bcmbal_obj *obj) {
+static void OnuOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::OnuIndication* onu_ind = new openolt::OnuIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_STATE_CHANGE:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_state_change*)msg)->key;
+ bcmolt_onu_state_change_data *data = &((bcmolt_onu_state_change*)msg)->data;
- bcmbal_subscriber_terminal_oper_status_change_data *data =
- &(((bcmbal_subscriber_terminal_oper_status_change*)obj)->data);
+ onu_ind->set_intf_id(key->pon_ni);
+ onu_ind->set_onu_id(key->onu_id);
+ if (ONU_STATE_IF_UP(data->new_onu_state))
+ onu_ind->set_oper_state("up");
+ if (ONU_STATE_IF_DOWN(data->new_onu_state))
+ onu_ind->set_oper_state("down");
+ ind.set_allocated_onu_ind(onu_ind);
- onu_ind->set_intf_id(key->intf_id);
- onu_ind->set_onu_id(key->sub_term_id);
- if (data->new_oper_status == BCMBAL_STATUS_UP) {
- onu_ind->set_oper_state("up");
- } else {
- onu_ind->set_oper_state("down");
+ BCM_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s\n",
+ key->pon_ni, key->onu_id, data->new_onu_state, onu_ind->oper_state().c_str());
+ }
+ }
}
- if (data->admin_state == BCMBAL_STATE_UP) {
- onu_ind->set_admin_state("up");
- } else {
- onu_ind->set_admin_state("down");
- }
-
- ind.set_allocated_onu_ind(onu_ind);
-
- BCM_LOG(INFO, openolt_log_id, "onu oper state indication, intf_id %d, onu_id %d, old oper state %d, new oper state %s, admin_state %s\n",
- key->intf_id, key->sub_term_id, data->old_oper_status, onu_ind->oper_state().c_str(), onu_ind->admin_state().c_str());
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OmciIndication(bcmbal_obj *obj) {
+static void OmciIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::OmciIndication* omci_ind = new openolt::OmciIndication;
- bcmbal_packet_itu_omci_channel_rx *in =
- (bcmbal_packet_itu_omci_channel_rx *)obj;
- BCM_LOG(DEBUG, omci_log_id, "OMCI indication: intf_id %d, onu_id %d\n",
- in->key.packet_send_dest.u.itu_omci_channel.intf_id,
- in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_OMCI_PACKET:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_omci_packet*)msg)->key;
+ bcmolt_onu_omci_packet_data *data = &((bcmolt_onu_omci_packet*)msg)->data;
- omci_ind->set_intf_id(in->key.packet_send_dest.u.itu_omci_channel.intf_id);
- omci_ind->set_onu_id(in->key.packet_send_dest.u.itu_omci_channel.sub_term_id);
- omci_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
+ BCM_LOG(DEBUG, omci_log_id, "OMCI indication: pon_ni %d, onu_id %d\n",
+ key->pon_ni, key->onu_id);
- ind.set_allocated_omci_ind(omci_ind);
+ omci_ind->set_intf_id(key->pon_ni);
+ omci_ind->set_onu_id(key->onu_id);
+ omci_ind->set_pkt(data->buffer.arr, data->buffer.len);
+
+ ind.set_allocated_omci_ind(omci_ind);
+ break;
+ }
+ }
+ }
+
oltIndQ.push(ind);
-
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno PacketIndication(bcmbal_obj *obj) {
+static void PacketIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::PacketIndication* pkt_ind = new openolt::PacketIndication;
- bcmbal_packet_bearer_channel_rx *in = (bcmbal_packet_bearer_channel_rx *)obj;
- uint32_t port_no = GetPortNum_(in->data.flow_id);
- pkt_ind->set_intf_type(bcmbal_to_grpc_intf_type(in->data.intf_type));
- pkt_ind->set_intf_id(in->data.intf_id);
- pkt_ind->set_gemport_id(in->data.svc_port);
- pkt_ind->set_flow_id(in->data.flow_id);
- pkt_ind->set_pkt(in->data.pkt.val, in->data.pkt.len);
- pkt_ind->set_port_no(port_no);
- pkt_ind->set_cookie(in->data.flow_cookie);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_FLOW_AUTO_SUBGROUP_RECEIVE_ETH_PACKET:
+ {
+ bcmolt_flow_key *key = &((bcmolt_flow_cfg*)msg)->key;
+ bcmolt_flow_cfg_data *data = &((bcmolt_flow_cfg*)msg)->data;
+ bcmolt_flow_receive_eth_packet_data *pkt_data =
+ &((bcmolt_flow_receive_eth_packet*)msg)->data;
- ind.set_allocated_pkt_ind(pkt_ind);
+ uint32_t port_no = GetPortNum_(key->flow_id);
+ pkt_ind->set_intf_type(bcmbal_to_grpc_intf_type((bcmolt_interface_type)data->ingress_intf.intf_type));
+ pkt_ind->set_intf_id(data->ingress_intf.intf_id);
+ pkt_ind->set_gemport_id(data->svc_port_id);
+ pkt_ind->set_flow_id(key->flow_id);
+ pkt_ind->set_pkt(pkt_data->buffer.arr, pkt_data->buffer.len);
+ pkt_ind->set_port_no(port_no);
+ pkt_ind->set_cookie(data->cookie);
+ ind.set_allocated_pkt_ind(pkt_ind);
- BCM_LOG(INFO, openolt_log_id, "packet indication, intf_type %s, intf_id %d, svc_port %d, flow_id %d port_no %d cookie %llu\n",
- pkt_ind->intf_type().c_str(), in->data.intf_id, in->data.svc_port, in->data.flow_id, port_no, in->data.flow_cookie);
+ BCM_LOG(INFO, openolt_log_id, "packet indication, intf_type %s, intf_id %d, svc_port %d, flow_id %d port_no %d cookie %lu\n",
+ pkt_ind->intf_type().c_str(), data->ingress_intf.intf_id, data->svc_port_id, key->flow_id, port_no, data->cookie);
+ }
+ }
+ }
oltIndQ.push(ind);
-
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno FlowOperIndication(bcmbal_obj *obj) {
+static void FlowOperIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
BCM_LOG(DEBUG, openolt_log_id, "flow oper state indication\n");
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno FlowIndication(bcmbal_obj *obj) {
+static void FlowIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
BCM_LOG(DEBUG, openolt_log_id, "flow indication\n");
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno TmQIndication(bcmbal_obj *obj) {
+static void TmQIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt queue indication\n");
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno TmSchedIndication(bcmbal_obj *obj) {
+static void TmSchedIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
BCM_LOG(DEBUG, openolt_log_id, "traffic mgmt sheduler indication\n");
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno McastGroupIndication(bcmbal_obj *obj) {
+static void McastGroupIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
BCM_LOG(DEBUG, openolt_log_id, "mcast group indication\n");
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuStartupFailureIndication(bcmbal_obj *obj) {
+static void OnuStartupFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuStartupFailureIndication* sufi_ind = new openolt::OnuStartupFailureIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_sufi*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_SUFI:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_sufi*)msg)->key;
+ bcmolt_onu_sufi_data *data = &((bcmolt_onu_sufi*)msg)->data;
- bcmbal_subscriber_terminal_sufi_data *data =
- &(((bcmbal_subscriber_terminal_sufi*)obj)->data);
+ BCM_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n",
+ key->pon_ni, key->onu_id, data->alarm_status);
- BCM_LOG(WARNING, openolt_log_id, "onu startup failure indication, intf_id %d, onu_id %d, alarm %d\n",
- key->intf_id, key->sub_term_id, data->sufi_status);
+ sufi_ind->set_intf_id(key->pon_ni);
+ sufi_ind->set_onu_id(key->onu_id);
+ sufi_ind->set_status(alarm_status_to_string(data->alarm_status));
+ alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind);
- sufi_ind->set_intf_id(key->intf_id);
- sufi_ind->set_onu_id(key->sub_term_id);
- sufi_ind->set_status(alarm_status_to_string(data->sufi_status));
-
- alarm_ind->set_allocated_onu_startup_fail_ind(sufi_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuSignalDegradeIndication(bcmbal_obj *obj) {
+static void OnuSignalDegradeIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuSignalDegradeIndication* sdi_ind = new openolt::OnuSignalDegradeIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_sdi*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_SDI:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_sdi*)msg)->key;
+ bcmolt_onu_sdi_data *data = &((bcmolt_onu_sdi*)msg)->data;
- bcmbal_subscriber_terminal_sdi_data *data =
- &(((bcmbal_subscriber_terminal_sdi*)obj)->data);
+ BCM_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
+ key->pon_ni, key->onu_id, data->alarm_status, data->ber);
- BCM_LOG(WARNING, openolt_log_id, "onu signal degrade indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
- key->intf_id, key->sub_term_id, data->sdi_status, data->ber);
+ sdi_ind->set_intf_id(key->pon_ni);
+ sdi_ind->set_onu_id(key->onu_id);
+ sdi_ind->set_status(alarm_status_to_string(data->alarm_status));
+ sdi_ind->set_inverse_bit_error_rate(data->ber);
+ alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind);
- sdi_ind->set_intf_id(key->intf_id);
- sdi_ind->set_onu_id(key->sub_term_id);
- sdi_ind->set_status(alarm_status_to_string(data->sdi_status));
- sdi_ind->set_inverse_bit_error_rate(data->ber);
-
- alarm_ind->set_allocated_onu_signal_degrade_ind(sdi_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuDriftOfWindowIndication(bcmbal_obj *obj) {
+static void OnuDriftOfWindowIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuDriftOfWindowIndication* dowi_ind = new openolt::OnuDriftOfWindowIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_dowi*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_DOWI:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_dowi*)msg)->key;
+ bcmolt_onu_dowi_data *data = &((bcmolt_onu_dowi*)msg)->data;
- bcmbal_subscriber_terminal_dowi_data *data =
- &(((bcmbal_subscriber_terminal_dowi*)obj)->data);
+ BCM_LOG(WARNING, openolt_log_id, "onu drift of window indication, intf_id %d, onu_id %d, alarm %d, drift %d, new_eqd %d\n",
+ key->pon_ni, key->onu_id, data->alarm_status, data->drift_value, data->new_eqd);
- BCM_LOG(WARNING, openolt_log_id, "onu drift of window indication, intf_id %d, onu_id %d, alarm %d, drift %d, new_eqd %d\n",
- key->intf_id, key->sub_term_id, data->dowi_status, data->drift_value, data->new_eqd);
+ dowi_ind->set_intf_id(key->pon_ni);
+ dowi_ind->set_onu_id(key->onu_id);
+ dowi_ind->set_status(alarm_status_to_string(data->alarm_status));
+ dowi_ind->set_drift(data->drift_value);
+ dowi_ind->set_new_eqd(data->new_eqd);
+ alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind);
- dowi_ind->set_intf_id(key->intf_id);
- dowi_ind->set_onu_id(key->sub_term_id);
- dowi_ind->set_status(alarm_status_to_string(data->dowi_status));
- dowi_ind->set_drift(data->drift_value);
- dowi_ind->set_new_eqd(data->new_eqd);
-
- alarm_ind->set_allocated_onu_drift_of_window_ind(dowi_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuLossOfOmciChannelIndication(bcmbal_obj *obj) {
+static void OnuLossOfOmciChannelIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuLossOfOmciChannelIndication* looci_ind = new openolt::OnuLossOfOmciChannelIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_looci*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_LOOCI:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_looci*)msg)->key;
+ bcmolt_onu_looci_data *data = &((bcmolt_onu_looci*)msg)->data;
- bcmbal_subscriber_terminal_looci_data *data =
- &(((bcmbal_subscriber_terminal_looci*)obj)->data);
+ BCM_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n",
+ key->pon_ni, key->onu_id, data->alarm_status);
- BCM_LOG(WARNING, openolt_log_id, "onu loss of OMCI channel indication, intf_id %d, onu_id %d, alarm %d\n",
- key->intf_id, key->sub_term_id, data->looci_status);
+ looci_ind->set_intf_id(key->pon_ni);
+ looci_ind->set_onu_id(key->onu_id);
+ looci_ind->set_status(alarm_status_to_string(data->alarm_status));
+ alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind);
- looci_ind->set_intf_id(key->intf_id);
- looci_ind->set_onu_id(key->sub_term_id);
- looci_ind->set_status(alarm_status_to_string(data->looci_status));
-
- alarm_ind->set_allocated_onu_loss_omci_ind(looci_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuSignalsFailureIndication(bcmbal_obj *obj) {
+static void OnuSignalsFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuSignalsFailureIndication* sfi_ind = new openolt::OnuSignalsFailureIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_sfi*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_SFI:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_sfi*)msg)->key;
+ bcmolt_onu_sfi_data *data = &((bcmolt_onu_sfi*)msg)->data;
- bcmbal_subscriber_terminal_sfi_data *data =
- &(((bcmbal_subscriber_terminal_sfi*)obj)->data);
-
- BCM_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
- key->intf_id, key->sub_term_id, data->sfi_status, data->ber);
+ BCM_LOG(WARNING, openolt_log_id, "onu signals failure indication, intf_id %d, onu_id %d, alarm %d, BER %d\n",
+ key->pon_ni, key->onu_id, data->alarm_status, data->ber);
- sfi_ind->set_intf_id(key->intf_id);
- sfi_ind->set_onu_id(key->sub_term_id);
- sfi_ind->set_status(alarm_status_to_string(data->sfi_status));
- sfi_ind->set_inverse_bit_error_rate(data->ber);
+ sfi_ind->set_intf_id(key->pon_ni);
+ sfi_ind->set_onu_id(key->onu_id);
+ sfi_ind->set_status(alarm_status_to_string(data->alarm_status));
+ sfi_ind->set_inverse_bit_error_rate(data->ber);
+ alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind);
- alarm_ind->set_allocated_onu_signals_fail_ind(sfi_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuTransmissionInterferenceWarningIndication(bcmbal_obj *obj) {
+static void OnuTransmissionInterferenceWarningIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuTransmissionInterferenceWarning* tiwi_ind = new openolt::OnuTransmissionInterferenceWarning;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_tiwi*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_TIWI:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_tiwi*)msg)->key;
+ bcmolt_onu_tiwi_data *data = &((bcmolt_onu_tiwi*)msg)->data;
- bcmbal_subscriber_terminal_tiwi_data *data =
- &(((bcmbal_subscriber_terminal_tiwi*)obj)->data);
+ BCM_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n",
+ key->pon_ni, key->onu_id, data->alarm_status, data->drift_value);
- BCM_LOG(WARNING, openolt_log_id, "onu transmission interference warning indication, intf_id %d, onu_id %d, alarm %d, drift %d\n",
- key->intf_id, key->sub_term_id, data->tiwi_status, data->drift_value);
+ tiwi_ind->set_intf_id(key->pon_ni);
+ tiwi_ind->set_onu_id(key->onu_id);
+ tiwi_ind->set_status(alarm_status_to_string(data->alarm_status));
+ tiwi_ind->set_drift(data->drift_value);
+ alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind);
- tiwi_ind->set_intf_id(key->intf_id);
- tiwi_ind->set_onu_id(key->sub_term_id);
- tiwi_ind->set_status(alarm_status_to_string(data->tiwi_status));
- tiwi_ind->set_drift(data->drift_value);
-
- alarm_ind->set_allocated_onu_tiwi_ind(tiwi_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
-bcmos_errno OnuActivationFailureIndication(bcmbal_obj *obj) {
+static void OnuActivationFailureIndication(bcmolt_devid olt, bcmolt_msg *msg) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
openolt::OnuActivationFailureIndication* activation_fail_ind = new openolt::OnuActivationFailureIndication;
- bcmbal_subscriber_terminal_key *key =
- &(((bcmbal_subscriber_terminal_sub_term_act_fail*)obj)->key);
+ switch (msg->obj_type) {
+ case BCMOLT_OBJ_ID_ONU:
+ switch (msg->subgroup) {
+ case BCMOLT_ONU_AUTO_SUBGROUP_ONU_ACTIVATION_COMPLETED:
+ {
+ bcmolt_onu_key *key = &((bcmolt_onu_onu_activation_completed*)msg)->key;
+ bcmolt_onu_onu_activation_completed_data *data =
+ &((bcmolt_onu_onu_activation_completed*)msg)->data;
- BCM_LOG(WARNING, openolt_log_id, "onu activation failure indication, intf_id %d, onu_id %d\n",
- key->intf_id, key->sub_term_id);
+ BCM_LOG(WARNING, openolt_log_id, "onu activation failure indication, intf_id %d, onu_id %d, fail_reason %d\n",
+ key->pon_ni, key->onu_id, data->fail_reason);
+ activation_fail_ind->set_intf_id(key->pon_ni);
+ activation_fail_ind->set_onu_id(key->onu_id);
+ alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
- activation_fail_ind->set_intf_id(key->intf_id);
- activation_fail_ind->set_onu_id(key->sub_term_id);
-
- alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
- ind.set_allocated_alarm_ind(alarm_ind);
+ ind.set_allocated_alarm_ind(alarm_ind);
+ }
+ }
+ }
oltIndQ.push(ind);
- return BCM_ERR_OK;
+ bcmolt_msg_free(msg);
}
+/* removed by BAL v3.0
bcmos_errno OnuProcessingErrorIndication(bcmbal_obj *obj) {
openolt::Indication ind;
openolt::AlarmIndication* alarm_ind = new openolt::AlarmIndication;
@@ -611,226 +757,204 @@
oltIndQ.push(ind);
return BCM_ERR_OK;
}
+*/
Status SubscribeIndication() {
- bcmbal_cb_cfg cb_cfg = {};
- uint16_t ind_subgroup;
+ bcmolt_rx_cfg rx_cfg = {};
+ bcmos_errno rc;
if (subscribed) {
return Status::OK;
}
- cb_cfg.module = BCMOS_MODULE_ID_NONE;
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
+ rx_cfg.rx_cb = OltOperIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_complete;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "Olt connection complete state indication subscribe failed");
- /* OLT device operational state change indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
- ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OltOperIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Olt operations state change indication subscribe failed");
- }
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
+ rx_cfg.rx_cb = OltOperIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_device_auto_subgroup_disconnection_complete;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "Olt disconnection complete state indication subscribe failed");
+
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_DEVICE;
+ rx_cfg.rx_cb = OltOperIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_device_auto_subgroup_connection_failure;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "Olt connection failure state indication subscribe failed");
/* Interface LOS indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
- ind_subgroup = bcmbal_interface_auto_id_los;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)LosIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
+ rx_cfg.rx_cb = LosIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_los;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "LOS indication subscribe failed");
- }
- /* Interface indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
- ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Interface indication subscribe failed");
- }
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
+ rx_cfg.rx_cb = IfOperIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "PON Interface operations state change indication subscribe failed");
- /* Interface operational state change indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
- ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)IfOperIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Interface operations state change indication subscribe failed");
- }
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
+ rx_cfg.rx_cb = IfIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_state_change_completed;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL, "PON Interface indication subscribe failed");
- /* onu alarm indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuAlarmIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE;
+ rx_cfg.rx_cb = IfOperIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "NNI Interface operations state change indication subscribe failed");
+
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_NNI_INTERFACE;
+ rx_cfg.rx_cb = IfIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_nni_interface_auto_subgroup_state_change;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL, "NNI Interface indication subscribe failed");
+
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuAlarmIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_xgpon_alarm;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
- }
- /* onu dying-gasp indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDyingGaspIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuAlarmIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_gpon_alarm;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL, "onu alarm indication subscribe failed");
+
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuDyingGaspIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dgi;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu dying-gasp indication subscribe failed");
- }
- /* onu discovery indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDiscoveryIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_PON_INTERFACE;
+ rx_cfg.rx_cb = OnuDiscoveryIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_pon_interface_auto_subgroup_onu_discovered;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu discovery indication subscribe failed");
- }
- /* onu indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_state_change;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu indication subscribe failed");
- }
- /* onu operational state change indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuOperIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "onu operational state change indication subscribe failed");
- }
- /* Packet (bearer) indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
- ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)PacketIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
- }
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuOperIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_state_change;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "onu operational state change indication subscribe failed");
- /* Flow Operational State Change */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
- ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowOperIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Flow operational state change indication subscribe failed");
- }
-#if 0
- /* Flow Indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
- ind_subgroup = bcmbal_flow_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)FlowIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Flow indication subscribe failed");
- }
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuStartupFailureIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sufi;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "onu startup failure indication subscribe failed");
- /* TM queue indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE;
- ind_subgroup = bcmbal_tm_queue_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmQIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
- }
-#endif
-
- /* TM sched indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
- ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)TmSchedIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Traffic mgmt queue indication subscribe failed");
- }
-
-#if 0
- /* Multicast group indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP;
- ind_subgroup = bcmbal_group_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)McastGroupIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "Multicast group indication subscribe failed");
- }
-#endif
-
-
- /* ONU startup failure indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuStartupFailureIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "onu startup failure indication subscribe failed");
- }
-
- /* SDI indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalDegradeIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuSignalDegradeIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sdi;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu sdi indication subscribe failed");
- }
- /* DOWI indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuDriftOfWindowIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuDriftOfWindowIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_dowi;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu dowi indication subscribe failed");
- }
/* LOOCI indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuLossOfOmciChannelIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuLossOfOmciChannelIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_looci;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu looci indication subscribe failed");
- }
/* SFI indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuSignalsFailureIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuSignalsFailureIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_sfi;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu sfi indication subscribe failed");
- }
/* TIWI indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuTransmissionInterferenceWarningIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuTransmissionInterferenceWarningIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_tiwi;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
return Status(grpc::StatusCode::INTERNAL, "onu tiwi indication subscribe failed");
- }
+
+ /* ONU Activation Failure Indiction */
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_ONU;
+ rx_cfg.rx_cb = OnuActivationFailureIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_onu_auto_subgroup_onu_activation_completed;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL,
+ "onu activation falaire indication subscribe failed");
- /* TIWI indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuActivationFailureIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "onu activation falaire indication subscribe failed");
- }
-
- /* ONU processing error indication */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error;
- cb_cfg.p_subgroup = &ind_subgroup;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)OnuProcessingErrorIndication;
- if (BCM_ERR_OK != bcmbal_subscribe_ind(DEFAULT_ATERM_ID, &cb_cfg)) {
- return Status(grpc::StatusCode::INTERNAL, "onu processing error indication subscribe failed");
- }
+ rx_cfg.obj_type = BCMOLT_OBJ_ID_FLOW;
+ rx_cfg.rx_cb = PacketIndication;
+ rx_cfg.flags = BCMOLT_AUTO_FLAGS_NONE;
+ rx_cfg.subgroup = bcmolt_flow_auto_subgroup_receive_eth_packet;
+ rc = bcmolt_ind_subscribe(current_device, &rx_cfg);
+ if(rc != BCM_ERR_OK)
+ return Status(grpc::StatusCode::INTERNAL, "Packet indication subscribe failed");
subscribed = true;
diff --git a/agent/src/stats_collection.cc b/agent/src/stats_collection.cc
index 7bdde4c..e2b3d09 100644
--- a/agent/src/stats_collection.cc
+++ b/agent/src/stats_collection.cc
@@ -27,18 +27,18 @@
extern "C"
{
#include <bcmos_system.h>
-#include <bal_api.h>
-#include <bal_api_end.h>
-#include <flow_fsm.h>
+#include <bcmolt_api.h>
+#include <bcmolt_api_model_api_structs.h>
}
//FIXME
#define FLOWS_COUNT 100
-bcmbal_flow_key* flows_keys = new bcmbal_flow_key[FLOWS_COUNT];
+bcmolt_flow_key* flows_keys = new bcmolt_flow_key[FLOWS_COUNT];
+bcmolt_odid device_id = 0;
void init_stats() {
- memset(flows_keys, 0, FLOWS_COUNT * sizeof(bcmbal_flow_key));
+ memset(flows_keys, 0, FLOWS_COUNT * sizeof(bcmolt_flow_key));
}
openolt::PortStatistics* get_default_port_statistics() {
@@ -75,46 +75,105 @@
}
#endif
-openolt::PortStatistics* collectPortStatistics(bcmbal_interface_key key) {
+openolt::PortStatistics* collectPortStatistics(bcmolt_intf_ref intf_ref) {
bcmos_errno err;
- bcmbal_interface_stat stat; /**< declare main API struct */
- bcmos_bool clear_on_read = false;
+ bcmolt_stat_flags clear_on_read = BCMOLT_STAT_FLAGS_NONE;
+ bcmolt_nni_interface_stats nni_stats;
+ bcmolt_onu_itu_pon_stats pon_stats;
+ bcmolt_pon_interface_itu_pon_stats itu_pon_stats;
openolt::PortStatistics* port_stats = get_default_port_statistics();
- /* init the API struct */
- BCMBAL_STAT_INIT(&stat, interface, key);
- BCMBAL_STAT_PROP_GET(&stat, interface, all_properties);
+ switch (intf_ref.intf_type) {
+ case BCMOLT_INTERFACE_TYPE_NNI:
+ {
+ bcmolt_nni_interface_key nni_intf_key;
+ nni_intf_key.id = intf_ref.intf_id;
+ /* init the API struct */
+ BCMOLT_STAT_INIT(&nni_stats, nni_interface, stats, nni_intf_key);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, rx_bytes);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, rx_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, rx_ucast_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, rx_mcast_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, rx_bcast_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, rx_error_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, tx_bytes);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, tx_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, tx_ucast_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, tx_mcast_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, tx_bcast_packets);
+ BCMOLT_MSG_FIELD_GET(&nni_stats, tx_error_packets);
- /* call API */
- err = bcmbal_stat_get(DEFAULT_ATERM_ID, &stat.hdr, clear_on_read);
- if (err == BCM_ERR_OK)
- {
- //std::cout << "Interface statistics retrieved"
- // << " intf_id:" << intf_id << std::endl;
+ /* call API */
+ err = bcmolt_stat_get((bcmolt_oltid)device_id, &nni_stats.hdr, clear_on_read);
+ if (err == BCM_ERR_OK)
+ {
+ //std::cout << "Interface statistics retrieved"
+ // << " intf_id:" << intf_id << std::endl;
+
+ port_stats->set_rx_bytes(nni_stats.data.rx_bytes);
+ port_stats->set_rx_packets(nni_stats.data.rx_packets);
+ port_stats->set_rx_ucast_packets(nni_stats.data.rx_ucast_packets);
+ port_stats->set_rx_mcast_packets(nni_stats.data.rx_mcast_packets);
+ port_stats->set_rx_bcast_packets(nni_stats.data.rx_bcast_packets);
+ port_stats->set_rx_error_packets(nni_stats.data.rx_error_packets);
+ port_stats->set_tx_bytes(nni_stats.data.tx_bytes);
+ port_stats->set_tx_packets(nni_stats.data.tx_packets);
+ port_stats->set_tx_ucast_packets(nni_stats.data.tx_ucast_packets);
+ port_stats->set_tx_mcast_packets(nni_stats.data.tx_mcast_packets);
+ port_stats->set_tx_bcast_packets(nni_stats.data.tx_bcast_packets);
+ port_stats->set_tx_error_packets(nni_stats.data.tx_error_packets);
+
+ } else {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d\n",
+ (int)intf_ref.intf_id, (int)intf_ref.intf_type);
+ }
+ break;
+ }
+ case BCMOLT_INTERFACE_TYPE_PON:
+ {
+ bcmolt_pon_interface_key key;
+ key.pon_ni = (bcmolt_interface)intf_ref.intf_id;
+ BCMOLT_STAT_INIT(&itu_pon_stats, pon_interface, itu_pon_stats, key);
+ BCMOLT_MSG_FIELD_GET(&itu_pon_stats, tx_packets);
+ BCMOLT_MSG_FIELD_GET(&itu_pon_stats, bip_errors);
+ BCMOLT_MSG_FIELD_GET(&itu_pon_stats, rx_crc_error);
- port_stats->set_rx_bytes(stat.data.rx_bytes);
- port_stats->set_rx_packets(stat.data.rx_packets);
- port_stats->set_rx_ucast_packets(stat.data.rx_ucast_packets);
- port_stats->set_rx_mcast_packets(stat.data.rx_mcast_packets);
- port_stats->set_rx_bcast_packets(stat.data.rx_bcast_packets);
- port_stats->set_rx_error_packets(stat.data.rx_error_packets);
- port_stats->set_tx_bytes(stat.data.tx_bytes);
- port_stats->set_tx_packets(stat.data.tx_packets);
- port_stats->set_tx_ucast_packets(stat.data.tx_ucast_packets);
- port_stats->set_tx_mcast_packets(stat.data.tx_mcast_packets);
- port_stats->set_tx_bcast_packets(stat.data.tx_bcast_packets);
- port_stats->set_tx_error_packets(stat.data.tx_error_packets);
- port_stats->set_rx_crc_errors(stat.data.rx_crc_errors);
- port_stats->set_bip_errors(stat.data.bip_errors);
+ /* call API */
+ err = bcmolt_stat_get((bcmolt_oltid)device_id, &itu_pon_stats.hdr, clear_on_read);
+ if (err == BCM_ERR_OK) {
+ port_stats->set_tx_packets(itu_pon_stats.data.tx_packets);
+ port_stats->set_bip_errors(itu_pon_stats.data.bip_errors);
+ port_stats->set_rx_crc_errors(itu_pon_stats.data.rx_crc_error);
+ } else {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d\n",
+ (int)intf_ref.intf_id, (int)intf_ref.intf_type);
+ }
+ {
+ bcmolt_onu_key key;
+ key.pon_ni = (bcmolt_interface)intf_ref.intf_id;
+ BCMOLT_MSG_FIELD_GET(&pon_stats, rx_bytes);
+ BCMOLT_MSG_FIELD_GET(&pon_stats, rx_packets);
+ BCMOLT_MSG_FIELD_GET(&pon_stats, tx_bytes);
+ BCMOLT_STAT_INIT(&pon_stats, onu, itu_pon_stats, key);
- } else {
- BCM_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d\n",
- (int)key.intf_id, (int)key.intf_type);
- }
+ /* call API */
+ err = bcmolt_stat_get((bcmolt_oltid)device_id, &pon_stats.hdr, clear_on_read);
+ if (err == BCM_ERR_OK) {
+ port_stats->set_rx_bytes(pon_stats.data.rx_bytes);
+ port_stats->set_rx_packets(pon_stats.data.rx_packets);
+ port_stats->set_tx_bytes(pon_stats.data.tx_bytes);
+ } else {
+ BCM_LOG(ERROR, openolt_log_id, "Failed to retrieve port statistics, intf_id %d, intf_type %d\n",
+ (int)intf_ref.intf_id, (int)intf_ref.intf_type);
+ }
+ }
+ break;
+ }
+ }
- port_stats->set_intf_id(interface_key_to_port_no(key));
+ port_stats->set_intf_id(interface_key_to_port_no((bcmolt_interface_id)intf_ref.intf_id, (bcmolt_interface_type)intf_ref.intf_type));
time_t now;
time(&now);
port_stats->set_timestamp((int)now);
@@ -182,11 +241,12 @@
//Uplink ports
for (int i = 0; i < NumNniIf_(); i++) {
- bcmbal_interface_key nni_interface;
- nni_interface.intf_type = BCMBAL_INTF_TYPE_NNI;
- nni_interface.intf_id = i;
+ bcmolt_intf_ref intf_ref;
+ intf_ref.intf_type = BCMOLT_INTERFACE_TYPE_NNI;
+ intf_ref.intf_id = i;
- openolt::PortStatistics* port_stats = collectPortStatistics(nni_interface);
+ openolt::PortStatistics* port_stats =
+ collectPortStatistics(intf_ref);
openolt::Indication ind;
ind.set_allocated_port_stats(port_stats);
@@ -194,11 +254,12 @@
}
//Pon ports
for (int i = 0; i < NumPonIf_(); i++) {
- bcmbal_interface_key pon_interface;
- pon_interface.intf_type = BCMBAL_INTF_TYPE_PON;
- pon_interface.intf_id = i;
+ bcmolt_intf_ref intf_ref;
+ intf_ref.intf_type = BCMOLT_INTERFACE_TYPE_PON;
+ intf_ref.intf_id = i;
- openolt::PortStatistics* port_stats = collectPortStatistics(pon_interface);
+ openolt::PortStatistics* port_stats =
+ collectPortStatistics(intf_ref);
openolt::Indication ind;
ind.set_allocated_port_stats(port_stats);
diff --git a/agent/src/stats_collection.h b/agent/src/stats_collection.h
index 743d0be..ab9f174 100644
--- a/agent/src/stats_collection.h
+++ b/agent/src/stats_collection.h
@@ -22,13 +22,13 @@
extern "C"
{
-#include <bal_model_types.h>
+#include <bcmolt_api_model_supporting_structs.h>
}
void init_stats();
void stop_collecting_statistics();
openolt::PortStatistics* get_default_port_statistics();
-openolt::PortStatistics* collectPortStatistics(bcmbal_interface_key key);
+openolt::PortStatistics* collectPortStatistics(bcmolt_interface_id intf_id, bcmolt_interface_type intf_type);
#if 0
openolt::FlowStatistics* get_default_flow_statistics();
openolt::FlowStatistics* collectFlowStatistics(bcmbal_flow_id flow_id, bcmbal_flow_type flow_type);
diff --git a/agent/src/translation.cc b/agent/src/translation.cc
index 3279acd..4a84385 100644
--- a/agent/src/translation.cc
+++ b/agent/src/translation.cc
@@ -17,23 +17,24 @@
#include "translation.h"
-int interface_key_to_port_no(bcmbal_interface_key key) {
- if (key.intf_type == BCMBAL_INTF_TYPE_NNI) {
- return (0x1 << 16) + key.intf_id;
+int interface_key_to_port_no(bcmolt_interface_id intf_id,
+ bcmolt_interface_type intf_type) {
+ if (intf_type == BCMOLT_INTERFACE_TYPE_NNI) {
+ return (0x1 << 16) + intf_id;
}
- if (key.intf_type == BCMBAL_INTF_TYPE_PON) {
- return (0x2 << 28) + key.intf_id;
+ if (intf_type == BCMOLT_INTERFACE_TYPE_PON) {
+ return (0x2 << 28) + intf_id;
}
- return key.intf_id;
+ return intf_id;
}
-std::string alarm_status_to_string(bcmbal_alarm_status status) {
+std::string alarm_status_to_string(bcmolt_status status) {
switch (status) {
- case BCMBAL_ALARM_STATUS_OFF:
+ case BCMOLT_STATUS_OFF:
return "off";
- case BCMBAL_ALARM_STATUS_ON:
+ case BCMOLT_STATUS_ON:
return "on";
- case BCMBAL_ALARM_STATUS_NO__CHANGE:
+ case BCMOLT_STATUS_NO_CHANGE:
return "no_change";
}
return "unknown";
diff --git a/agent/src/translation.h b/agent/src/translation.h
index 285eaf1..34fe69e 100644
--- a/agent/src/translation.h
+++ b/agent/src/translation.h
@@ -21,12 +21,11 @@
#include <string>
extern "C"
{
-#include <bal_model_types.h>
+#include <bcmolt_api_model_api_structs.h>
}
-int interface_key_to_port_no(bcmbal_interface_key key);
-std::string alarm_status_to_string(bcmbal_alarm_status status);
-
-
+int interface_key_to_port_no(bcmolt_interface_id intf_id,
+ bcmolt_interface_type intf_type);
+std::string alarm_status_to_string(bcmolt_status status);
#endif
diff --git a/agent/src/utils.cc b/agent/src/utils.cc
index 0ddff3f..d748ce3 100644
--- a/agent/src/utils.cc
+++ b/agent/src/utils.cc
@@ -17,23 +17,23 @@
#include "utils.h"
-std::string serial_number_to_str(bcmbal_serial_number* serial_number) {
+std::string serial_number_to_str(bcmolt_serial_number* serial_number) {
#define SERIAL_NUMBER_SIZE 12
char buff[SERIAL_NUMBER_SIZE+1];
sprintf(buff, "%c%c%c%c%1X%1X%1X%1X%1X%1X%1X%1X",
- serial_number->vendor_id[0],
- serial_number->vendor_id[1],
- serial_number->vendor_id[2],
- serial_number->vendor_id[3],
- serial_number->vendor_specific[0]>>4 & 0x0f,
- serial_number->vendor_specific[0] & 0x0f,
- serial_number->vendor_specific[1]>>4 & 0x0f,
- serial_number->vendor_specific[1] & 0x0f,
- serial_number->vendor_specific[2]>>4 & 0x0f,
- serial_number->vendor_specific[2] & 0x0f,
- serial_number->vendor_specific[3]>>4 & 0x0f,
- serial_number->vendor_specific[3] & 0x0f);
+ serial_number->vendor_id.arr[0],
+ serial_number->vendor_id.arr[1],
+ serial_number->vendor_id.arr[2],
+ serial_number->vendor_id.arr[3],
+ serial_number->vendor_specific.arr[0]>>4 & 0x0f,
+ serial_number->vendor_specific.arr[0] & 0x0f,
+ serial_number->vendor_specific.arr[1]>>4 & 0x0f,
+ serial_number->vendor_specific.arr[1] & 0x0f,
+ serial_number->vendor_specific.arr[2]>>4 & 0x0f,
+ serial_number->vendor_specific.arr[2] & 0x0f,
+ serial_number->vendor_specific.arr[3]>>4 & 0x0f,
+ serial_number->vendor_specific.arr[3] & 0x0f);
return buff;
}
diff --git a/agent/src/utils.h b/agent/src/utils.h
index 53f4a99..52c018a 100644
--- a/agent/src/utils.h
+++ b/agent/src/utils.h
@@ -23,11 +23,11 @@
extern "C"
{
#include <bcmos_system.h>
-#include <bal_api.h>
-#include <bal_api_end.h>
+#include <bcmolt_api.h>
+#include <bcmolt_api_model_supporting_structs.h>
}
-std::string serial_number_to_str(bcmbal_serial_number* serial_number);
+std::string serial_number_to_str(bcmolt_serial_number* serial_number);
std::string vendor_specific_to_str(const char* const serial_number);
#endif
diff --git a/protos/Makefile b/protos/Makefile
index aa5f8da..6ee661b 100644
--- a/protos/Makefile
+++ b/protos/Makefile
@@ -28,7 +28,7 @@
all: googleapis libopenoltapi.a
libopenoltapi.a: $(OBJS)
- ar ru $@ $^
+ ar cr $@ $^
ranlib $@
googleapis:
diff --git a/protos/openolt.proto b/protos/openolt.proto
index 9fa9566..81ae2df 100644
--- a/protos/openolt.proto
+++ b/protos/openolt.proto
@@ -269,6 +269,7 @@
message UplinkPacket {
fixed32 intf_id = 1;
bytes pkt = 2;
+ fixed32 flow_id = 3;
}
message DeviceInfo {