VOL-1236: BAL upgrade for 2.6 and support for Traffic Shaping
Change-Id: If12f914e5981b2eabfca90a70dbb0f0750a76c4b
diff --git a/src/Makefile b/src/Makefile
index dce86eb..a7a27e6 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,8 +4,8 @@
LIB=libEdgecoreDriver.a
-BRDCM_SRC=/home/asfvolt/shared/OpenNetworkLinux/bal_src_release_2.4.3.6/bal_release
-GRPC_C_PATH= /home/asfvolt/shared/OpenNetworkLinux/grpc-c/
+BRDCM_SRC=/home/asfvolt/shared/OpenNetworkLinux/bal_src_release/bal_release
+GRPC_C_PATH=/home/asfvolt/shared/OpenNetworkLinux/grpc-c
GRPC_C_INC= -I$(GRPC_C_PATH)/build/ \
-I$(GRPC_C_PATH)/build/examples/ \
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100755
index 0000000..c0980d6
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,78 @@
+bin_PROGRAMS = voltha_bal_driver
+
+.PHONY = brcm_lib
+
+HOSTPROG=yes
+
+voltha_bal_driver_SOURCES = \
+ voltha_bal_driver.c \
+ grpc-c.h \
+ bal_errno.grpc-c.h bal_indications.grpc-c.h bal_model_types.grpc-c.h \
+ bal_obj.grpc-c.h bal.grpc-c.h bal_model_ids.grpc-c.h \
+ bal_msg_type.grpc-c.h bal_osmsg.grpc-c.h asfvolt.grpc-c.h asfvolt16_driver.h \
+ bal.grpc-c.service.c \
+ bal_errno.grpc-c.c bal_indications.grpc-c.c \
+ bal_model_types.grpc-c.c bal_obj.grpc-c.c asfvolt.grpc-c.c \
+ bal_errno.grpc-c.service.c bal_indications.grpc-c.service.c \
+ bal_model_types.grpc-c.service.c bal_obj.grpc-c.service.c \
+ bal.grpc-c.c bal_model_ids.grpc-c.c \
+ bal_msg_type.grpc-c.c bal_osmsg.grpc-c.c \
+ bal_model_ids.grpc-c.service.c \
+ bal_msg_type.grpc-c.service.c bal_osmsg.grpc-c.service.c \
+ asfvolt.grpc-c.service.c
+
+replace:
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_obj.proto.h/bal_obj.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_model_types.proto.h/bal_model_types.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_errno.proto.h/bal_errno.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_msg_type.proto.h/bal_msg_type.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_osmsg.proto.h/bal_osmsg.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_model_ids.proto.h/bal_model_ids.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal.proto.h/bal.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/bal_indications.proto.h/bal_indications.grpc-c.h/g' {} + )
+$(shell find . -type f \( -name '*.h' -o -name '*.c' \) -a -exec sed -i -e 's/asfvolt.proto.h/asfvolt.grpc-c.h/g' {} + )
+
+autogen:
+ protoc -I ${srcdir} --grpc-c_out=. --plugin=protoc-gen-grpc-c=../compiler/protoc-gen-grpc-c ${srcdir}/bal_errno.proto ${srcdir}/bal_model_ids.proto ${srcdir}/bal_msg_type.proto ${srcdir}/bal_osmsg.proto ${srcdir}/bal_indications.proto ${srcdir}/bal_model_types.proto ${srcdir}/bal_obj.proto ${srcdir}/bal.proto ${srcdir}/asfvolt.proto $(replace)
+
+LDADD = \
+ ../lib/libgrpc-c.la \
+ /usr/local/lib/libgrpc.a \
+ /usr/local/lib/libgpr.a \
+ /usr/local/lib/libprotobuf-c.a \
+ -lssl \
+ -lcrypto \
+ -lz \
+ -lpthread
+
+EXTRA_voltha_bal_driver_DEPENDENCIES=$(EDGECORE_DRIV_LIB) $(BRCM_BAL_LIB)
+
+EDGECORE = /home/asfvolt/shared/OpenNetworkLinux/EdgeCore/driver-app
+BRCM_PATH = /home/asfvolt/shared/OpenNetworkLinux/bal_src_release_2.4.3.6/bal_release
+EDGECORE_DRIV_LIB=./libEdgecoreDriver.a
+BRCM_BAL_LIB=./libbal_api_dist.so
+
+LIBS = $(EDGECORE_DRIV_LIB) $(BRCM_BAL_LIB) -lrt -lm
+
+AM_CFLAGS = \
+ -I. \
+ -I${srcdir}/../lib/h/ \
+ -I${srcdir}/../third_party/protobuf-c \
+ -I${srcdir}/../third_party/grpc/include \
+ -I${EDGECORE}/.
+
+$(BRCM_BAL_LIB):
+ @cp $(BRCM_PATH)/3rdparty/maple/cur/asfvolt16/release/broadcom/libbal_api_dist.so .
+
+$(EDGECORE_DRIV_LIB):
+ @cd $(EDGECORE);make
+ @cp $(EDGECORE)/libEdgecoreDriver.a .
+
+edgecore_lib_clean:
+ @cd $(EDGECORE);make clean
+ @rm -f libEdgecoreDriver.a
+
+clean_all: edgecore_lib_clean clean
+
+all:voltha_bal_driver$(EXEEXT)
+
diff --git a/src/README.md b/src/README.md
deleted file mode 100644
index 55601b7..0000000
--- a/src/README.md
+++ /dev/null
@@ -1,172 +0,0 @@
-# ASFvOLT16 vOLTHA BAL DRIVER
-
-This is an executable (voltha_bal_driver), which will receive asfvolt16_olt adapter grpc-c messages and call the respective BAL API.
-It will send received responses/asynchronous indications from BAL running in the ASFvOLT16 to the asfvolt16_olt adapter in VOLTHA.
-This driver requires the Broadcom proprietary
-BAL/Maple SDK for the PON MAC and the Qumran switching SDK. These components are available from Broadcom.
-
-
-## GETTING STARTED
-
-The following **proprietary** components are required to build the voltha_bal_driver.
-Contact Dave Baron at Broadcom for details on accessing these files. dave.baronATbroadcomDOTcom Reference Case: CS3233745
-
-| Component | Version | Filename |
-| ------------- |-------- | ----- |
-| BAL/Maple SDK | 2.4.7.12 | SW-BCM68620_2_4_7_12.zip |
-| Qumran SDK | 6.5.7 | sdk-all-6.5.7.tar.gz |
-
-| Component | Filename |SHA1|
-| ------------- | ----- |---|
-| ASFvOLT16 BAL patch| ACCTON_BAL_2.4.7.12-V201712061142.patch | e2d2e7924cbc73e60d29262f4b905cbe982758ae |
-
-The following **open-source** components are required to build the voltha_bal_driver.
-
-| Component/Package | Version | Name | From | Git Repo|
-| ------------- |--------- | ----- | ---------| ----|
-| VOLTHA asfvolt16_olt adapter | voltha-1.1 | voltha | Opencord | git clone https://gerrit.opencord.org/voltha
-| ASFvOLT16 Driver | voltha-1.1 | asfvolt16-driver| Opencord | git clone https://gerrit.opencord.org/asfvolt16-driver
-
-## Open Network Linux
-This guide assumes that Open Network Linux (ONL) build environment for ASFvOLT16 has been installed
-and the build was successful. Refer to ONL build instructions
-[here](https://wiki.opencord.org/download/attachments/2556712/ONL_Build_Environment_Installation_Guide.pdf?api=v2).
-
-### Clone asfvolt16-driver repo
-
-```
-cd OpenNetworkLinux
-git clone https://gerrit.opencord.org/asfvolt16-driver
-```
-
-Build helper scripts are available in `asfvolt16-driver/scripts` to automate the steps for building BAL/Maple SDK and the `voltha_bal_driver`.
-
-| Helper Script | Purpose |
-| ------------- |---------|
-| asfvolt-bal-prepare.sh |Prepare BAL/Maple SDK build workspace (outside of docker)|
-| asfvolt-bal-buildall.sh |Build BAL/Maple SDK|
-| asfvolt-driver-build.sh |Build `voltha_bal_driver`|
-| asfvolt-driver-package.sh |Repackage BAL/Maple release with `voltha_bal_driver`|
-
-The helper scripts contain default shell variable values for component directory locations and file names for the build.
-
-### Prepare workspace for BAL
-
-Any of the following variables can be overridden to suit the local build environment.
-
-```
-ONL_TOPDIR=/aux/OpenNetworkLinux
-BALSRC_RELEASE=bal_src_release
-BALSRC_ZIPNAME=SW-BCM68620_2_4_7_12.zip
-SWISDK_TARNAME=sdk-all-6.5.7
-PATCH_FILENAME=ACCTON_BAL_2.4.7.12-V201712061142.patch
-BROADCOM_DOWNLOAD_DIR=/home/user/broadcom/download
-EDGECORE_DOWNLOAD_DIR=/home/user/edgecore/download
-```
-
-Prepare the BAL/Maple build workspace from *outside* of the docker environment. This allows access to network and device resources
-that may not be available in the docker.
-```
- > cd ${ONL_TOPDIR}
- > BROADCOM_DOWNLOAD_DIR=/aux/brcm_download EDGECORE_DOWNLOAD_DIR=/aux/brcm_download ./asfvolt16-driver/scripts/asfvolt-bal-prepare.sh
-```
-
-### Build BAL/Maple SDK
-
-All of the remaining steps are done *inside* the ONL build docker. Start ONL build docker workspace:
-```
- > docker/tools/onlbuilder -8 # enter the docker workspace
- > ./asfvolt16-driver/scripts/asfvolt-bal-buildall.sh
-```
-
-### Build `voltha_bal_driver`
-
-This step requires access to the voltha source tree so it can find the protobuf definitions used by the
-asfvolt16_olt adapter. Be sure to use matching version of the voltha tree because asfvolt16_olt adapter
-and the voltha_bal_driver need to share the same grpc protobuf definitions.
-
-```
-ONL_TOPDIR=/aux/OpenNetworkLinux
-MAKE_JOBS=4
-BALSRC_RELEASE=bal_src_release
-VOLTHA_TOPDIR=/home/<user>/voltha/incubator/voltha
-BALSRC_TOPDIR=/aux/OpenNetworkLinux/bal_src_release/bal_release
-ASFSRC_TOPDIR=/aux/OpenNetworkLinux/asfvolt16-driver/src
-DEVSIM_TOPDIR=/aux/OpenNetworkLinux/asfvolt16-driver/device_simulator
-PATCHF_TOPDIR=/aux/OpenNetworkLinux/asfvolt16-driver/patches
-```
-From the ONL build docker workspace:
-
-```
- > VOLTHA_TOPDIR=/home/<user>/voltha/incubator/voltha ./asfvolt16-driver/scripts/asfvolt-driver-build.sh
-```
-
-### Package `voltha_bal_driver` into BAL release tarball
-
-From the ONL build docker workspace:
-
-```
- > ./asfvolt16-driver/scripts/asfvolt-driver-package.sh
-```
-
-The tarball containing the packaged voltha_bal_driver can be found in ${ASFDRVR_PKGDIR}:
-
-```
- > ls ${ONL_TOPDIR}/asfdrvr-package-dir/
-asfvolt16-voltha-bal-<timestamp>.tgz broadcom opt
-```
-
-### Install `voltha_bal_driver` BAL release tarball
-
-Transfer BAL release tarball to ASFvOLT16:
-
-```
- > cp asfdrvr-package-dir/asfvolt16-voltha-bal-<timestamp>.tgz root@<ASFvOLT16_IP>:.
-```
-
-Install release tarball on ASFvOLT16:
-
-```
- > ssh root@<ASFvOLT16_IP>
- Enter passphrase for key '/home/kimk/.ssh/id_rsa':
- root@192.168.140.72's password: onl
- Last login: Tue Oct 24 11:00:48 2017 from 192.168.140.32
-
- root@localhost:~# ls
- asfvolt16-voltha-bal-201710231906.tgz
- root@localhost:~# cd /
- root@localhost:/# mv /broadcom /broadcom.prev
- root@localhost:/# mv /opt/bcm68620/ /opt/bcm68620.prev
- root@localhost:/# tar zxf ~/asfvolt16-voltha-bal-<timestamp>.tgz
- root@localhost:/# tail -5 /etc/rc.local # ensure rc.local has the following lines
- # By default this script does nothing.
-
- /opt/bcm68620/svk_init.sh
- /broadcom/voltha_init.sh
- exit 0
-
- root@localhost:/# shutdown -r now
-```
-
-USAGE:
- ./voltha_bal_driver "serverIP:port1" -C "serverIP:port2" -A "serverIP:port3"
- ./bal_core_dist -C "serverIP:port2" -A "serverIP:port3"
-
-NOTE: bal_core_dist is a broadcom executable
-
-CONTRIBUTING
- <TBD>
-
-VERSIONING
- <TBD>
-
-AUTHORS
- Radisys Adapter Team
-
-Licence
- <TBD>
-
-Acknowledgments
- <TBD>
-
-
diff --git a/src/asfvolt16_driver.c b/src/asfvolt16_driver.c
index 14cd505..3d824af 100755
--- a/src/asfvolt16_driver.c
+++ b/src/asfvolt16_driver.c
@@ -54,13 +54,33 @@
cb_cfg.module = BCMOS_MODULE_ID_NONE;
- /* Access Terminal Operational State Change */
+ /* Register to get indications for access terminal objects
+ */
cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_osc_indication_cb;
- ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
+
+
+ /* Access Terminal processing error */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_processing_error_indication_cb;
+ ind_subgroup = bcmbal_access_terminal_auto_id_processing_error;
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+ /* Register to get indication callbacks for flow objects
+ */
+ cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
+
+ /* Flow Operational State Change */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_osc_indication_cb;
+ ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Flow processing error */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_processing_error_indication_cb;
+ ind_subgroup = bcmbal_flow_auto_id_processing_error;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
/* Register to get indications for interface objects
*/
cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
@@ -71,52 +91,12 @@
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
- /* Interface Indication */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_indication_cb;
- ind_subgroup = bcmbal_interface_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
/* Interface Operational State Change */
cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_osc_indication_cb;
ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
- /* Register to get indications for subscriber terminal objects
- */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
-
- /* Subscriber Terminal Alarm */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_alarm_indication_cb;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
- /* Subscriber Terminal dgi */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_dgi_indication_cb;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
- /* Subscriber Terminal Discovery */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_disc_indication_cb;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
- /* Subscriber Terminal Indication */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_indication_cb;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
- /* Subscriber Terminal Operational State Change */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_osc_indication_cb;
- ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
/* Register to get indication callbacks for OMCI objects
*/
cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
@@ -132,6 +112,9 @@
ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx;
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ // On registering for OAM Channel Data, voltha_bal_driver crashes.
+ // This is not important/necessary right now, hence bypassing this.
#if 0
/* OAM Channel Data - oam response indication */
cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_oam_data_indication_cb;
@@ -139,45 +122,95 @@
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
#endif
- /* Register to get indication callbacks for flow objects
+
+ /* Register to get indications for subscriber terminal objects
*/
- cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
+ cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
- /* Flow Operational State Change */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_osc_indication_cb;
- ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
- /* Flow Indication */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_indication_cb;
- ind_subgroup = bcmbal_flow_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = bcmbal_subscribe_ind(access_term_id, &cb_cfg);
-
- /* Register to get indication callbacks for tm queue objects
- */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_tm_queue_indication_cb;
- ind_subgroup = bcmbal_tm_queue_auto_id_ind;
+ /* Subscriber Terminal dgi */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_dgi_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
- /* Register to get indication callbacks for tm sched objects
+ /* Subscriber Terminal dowi*/
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_dowi_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal looci*/
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_looci_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal Operational State Change */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_osc_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal processing error*/
+ cb_cfg.ind_cb_hdlr = \
+ (f_bcmbal_ind_handler)bal_sub_term_processing_error_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal sdi */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_sdi_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal sfi */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_sfi_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal activation fail */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_act_fail_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal Alarm */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_alarm_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal Discovery */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_disc_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal sufi */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_sufi_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Subscriber Terminal tiwi */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_tiwi_indication_cb;
+ ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi;
+ cb_cfg.p_subgroup = &ind_subgroup;
+ err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
+
+ /* Register to get indication callbacks for Tm Sched Objects
*/
cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_tm_sched_indication_cb;
- ind_subgroup = bcmbal_tm_sched_auto_id_ind;
+
+ /* TM Sched operation status change */
+ cb_cfg.ind_cb_hdlr = \
+ (f_bcmbal_ind_handler)bal_tm_sched_auto_id_oper_status_change_cb;
+ ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
- /* Register to get indication callbacks for group objects
- */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP;
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_group_indication_cb;
- ind_subgroup = bcmbal_group_auto_id_ind;
- cb_cfg.p_subgroup = &ind_subgroup;
- err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
return err;
}
@@ -208,17 +241,15 @@
ip_and_port = bal_init->voltha_adapter_ip_port;
ASFVOLT_LOG(ASFVOLT_DEBUG,"Received Adapter IP and Port from VOLTHA is %s",ip_and_port);
}
- char *argv[6];
+ char *argv[4];
/* Initialize BAL */
argv[1] = coreInfo->bal_core_arg1;
argv[2] = coreInfo->bal_core_ip_port;
- argv[3] = coreInfo->bal_core_arg2;
- argv[4] = coreInfo->bal_shared_lib_ip_port;
- int argc = 5;
+ int argc = 3;
client = grpc_c_client_init(ip_and_port, "bal_client", NULL);
/* Init BAL */
- err = bcmbal_apiend_init_all(argc, argv, NULL,3);
+ err = bcmbal_apiend_init_all(argc, argv, NULL, 3);
if(err != BCM_ERR_OK)
{
printf("\n Failed in bcmbal_init \n");
@@ -236,26 +267,26 @@
}
#endif
- /* Register the call back functions to handle any
- * indications from the BAL */
- bcmbal_cb_cfg cb_cfg = {};
- uint16_t ind_subgroup;
+ /* Register the call back functions to handle access term oper change
+ * indications from the BAL */
+ bcmbal_cb_cfg cb_cfg = {};
+ uint16_t ind_subgroup;
- cb_cfg.module = BCMOS_MODULE_ID_NONE;
- /* Register to get indications for access terminal objects
- */
- cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
+ cb_cfg.module = BCMOS_MODULE_ID_NONE;
+ /* Register to get indications for access terminal objects
+ */
+ cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
- /* Access Terminal Indication */
- cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_indication_cb;
- ind_subgroup = bcmbal_access_terminal_auto_id_ind;
+ /* Access Terminal Operational State Change */
+ cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_osc_indication_cb;
+ ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
cb_cfg.p_subgroup = &ind_subgroup;
err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
- if (err)
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "failed to register call back functions to BAL");
- }
+ if (err)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "failed to register call back functions to BAL");
+ }
return err;
}
@@ -421,51 +452,45 @@
* 4) Flow Cfg *
* 5) Group Cfg (In case of Multicast) *
********************************************************************/
-uint32_t asfvolt16_bal_cfg_get(BalKey *key, BalCfg *cfg)
+uint32_t asfvolt16_bal_cfg_get(BalCfg *cfg)
{
bcmos_errno err = BCM_ERR_OK;
- if(!key->hdr->has_obj_type)
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "object type is not present for get");
- return BAL_ERRNO__BAL_ERR_INVALID_OP;
- }
-
- switch(key->hdr->obj_type)
+ switch(cfg->hdr->obj_type)
{
case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL:
{
- err = bal_access_terminal_cfg_get(key->access_term_key, cfg->cfg );
+ err = bal_access_terminal_cfg_get(cfg->cfg);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE:
{
- err = bal_interface_cfg_get(key->interface_key, cfg->interface);
+ err = bal_interface_cfg_get(cfg->interface);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL:
{
- err = bal_subscriber_terminal_cfg_get(key->terminal_key, cfg->terminal);
+ err = bal_subscriber_terminal_cfg_get(cfg->terminal);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_FLOW:
{
- err = bal_flow_cfg_get(key->flow_key, cfg->flow);
+ err = bal_flow_cfg_get(cfg->flow);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_GROUP:
{
- err = bal_group_cfg_get(key->group_key, cfg->group);
+ err = bal_group_cfg_get(cfg->group);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE:
{
- err = bal_tm_queue_cfg_get(key->tm_queue_key, cfg->tm_queue_cfg);
+ err = bal_tm_queue_cfg_get(cfg->tm_queue_cfg);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED:
{
- err = bal_tm_sched_cfg_get(key->tm_sched_key, cfg->tm_sched_cfg);
+ err = bal_tm_sched_cfg_get(cfg->tm_sched_cfg);
break;
}
case BAL_OBJ_ID__BAL_OBJ_ID_PACKET:
diff --git a/src/asfvolt16_driver.h b/src/asfvolt16_driver.h
index 76c99e3..1633eca 100755
--- a/src/asfvolt16_driver.h
+++ b/src/asfvolt16_driver.h
@@ -36,8 +36,11 @@
#define ASFVOLT_MAX_PKT_SIZE 500
#define ASFVOLT_MAX_DEVICE_ID_SIZE 50
#define MAX_CHAR_LENGTH 20
+#define MAX_REGID_LENGTH 36
#define MAX_OMCI_MSG_LENGTH 44
+#define BAL_ELEMENT_PRES 1
+
char voltha_device_id[ASFVOLT_MAX_DEVICE_ID_SIZE];
unsigned int is_reboot;
@@ -97,7 +100,7 @@
extern uint32_t bal_register_indication_cbs(void);
extern uint32_t asfvolt16_bal_cfg_set(BalCfg *cfg);
extern uint32_t asfvolt16_bal_cfg_clear(BalKey *key);
-extern uint32_t asfvolt16_bal_cfg_get(BalKey *key, BalCfg *cfg);
+extern uint32_t asfvolt16_bal_cfg_get(BalCfg *cfg);
extern void asfvolt16_send_omci_msg(uint16_t olt_no, uint32_t onu_nu, char* packet_to_send);
extern uint32_t asfvolt16_bal_stats_get(BalIntfType intf_type, uint32_t intf_id, BalInterfaceStatData *statData,
BalInterfaceKey *statKey);
diff --git a/src/bal_access_terminal_hdlr.c b/src/bal_access_terminal_hdlr.c
index 153fcf9..05eb7dd 100755
--- a/src/bal_access_terminal_hdlr.c
+++ b/src/bal_access_terminal_hdlr.c
@@ -110,14 +110,16 @@
* Function : bal_access_terminal_cfg_get *
* Description : Handles the clear/Delete of access terminal *
********************************************************************/
-uint32_t bal_access_terminal_cfg_get (BalAccessTerminalKey *access_term_key,
- BalAccessTerminalCfg *access_term_cfg)
+uint32_t bal_access_terminal_cfg_get (BalAccessTerminalCfg *access_term_cfg)
{
bcmos_errno err = BCM_ERR_OK;
bcmbal_access_terminal_cfg cfg; /**< declare main API struct */
bcmbal_access_terminal_key key = { }; /**< declare key */
ASFVOLT_LOG(ASFVOLT_INFO, "processing the get request on access terminal");
+
+ key.access_term_id = access_term_cfg->key->access_term_id;
+
/* init the API struct */
BCMBAL_CFG_INIT(&cfg, access_terminal, key);
@@ -131,8 +133,56 @@
return BAL_ERRNO__BAL_ERR_INTERNAL;
}
- ASFVOLT_LOG(ASFVOLT_INFO,
- "To-Do. Send access terminal details to Adapter");
+ access_term_cfg->key->has_access_term_id = BAL_ELEMENT_PRES;
+ access_term_cfg->key->access_term_id = cfg.key.access_term_id;
- return BAL_ERRNO__BAL_ERR_OK;
+ access_term_cfg->data->has_admin_state = BAL_ELEMENT_PRES;
+ access_term_cfg->data->admin_state = cfg.data.admin_state;
+
+ access_term_cfg->data->has_oper_status = BAL_ELEMENT_PRES;
+ access_term_cfg->data->oper_status = cfg.data.oper_status;
+
+ access_term_cfg->data->has_iwf_mode = BAL_ELEMENT_PRES;
+ access_term_cfg->data->iwf_mode = cfg.data.iwf_mode;
+
+ access_term_cfg->data->topology->has_num_of_nni_ports = BAL_ELEMENT_PRES;
+ access_term_cfg->data->topology->num_of_nni_ports = cfg.data.topology.num_of_nni_ports;
+
+ access_term_cfg->data->topology->has_num_of_pon_ports = BAL_ELEMENT_PRES;
+ access_term_cfg->data->topology->num_of_pon_ports = cfg.data.topology.num_of_pon_ports;
+
+ access_term_cfg->data->topology->has_num_of_mac_devs = BAL_ELEMENT_PRES;
+ access_term_cfg->data->topology->num_of_mac_devs = cfg.data.topology.num_of_mac_devs;
+
+ access_term_cfg->data->topology->has_num_of_pons_per_mac_dev = BAL_ELEMENT_PRES;
+ access_term_cfg->data->topology->num_of_pons_per_mac_dev = cfg.data.topology.num_of_pons_per_mac_dev;
+
+ access_term_cfg->data->topology->has_pon_family = BAL_ELEMENT_PRES;
+ access_term_cfg->data->topology->pon_family = cfg.data.topology.pon_family;
+
+ access_term_cfg->data->topology->has_pon_sub_family = BAL_ELEMENT_PRES;
+ access_term_cfg->data->topology->pon_sub_family = cfg.data.topology.pon_sub_family;
+
+ access_term_cfg->data->sw_version->has_version_type = BAL_ELEMENT_PRES;
+ access_term_cfg->data->sw_version->version_type = cfg.data.sw_version.version_type;
+
+ access_term_cfg->data->sw_version->has_major_rev = BAL_ELEMENT_PRES;
+ access_term_cfg->data->sw_version->major_rev = cfg.data.sw_version.major_rev;
+
+ access_term_cfg->data->sw_version->has_minor_rev = BAL_ELEMENT_PRES;
+ access_term_cfg->data->sw_version->minor_rev = cfg.data.sw_version.minor_rev;
+
+ access_term_cfg->data->sw_version->has_release_rev = BAL_ELEMENT_PRES;
+ access_term_cfg->data->sw_version->release_rev = cfg.data.sw_version.release_rev;
+
+ access_term_cfg->data->sw_version->has_om_version = BAL_ELEMENT_PRES;
+ access_term_cfg->data->sw_version->om_version = cfg.data.sw_version.om_version;
+
+ access_term_cfg->data->sw_version->has_dev_point = BAL_ELEMENT_PRES;
+ access_term_cfg->data->sw_version->dev_point = cfg.data.sw_version.dev_point;
+
+ access_term_cfg->data->has_conn_id = BAL_ELEMENT_PRES;
+ access_term_cfg->data->conn_id = cfg.data.conn_id;
+
+ return BAL_ERRNO__BAL_ERR_OK;
}
diff --git a/src/bal_access_terminal_hdlr.h b/src/bal_access_terminal_hdlr.h
index 3b0cc49..025fb3c 100755
--- a/src/bal_access_terminal_hdlr.h
+++ b/src/bal_access_terminal_hdlr.h
@@ -16,5 +16,5 @@
extern uint32_t bal_access_terminal_cfg_set(BalAccessTerminalCfg *access_term_cfg);
extern uint32_t bal_access_terminal_cfg_clear(BalAccessTerminalKey *access_term_key);
-extern uint32_t bal_access_terminal_cfg_get (BalAccessTerminalKey *access_term_key, BalAccessTerminalCfg *access_term_cfg);
+extern uint32_t bal_access_terminal_cfg_get (BalAccessTerminalCfg *access_term_cfg);
extern bcmos_errno bal_access_term_indication_cb(bcmbal_obj *obj);
diff --git a/src/bal_flow_hdlr.c b/src/bal_flow_hdlr.c
index adaba1a..75a1962 100755
--- a/src/bal_flow_hdlr.c
+++ b/src/bal_flow_hdlr.c
@@ -272,8 +272,14 @@
return BAL_ERRNO__BAL_ERR_PARM;
}
-
- ASFVOLT_LOG(ASFVOLT_INFO, "Adding the flow to OLT. FlowID(%d)", flow_cfg->key->flow_id);
+ if (flow_cfg->data->admin_state == BAL_STATE__BAL_STATE_UP )
+ {
+ ASFVOLT_LOG(ASFVOLT_INFO, "Adding the flow to OLT. FlowID(%d)", flow_cfg->key->flow_id);
+ }
+ else
+ {
+ ASFVOLT_LOG(ASFVOLT_INFO, "Deleting the flow at OLT. FlowID(%d)", flow_cfg->key->flow_id);
+ }
if (!flow_cfg->key->has_flow_type &&
((flow_cfg->key->flow_type < BAL_FLOW_TYPE__BAL_FLOW_TYPE_UPSTREAM) ||
@@ -294,7 +300,7 @@
/* decode API parameters from grpc-c */
/* Admin State */
ASFVOLT_CFG_PROP_SET(cfg, flow, admin_state,
- flow_cfg->data->has_admin_state,
+ BCMOS_TRUE,
flow_cfg->data->admin_state);
ASFVOLT_LOG(ASFVOLT_DEBUG, "admin state = %d", flow_cfg->data->admin_state);
@@ -302,7 +308,7 @@
ASFVOLT_CFG_PROP_SET(cfg, flow, oper_status,
flow_cfg->data->has_oper_status,
flow_cfg->data->oper_status);
- ASFVOLT_LOG(ASFVOLT_DEBUG, "Oper. status = %d", flow_cfg->data->oper_status);
+ ASFVOLT_LOG(ASFVOLT_DEBUG, "Oper.status = %d", flow_cfg->data->oper_status);
/* Access Side interface ID */
ASFVOLT_CFG_PROP_SET(cfg, flow, access_int_id,
@@ -333,12 +339,6 @@
ASFVOLT_LOG(ASFVOLT_DEBUG, "group_id = %d", flow_cfg->data->group_id);
}
- /*Subscriber Terminal UNI index*/
- ASFVOLT_CFG_PROP_SET(cfg, flow, sub_term_uni_idx,
- flow_cfg->data->has_sub_term_uni_idx,
- flow_cfg->data->sub_term_uni_idx);
- ASFVOLT_LOG(ASFVOLT_DEBUG, "sub_term_uni_idx = %d", flow_cfg->data->sub_term_uni_idx);
-
/*Resolve MAC*/
ASFVOLT_CFG_PROP_SET(cfg, flow, resolve_mac,
flow_cfg->data->has_resolve_mac,
@@ -402,7 +402,7 @@
ASFVOLT_CFG_PROP_SET(cfg, flow, cookie,
flow_cfg->data->has_cookie,
flow_cfg->data->cookie);
- ASFVOLT_LOG(ASFVOLT_DEBUG, "priority = %lx",flow_cfg->data->cookie);
+ ASFVOLT_LOG(ASFVOLT_DEBUG, "cookie = %lx",flow_cfg->data->cookie);
/*Egress queue*/
BalTmQueueRef *tmp_que = (BalTmQueueRef*)(flow_cfg->data->queue);
@@ -486,17 +486,17 @@
* Function : bal_flow_cfg_get *
* Description : Get flow information from BAL. *
********************************************************************/
-uint32_t bal_flow_cfg_get(BalFlowKey *flow_key, BalFlowCfg *flow_cfg)
+uint32_t bal_flow_cfg_get(BalFlowCfg *flow_cfg)
{
bcmos_errno err = BCM_ERR_OK;
bcmbal_flow_cfg cfg; /**< declare main API struct */
bcmbal_flow_key key = { }; /**< declare key */
- if (flow_key->has_flow_id && flow_key->has_flow_type)
+ if (flow_cfg->key->has_flow_id && flow_cfg->key->has_flow_type)
{
- key.flow_id = flow_key->flow_id;
- key.flow_type = flow_key->flow_type;
+ key.flow_id = flow_cfg->key->flow_id;
+ key.flow_type = flow_cfg->key->flow_type;
}
else
{
@@ -520,8 +520,11 @@
return BAL_ERRNO__BAL_ERR_INTERNAL;
}
- ASFVOLT_LOG(ASFVOLT_INFO,
- "To-Do. Send Flow details to Adapter");
+ ASFVOLT_LOG(ASFVOLT_INFO, "Get Group cfg sent to OLT for Flow Id(%d)",
+ key.flow_id);
+
+ memcpy(flow_cfg->key, &key, sizeof(BalFlowKey));
+ memcpy(flow_cfg->data, &cfg, sizeof(BalFlowCfgData));
return BAL_ERRNO__BAL_ERR_OK;
}
diff --git a/src/bal_flow_hdlr.h b/src/bal_flow_hdlr.h
index 1b6cfc6..638fc00 100755
--- a/src/bal_flow_hdlr.h
+++ b/src/bal_flow_hdlr.h
@@ -16,6 +16,6 @@
extern uint32_t bal_flow_cfg_set(BalFlowCfg *flow_cfg);
extern uint32_t bal_flow_cfg_clear(BalFlowKey *flow_key);
-extern uint32_t bal_flow_cfg_get(BalFlowKey *flow_key, BalFlowCfg *flow_cfg);
+extern uint32_t bal_flow_cfg_get(BalFlowCfg *flow_cfg);
extern uint32_t bal_fill_classifier_cfg(BalClassifier *tmp_classifier,
bcmbal_classifier *classifier_val);
diff --git a/src/bal_group_hdlr.c b/src/bal_group_hdlr.c
index c00b1a3..c1886e2 100755
--- a/src/bal_group_hdlr.c
+++ b/src/bal_group_hdlr.c
@@ -80,11 +80,11 @@
(balFlows->n_val)*sizeof(bcmbal_flow_id));
ASFVOLT_CFG_PROP_SET(grp_cfg_obj, group, flows, BCMOS_TRUE, valFlows);
- if(tm_group_cfg->data->has_owner)
+ if(tm_group_cfg->data->has_type)
{
- ASFVOLT_CFG_PROP_SET(grp_cfg_obj, group, owner,
- tm_group_cfg->data->has_owner,
- tm_group_cfg->data->owner);
+ ASFVOLT_CFG_PROP_SET(grp_cfg_obj, group, type,
+ tm_group_cfg->data->has_type,
+ tm_group_cfg->data->type);
}
BalGroupMemberInfoList *balMembers =
@@ -114,45 +114,10 @@
valMembers.val[grp_mem_idx].svc_port_id
= balMembers->val[grp_mem_idx]->svc_port_id;
}
- if(balMembers->val[grp_mem_idx]->action->has_presence_mask)
+ if(balMembers->val[grp_mem_idx]->has_intf_type)
{
- valMembers.val[grp_mem_idx].action.presence_mask
- = balMembers->val[grp_mem_idx]->action->presence_mask;
- }
- if(balMembers->val[grp_mem_idx]->action->has_cmds_bitmask)
- {
- valMembers.val[grp_mem_idx].action.cmds_bitmask
- = balMembers->val[grp_mem_idx]->action->cmds_bitmask;
- }
- if(balMembers->val[grp_mem_idx]->action->has_o_vid)
- {
- valMembers.val[grp_mem_idx].action.o_vid
- = balMembers->val[grp_mem_idx]->action->o_vid;
- }
- if(balMembers->val[grp_mem_idx]->action->has_o_pbits)
- {
- valMembers.val[grp_mem_idx].action.o_pbits
- = balMembers->val[grp_mem_idx]->action->o_pbits;
- }
- if(balMembers->val[grp_mem_idx]->action->has_o_tpid)
- {
- valMembers.val[grp_mem_idx].action.o_tpid
- = balMembers->val[grp_mem_idx]->action->o_tpid;
- }
- if(balMembers->val[grp_mem_idx]->action->has_i_vid)
- {
- valMembers.val[grp_mem_idx].action.i_vid
- = balMembers->val[grp_mem_idx]->action->i_vid;
- }
- if(balMembers->val[grp_mem_idx]->action->has_i_pbits)
- {
- valMembers.val[grp_mem_idx].action.i_pbits
- = balMembers->val[grp_mem_idx]->action->i_pbits;
- }
- if(balMembers->val[grp_mem_idx]->action->has_i_tpid)
- {
- valMembers.val[grp_mem_idx].action.i_tpid
- = balMembers->val[grp_mem_idx]->action->i_tpid;
+ valMembers.val[grp_mem_idx].intf_type
+ = balMembers->val[grp_mem_idx]->intf_type;
}
if(balMembers->val[grp_mem_idx]->queue->has_sched_id)
{
@@ -183,20 +148,19 @@
/********************************************************************\
- * Function : bal_group_get_req *
- * Description : get the OLT device group cfg *
+ * Function : bal_group_cfg_get *
+ * Description : get the OLT device group cfg *
********************************************************************/
-uint32_t bal_group_cfg_get(BalGroupKey *tm_group_cfg_key,
- BalGroupCfg *tm_group_cfg)
+uint32_t bal_group_cfg_get(BalGroupCfg *group_cfg)
{
bcmos_errno err = BCM_ERR_OK;
bcmbal_group_cfg grp_cfg_obj; /**< declare main API struct */
bcmbal_group_key key = { }; /**< declare key */
- if(tm_group_cfg_key->has_group_id)
+ if(group_cfg->key->has_group_id)
{
- key.group_id = tm_group_cfg_key->group_id;
+ key.group_id = group_cfg->key->group_id;
}
else
{
@@ -222,6 +186,10 @@
ASFVOLT_LOG(ASFVOLT_INFO, "Get Group cfg sent to OLT for Group Id(%d)",
key.group_id);
+
+ memcpy(group_cfg->key, &key, sizeof(BalFlowKey));
+ memcpy(group_cfg->data, &grp_cfg_obj, sizeof(BalFlowCfgData));
+
return err;
}
diff --git a/src/bal_group_hdlr.h b/src/bal_group_hdlr.h
index 9e046fb..fa410c2 100755
--- a/src/bal_group_hdlr.h
+++ b/src/bal_group_hdlr.h
@@ -15,7 +15,6 @@
*/
extern uint32_t bal_group_cfg_set(BalGroupCfg *tm_group_cfg);
-extern uint32_t bal_group_cfg_get(BalGroupKey *tm_group_cfg_key,
- BalGroupCfg *tm_group_cfg);
+extern uint32_t bal_group_cfg_get(BalGroupCfg *tm_group_cfg);
extern uint32_t bal_group_cfg_clear(BalGroupKey *tm_group_cfg_key);
extern bcmos_errno bal_group_cfg_indication_cb(bcmbal_obj *obj);
diff --git a/src/bal_indications_hdlr.c b/src/bal_indications_hdlr.c
index fdd9bf3..a633b0d 100755
--- a/src/bal_indications_hdlr.c
+++ b/src/bal_indications_hdlr.c
@@ -22,136 +22,6 @@
/*extern variables*/
-/*static bcmos_mutex bal_ind_lock; - Need to define bcm independent mutex*/
-/********************************************************************\
- * Function : bal_acc_term_indication_cb *
- * Description : This function will handle the indications for *
- * Access Terminal Indication *
- * *
- ********************************************************************/
-bcmos_errno bal_acc_term_indication_cb(bcmbal_obj *obj)
-{
- bcmos_errno result = BCM_ERR_OK;
-
- if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type ||
- bcmbal_access_terminal_auto_id_ind != obj->subgroup)
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
- bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
- result = BCM_ERR_INTERNAL;
- }
- else
- {
- ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API '%s' IND callback (status is %s)",
- bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
- BalIndications *balIndCfg;
- balIndCfg = malloc(sizeof(BalIndications));
- memset(balIndCfg, 0, sizeof(BalIndications));
- bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND;
- balIndCfg->has_objtype = BAL_GRPC_PRES;
- balIndCfg->objtype = obj->obj_type;
- balIndCfg->has_sub_group = BAL_GRPC_PRES;
- balIndCfg->sub_group = obj->subgroup;
- balIndCfg->device_id = voltha_device_id;
-
- bcmbal_access_terminal_ind *acc_term_ind = (bcmbal_access_terminal_ind *)obj;
-
- balIndCfg->access_term_ind = malloc(sizeof(BalAccessTerminalInd));
- memset(balIndCfg->access_term_ind, 0, sizeof(BalAccessTerminalInd));
- bal_access_terminal_ind__init(balIndCfg->access_term_ind);
-
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->access_term_ind->hdr = hdr;
-
- BalAccessTerminalKey *accessTermkey;
- accessTermkey = malloc(sizeof(BalAccessTerminalKey));
- memset(accessTermkey, 0, sizeof(BalAccessTerminalKey));
- bal_access_terminal_key__init(accessTermkey);
- balIndCfg->access_term_ind->key = accessTermkey;
- balIndCfg->access_term_ind->key->has_access_term_id = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->key->access_term_id = acc_term_ind->key.access_term_id;
-
- BalAccessTerminalIndData *accessTermIndData;
- accessTermIndData = malloc(sizeof(BalAccessTerminalIndData));
- memset(accessTermIndData, 0, sizeof(BalAccessTerminalIndData));
- bal_access_terminal_ind_data__init(accessTermIndData);
- balIndCfg->access_term_ind->data = accessTermIndData;
- balIndCfg->access_term_ind->data->has_admin_state = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->admin_state = acc_term_ind->data.admin_state;
- balIndCfg->access_term_ind->data->has_oper_status = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->oper_status = acc_term_ind->data.oper_status;
- balIndCfg->access_term_ind->data->has_iwf_mode = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->iwf_mode = acc_term_ind->data.iwf_mode;
-
- BalTopology *balTop;
- balTop = malloc(sizeof(BalTopology));
- memset(balTop, 0, sizeof(BalTopology));
- bal_topology__init(balTop);
- balIndCfg->access_term_ind->data->topology = balTop;
-
- balIndCfg->access_term_ind->data->topology->has_num_of_nni_ports = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->topology->num_of_nni_ports =
- acc_term_ind->data.topology.num_of_nni_ports;
- balIndCfg->access_term_ind->data->topology->has_num_of_pon_ports = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->topology->num_of_pon_ports =
- acc_term_ind->data.topology.num_of_pon_ports;
- balIndCfg->access_term_ind->data->topology->has_num_of_mac_devs = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->topology->num_of_mac_devs =
- acc_term_ind->data.topology.num_of_mac_devs;
- balIndCfg->access_term_ind->data->topology->has_num_of_pons_per_mac_dev = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->topology->num_of_pons_per_mac_dev =
- acc_term_ind->data.topology.num_of_pons_per_mac_dev;
- balIndCfg->access_term_ind->data->topology->has_pon_family = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->topology->pon_family =
- acc_term_ind->data.topology.pon_family;
- balIndCfg->access_term_ind->data->topology->has_pon_sub_family = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->topology->pon_sub_family =
- acc_term_ind->data.topology.pon_sub_family;
-
- BalSwVersion *balsv;
- balsv = malloc(sizeof(BalSwVersion));
- memset(balsv, 0, sizeof(BalSwVersion));
- bal_sw_version__init(balsv);
- balIndCfg->access_term_ind->data->sw_version = balsv;
-
- balIndCfg->access_term_ind->data->sw_version->has_version_type = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->sw_version->version_type =
- acc_term_ind->data.sw_version.version_type;
- balIndCfg->access_term_ind->data->sw_version->has_major_rev = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->sw_version->major_rev =
- acc_term_ind->data.sw_version.major_rev;
- balIndCfg->access_term_ind->data->sw_version->has_minor_rev = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->sw_version->minor_rev =
- acc_term_ind->data.sw_version.minor_rev;
- balIndCfg->access_term_ind->data->sw_version->has_patch_rev = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->sw_version->patch_rev =
- acc_term_ind->data.sw_version.patch_rev;
- balIndCfg->access_term_ind->data->sw_version->has_om_version = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->sw_version->om_version =
- acc_term_ind->data.sw_version.om_version;
- balIndCfg->access_term_ind->data->sw_version->has_dev_point = BAL_GRPC_PRES;
- balIndCfg->access_term_ind->data->sw_version->dev_point =
- acc_term_ind->data.sw_version.dev_point;
-
- bal_register_indication_cbs();
-
- list_node *bal_indication_node = malloc(sizeof(list_node));
- bal_indication_node->bal_indication = balIndCfg;
-
- pthread_mutex_lock(&bal_ind_queue_lock);
- add_bal_indication_node(bal_indication_node);
- pthread_mutex_unlock(&bal_ind_queue_lock);
-
- is_reboot = BAL_REBOOT_STATUS__BAL_OLT_UP_AFTER_ACTIVATION;
- }
-
- return result;
-}
-
/********************************************************************\
* Function : bal_acc_term_osc_indication_cb *
* Description : This function will handle the indications for *
@@ -191,11 +61,7 @@
bal_access_terminal_oper_status_change__init(acessTermOSC);
balIndCfg->access_term_ind_op_state = acessTermOSC;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->access_term_ind_op_state->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalAccessTerminalKey *accessTermkey;
accessTermkey = malloc(sizeof(BalAccessTerminalKey));
@@ -221,6 +87,70 @@
balIndCfg->access_term_ind_op_state->data->admin_state =
acc_term_osc->data.admin_state;
+ bal_register_indication_cbs();
+
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ is_reboot = BAL_REBOOT_STATUS__BAL_OLT_UP_AFTER_ACTIVATION;
+ }
+
+ return result;
+}
+
+/********************************************************************\
+ * Function : bal_acc_term_processing_error_indication_cb *
+ * Description : This function will handle the error indications *
+ * for Access Terminal *
+ * *
+ ********************************************************************/
+bcmos_errno bal_acc_term_processing_error_indication_cb(bcmbal_obj *obj)
+{
+ bcmos_errno result = BCM_ERR_OK;
+
+ if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type ||
+ bcmbal_access_terminal_auto_id_processing_error != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->u_case = BAL_INDICATIONS__U_ACCESS_TERM_PROC_ERR;
+ balIndCfg->device_id = voltha_device_id;
+
+ bcmbal_access_terminal_processing_error *acc_term_err =
+ (bcmbal_access_terminal_processing_error *)obj;
+
+ BalAccessTerminalProcessingError *acessTermError;
+ acessTermError = malloc(sizeof(BalAccessTerminalProcessingError));
+ memset(acessTermError, 0, sizeof(BalAccessTerminalProcessingError));
+ bal_access_terminal_processing_error__init(acessTermError);
+ balIndCfg->access_term_proc_err = acessTermError;
+
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
+
+ BalAccessTerminalKey *accessTermkey;
+ accessTermkey = malloc(sizeof(BalAccessTerminalKey));
+ memset(accessTermkey, 0, sizeof(BalAccessTerminalKey));
+ bal_access_terminal_key__init(accessTermkey);
+ balIndCfg->access_term_proc_err->key = accessTermkey;
+ balIndCfg->access_term_proc_err->key->has_access_term_id = BAL_GRPC_PRES;
+ balIndCfg->access_term_proc_err->key->access_term_id =
+ acc_term_err->key.access_term_id;
+
list_node *bal_indication_node = malloc(sizeof(list_node));
bal_indication_node->bal_indication = balIndCfg;
@@ -270,11 +200,7 @@
bal_flow_oper_status_change__init(flowOscInd);
balIndCfg->flow_op_state = flowOscInd;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->flow_op_state->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalFlowKey *flowkey;
flowkey = malloc(sizeof(BalFlowKey));
@@ -318,17 +244,16 @@
}
/********************************************************************\
- * Function : bal_flow_indication_cb *
- * Description : This function will handle the indications for *
- * Flow Indication *
+ * Function : bal_flow_processing_error_indication_cb *
+ * Description : This function will handle flow processing errors *
* *
********************************************************************/
-bcmos_errno bal_flow_indication_cb(bcmbal_obj *obj)
+bcmos_errno bal_flow_processing_error_indication_cb(bcmbal_obj *obj)
{
- bcmos_errno result = BCM_ERR_OK;
+ bcmos_errno result = BCM_ERR_OK;
if(BCMBAL_OBJ_ID_FLOW != obj->obj_type ||
- bcmbal_flow_auto_id_ind != obj->subgroup)
+ bcmbal_flow_auto_id_processing_error != obj->subgroup)
{
ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
@@ -340,136 +265,38 @@
balIndCfg = malloc(sizeof(BalIndications));
memset(balIndCfg, 0, sizeof(BalIndications));
bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_FLOW_IND;
balIndCfg->has_objtype = BAL_GRPC_PRES;
balIndCfg->objtype = obj->obj_type;
balIndCfg->has_sub_group = BAL_GRPC_PRES;
balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->u_case = BAL_INDICATIONS__U_FLOW_PROC_ERR;
balIndCfg->device_id = voltha_device_id;
- bcmbal_flow_ind *flow_ind = (bcmbal_flow_ind *)obj;
+ bcmbal_flow_processing_error *flow_proc_error =
+ (bcmbal_flow_processing_error *)obj;
- BalFlowInd *flowInd;
- flowInd = malloc(sizeof(BalFlowInd));
- memset(flowInd, 0, sizeof(BalFlowInd));
- bal_flow_ind__init(flowInd);
- balIndCfg->flow_ind = flowInd;
+ BalFlowProcessingError *flowProcError;
+ flowProcError = malloc(sizeof(BalFlowProcessingError));
+ memset(flowProcError, 0, sizeof(BalFlowProcessingError));
+ bal_flow_processing_error__init(flowProcError);
+ balIndCfg->flow_proc_err = flowProcError;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->flow_ind->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
- BalFlowKey *flowkey;
- flowkey = malloc(sizeof(BalFlowKey));
- memset(flowkey, 0, sizeof(BalFlowKey));
- bal_flow_key__init(flowkey);
- balIndCfg->flow_ind->key = flowkey;
+ BalFlowKey *flowKey;
+ flowKey = malloc(sizeof(BalFlowKey));
+ memset(flowKey, 0, sizeof(BalFlowKey));
+ bal_flow_key__init(flowKey);
- balIndCfg->flow_ind->key->has_flow_id = BAL_GRPC_PRES;
- balIndCfg->flow_ind->key->flow_id = flow_ind->key.flow_id;
- balIndCfg->flow_ind->key->has_flow_type = BAL_GRPC_PRES;
- balIndCfg->flow_ind->key->flow_type = flow_ind->key.flow_type;
+ balIndCfg->flow_proc_err->key = flowKey;
- BalFlowIndData *flowIndData;
- flowIndData = malloc(sizeof(BalFlowIndData));
- memset(flowIndData, 0, sizeof(BalFlowIndData));
- bal_flow_ind_data__init(flowIndData);
- balIndCfg->flow_ind->data = flowIndData;
+ balIndCfg->flow_proc_err->key->has_flow_id = BAL_GRPC_PRES;
+ balIndCfg->flow_proc_err->key->flow_id =
+ flow_proc_error->key.flow_id;
- balIndCfg->flow_ind->data->has_admin_state = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->admin_state = flow_ind->data.admin_state;
- balIndCfg->flow_ind->data->has_oper_status= BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->oper_status= flow_ind->data.oper_status;
- balIndCfg->flow_ind->data->has_access_int_id = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->access_int_id = flow_ind->data.access_int_id;
- balIndCfg->flow_ind->data->has_network_int_id = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->network_int_id = flow_ind->data.network_int_id;
- balIndCfg->flow_ind->data->has_sub_term_id = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->sub_term_id = flow_ind->data.sub_term_id;
- balIndCfg->flow_ind->data->has_sub_term_uni_idx = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->sub_term_uni_idx = flow_ind->data.sub_term_uni_idx;
- balIndCfg->flow_ind->data->has_svc_port_id = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->svc_port_id = flow_ind->data.svc_port_id;
- balIndCfg->flow_ind->data->has_resolve_mac = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->resolve_mac = flow_ind->data.resolve_mac;
- balIndCfg->flow_ind->data->has_cookie = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->cookie = flow_ind->data.cookie;
-
- BalClassifier *balClassifier;
- balClassifier = malloc(sizeof(BalClassifier));
- memset(balClassifier, 0, sizeof(BalClassifier));
- bal_classifier__init(balClassifier);
- balIndCfg->flow_ind->data->classifier = balClassifier;
-
- balIndCfg->flow_ind->data->classifier->has_presence_mask = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->presence_mask = flow_ind->data.classifier.presence_mask;
- balIndCfg->flow_ind->data->classifier->has_o_tpid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->o_tpid = flow_ind->data.classifier.o_tpid;
- balIndCfg->flow_ind->data->classifier->has_o_vid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->o_vid = flow_ind->data.classifier.o_vid;
- balIndCfg->flow_ind->data->classifier->has_i_tpid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->i_tpid = flow_ind->data.classifier.i_tpid;
- balIndCfg->flow_ind->data->classifier->has_i_vid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->i_vid = flow_ind->data.classifier.i_vid;
- balIndCfg->flow_ind->data->classifier->has_o_pbits = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->o_pbits = flow_ind->data.classifier.o_pbits;
- balIndCfg->flow_ind->data->classifier->has_i_pbits = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->i_pbits = flow_ind->data.classifier.i_pbits;
- balIndCfg->flow_ind->data->classifier->has_ether_type = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->ether_type = flow_ind->data.classifier.ether_type;
- balIndCfg->flow_ind->data->classifier->has_dst_mac = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->dst_mac.len =
- (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.dst_mac.u8);
- balIndCfg->flow_ind->data->classifier->dst_mac.data =
- (uint8_t *)malloc((balIndCfg->flow_ind->data->classifier->dst_mac.len)*sizeof(uint8_t));
- memcpy(balIndCfg->flow_ind->data->classifier->dst_mac.data,
- flow_ind->data.classifier.dst_mac.u8,
- balIndCfg->flow_ind->data->classifier->dst_mac.len);
- balIndCfg->flow_ind->data->classifier->has_src_mac = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->src_mac.len =
- (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.src_mac.u8);
- balIndCfg->flow_ind->data->classifier->src_mac.data =
- (uint8_t *)malloc((balIndCfg->flow_ind->data->classifier->src_mac.len)*sizeof(uint8_t));
- memcpy(balIndCfg->flow_ind->data->classifier->src_mac.data,
- flow_ind->data.classifier.src_mac.u8,
- balIndCfg->flow_ind->data->classifier->src_mac.len);
- balIndCfg->flow_ind->data->classifier->has_ip_proto = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->ip_proto = flow_ind->data.classifier.ip_proto;
- balIndCfg->flow_ind->data->classifier->has_dst_ip = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->dst_ip = flow_ind->data.classifier.dst_ip.u32;
- balIndCfg->flow_ind->data->classifier->has_src_ip = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->src_ip = flow_ind->data.classifier.src_ip.u32;
- balIndCfg->flow_ind->data->classifier->has_src_port = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->src_port = flow_ind->data.classifier.src_port;
- balIndCfg->flow_ind->data->classifier->has_dst_port = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->dst_port = flow_ind->data.classifier.dst_port;
- balIndCfg->flow_ind->data->classifier->has_pkt_tag_type = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->classifier->pkt_tag_type = flow_ind->data.classifier.pkt_tag_type;
-
- BalAction *balAction;
- balAction = malloc(sizeof(BalAction));
- memset(balAction, 0, sizeof(BalAction));
- bal_action__init(balAction);
- balIndCfg->flow_ind->data->action = balAction;
-
- balIndCfg->flow_ind->data->action->has_presence_mask = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->presence_mask = flow_ind->data.action.presence_mask;
- balIndCfg->flow_ind->data->action->has_cmds_bitmask = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->cmds_bitmask = flow_ind->data.action.cmds_bitmask;
- balIndCfg->flow_ind->data->action->has_o_vid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->o_vid = flow_ind->data.action.o_vid;
- balIndCfg->flow_ind->data->action->has_o_pbits = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->o_pbits = flow_ind->data.action.o_pbits;
- balIndCfg->flow_ind->data->action->has_o_tpid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->o_tpid = flow_ind->data.action.o_tpid;
- balIndCfg->flow_ind->data->action->has_i_vid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->i_vid = flow_ind->data.action.i_vid;
- balIndCfg->flow_ind->data->action->has_i_pbits = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->i_pbits = flow_ind->data.action.i_pbits;
- balIndCfg->flow_ind->data->action->has_i_tpid = BAL_GRPC_PRES;
- balIndCfg->flow_ind->data->action->i_tpid = flow_ind->data.action.i_tpid;
+ balIndCfg->flow_proc_err->key->has_flow_type = BAL_GRPC_PRES;
+ balIndCfg->flow_proc_err->key->flow_type =
+ flow_proc_error->key.flow_type;
list_node *bal_indication_node = malloc(sizeof(list_node));
bal_indication_node->bal_indication = balIndCfg;
@@ -479,156 +306,10 @@
pthread_mutex_unlock(&bal_ind_queue_lock);
}
- return result;
+
+ return result;
}
-/********************************************************************\
- * Function : bal_group_indication_cb *
- * Description : This function will handle the indications for *
- * Group Indication *
- * *
- ********************************************************************/
-bcmos_errno bal_group_indication_cb(bcmbal_obj *obj)
-{
- bcmos_errno result = BCM_ERR_OK;
- unsigned int i = 0;
-
- if(BCMBAL_OBJ_ID_GROUP != obj->obj_type ||
- bcmbal_group_auto_id_ind != obj->subgroup)
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
- bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
- result = BCM_ERR_INTERNAL;
- }
- else
- {
- BalIndications *balIndCfg;
- balIndCfg = malloc(sizeof(BalIndications));
- memset(balIndCfg, 0, sizeof(BalIndications));
- bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_GROUP_IND;
- balIndCfg->has_objtype = BAL_GRPC_PRES;
- balIndCfg->objtype = obj->obj_type;
- balIndCfg->has_sub_group = BAL_GRPC_PRES;
- balIndCfg->sub_group = obj->subgroup;
- balIndCfg->device_id = voltha_device_id;
-
- bcmbal_group_ind *group_ind = (bcmbal_group_ind *)obj;
-
- BalGroupInd *groupInd;
- groupInd = malloc(sizeof(BalGroupInd));
- memset(groupInd, 0, sizeof(BalGroupInd));
- bal_group_ind__init(groupInd);
- balIndCfg->group_ind = groupInd;
-
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->group_ind->hdr = hdr;
-
- BalGroupKey *groupkey;
- groupkey = malloc(sizeof(BalGroupKey));
- memset(groupkey, 0, sizeof(BalGroupKey));
- bal_group_key__init(groupkey);
- balIndCfg->group_ind->key = groupkey;
-
- balIndCfg->group_ind->key->has_group_id = BAL_GRPC_PRES;
- balIndCfg->group_ind->key->group_id = group_ind->key.group_id;
-
- BalGroupIndData *groupIndData;
- groupIndData = malloc(sizeof(BalGroupIndData));
- memset(groupIndData, 0, sizeof(BalGroupIndData));
- bal_group_ind_data__init(groupIndData);
- balIndCfg->group_ind->data = groupIndData;
-
- balIndCfg->group_ind->data->has_members_cmd = BAL_GRPC_PRES;
- balIndCfg->group_ind->data->members_cmd = group_ind->data.members_cmd;
- balIndCfg->group_ind->data->has_cookie = BAL_GRPC_PRES;
- balIndCfg->group_ind->data->cookie = group_ind->data.cookie;
- balIndCfg->group_ind->data->has_owner = BAL_GRPC_PRES;
- balIndCfg->group_ind->data->owner = group_ind->data.owner;
-
- BalGroupMemberInfoList *balMembers;
- balMembers = malloc(sizeof(BalGroupMemberInfoList));
- memset(balMembers, 0, sizeof(BalGroupMemberInfoList));
- bal_group_member_info_list__init(balMembers);
- balIndCfg->group_ind->data->members = balMembers;
-
- balIndCfg->group_ind->data->members->n_val = group_ind->data.members.len;
-
- BalGroupMemberInfo *balMemberInfo;
- BalAction *balAction;
- BalTmQueueRef *balQueue;
- for (i = 0; i < balIndCfg->group_ind->data->members->n_val; i++)
- {
- balMemberInfo = malloc(sizeof(BalGroupMemberInfo));
- memset(balMemberInfo, 0, sizeof(BalGroupMemberInfo));
- bal_group_member_info__init(balMemberInfo);
-
- balMemberInfo->has_intf_id = BAL_GRPC_PRES;
- balMemberInfo->intf_id = group_ind->data.members.val->intf_id;
- balMemberInfo->has_svc_port_id = BAL_GRPC_PRES;
- balMemberInfo->svc_port_id = group_ind->data.members.val->svc_port_id;
-
- balAction = malloc(sizeof(BalAction));
- memset(balAction, 0, sizeof(BalAction));
- bal_action__init(balAction);
- balMemberInfo->action = balAction;
-
- balMemberInfo->action->has_presence_mask = BAL_GRPC_PRES;
- balMemberInfo->action->presence_mask = group_ind->data.members.val->action.presence_mask;
- balMemberInfo->action->has_cmds_bitmask = BAL_GRPC_PRES;
- balMemberInfo->action->cmds_bitmask = group_ind->data.members.val->action.cmds_bitmask;
- balMemberInfo->action->has_o_vid = BAL_GRPC_PRES;
- balMemberInfo->action->o_vid = group_ind->data.members.val->action.o_vid;
- balMemberInfo->action->has_o_pbits = BAL_GRPC_PRES;
- balMemberInfo->action->o_pbits = group_ind->data.members.val->action.o_pbits;
- balMemberInfo->action->has_o_tpid = BAL_GRPC_PRES;
- balMemberInfo->action->o_tpid = group_ind->data.members.val->action.o_tpid;
- balMemberInfo->action->has_i_vid = BAL_GRPC_PRES;
- balMemberInfo->action->i_vid = group_ind->data.members.val->action.i_vid;
- balMemberInfo->action->has_i_pbits = BAL_GRPC_PRES;
- balMemberInfo->action->i_pbits = group_ind->data.members.val->action.i_pbits;
- balMemberInfo->action->has_i_tpid = BAL_GRPC_PRES;
- balMemberInfo->action->i_tpid = group_ind->data.members.val->action.i_tpid;
-
- balQueue = malloc(sizeof(BalTmQueueRef));
- memset(balQueue, 0, sizeof(BalTmQueueRef));
- bal_tm_queue_ref__init(balQueue);
- balMemberInfo->queue = balQueue;
-
- balMemberInfo->queue->has_sched_id = BAL_GRPC_PRES;
- balMemberInfo->queue->sched_id = group_ind->data.members.val->queue.sched_id;
- balMemberInfo->queue->has_queue_id = BAL_GRPC_PRES;
- balMemberInfo->queue->queue_id = group_ind->data.members.val->queue.queue_id;
-
- balIndCfg->group_ind->data->members->val[i] = balMemberInfo;
- }
-
-
- BalIdList *balFlows;
- balFlows = malloc(sizeof(BalIdList));
- memset(balFlows, 0, sizeof(BalIdList));
- bal_id_list__init(balFlows);
- balIndCfg->group_ind->data->flows = balFlows;
-
- balIndCfg->group_ind->data->flows->n_val = group_ind->data.flows.len;
- balIndCfg->group_ind->data->flows->val =
- (uint32_t *)malloc((balIndCfg->group_ind->data->flows->n_val)*sizeof(uint32_t));
- memcpy(balIndCfg->group_ind->data->flows->val, group_ind->data.flows.val,
- balIndCfg->group_ind->data->flows->n_val);
-
- list_node *bal_indication_node = malloc(sizeof(list_node));
- bal_indication_node->bal_indication = balIndCfg;
-
- pthread_mutex_lock(&bal_ind_queue_lock);
- add_bal_indication_node(bal_indication_node);
- pthread_mutex_unlock(&bal_ind_queue_lock);
- }
-
- return result;
-}
/********************************************************************\
* Function : bal_interface_osc_indication_cb *
@@ -669,11 +350,7 @@
bal_interface_oper_status_change__init(ifOsc);
balIndCfg->interface_op_state = ifOsc;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->interface_op_state->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalInterfaceKey *ifkey;
ifkey = malloc(sizeof(BalInterfaceKey));
@@ -749,11 +426,7 @@
bal_interface_los__init(ifLos);
balIndCfg->interface_los = ifLos;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->interface_los->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalInterfaceKey *ifkey;
ifkey = malloc(sizeof(BalInterfaceKey));
@@ -787,111 +460,6 @@
}
/********************************************************************\
- * Function : bal_interface_indication_cb *
- * Description : This function will handle the indications for *
- * Interface Indication *
- * *
- ********************************************************************/
-bcmos_errno bal_interface_indication_cb(bcmbal_obj *obj)
-{
- bcmos_errno result = BCM_ERR_OK;
-
- if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type ||
- bcmbal_interface_auto_id_ind != obj->subgroup)
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
- bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
- result = BCM_ERR_INTERNAL;
- }
- else
- {
- BalIndications *balIndCfg;
- balIndCfg = malloc(sizeof(BalIndications));
- memset(balIndCfg, 0, sizeof(BalIndications));
- bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_INTERFACE_IND;
- balIndCfg->has_objtype = BAL_GRPC_PRES;
- balIndCfg->objtype = obj->obj_type;
- balIndCfg->has_sub_group = BAL_GRPC_PRES;
- balIndCfg->sub_group = obj->subgroup;
- balIndCfg->device_id = voltha_device_id;
-
- bcmbal_interface_ind *interface_ind = (bcmbal_interface_ind *)obj;
-
- BalInterfaceInd *ifInd;
- ifInd = malloc(sizeof(BalInterfaceInd));
- memset(ifInd, 0, sizeof(BalInterfaceInd));
- bal_interface_ind__init(ifInd);
- balIndCfg->interface_ind = ifInd;
-
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->interface_ind->hdr = hdr;
-
- BalInterfaceKey *ifkey;
- ifkey = malloc(sizeof(BalInterfaceKey));
- memset(ifkey, 0, sizeof(BalInterfaceKey));
- bal_interface_key__init(ifkey);
- balIndCfg->interface_ind->key = ifkey;
-
- balIndCfg->interface_ind->key->has_intf_id = BAL_GRPC_PRES;
- balIndCfg->interface_ind->key->intf_id = interface_ind->key.intf_id;
- balIndCfg->interface_ind->key->has_intf_type = BAL_GRPC_PRES;
- balIndCfg->interface_ind->key->intf_type = interface_ind->key.intf_type;
-
- BalInterfaceIndData *ifIndData;
- ifIndData = malloc(sizeof(BalInterfaceIndData));
- memset(ifIndData, 0, sizeof(BalInterfaceIndData));
- bal_interface_ind_data__init(ifIndData);
- balIndCfg->interface_ind->data = ifIndData;
-
- balIndCfg->interface_ind->data->has_admin_state = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->admin_state = interface_ind->data.admin_state;
- balIndCfg->interface_ind->data->has_oper_status = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->oper_status = interface_ind->data.oper_status;
- balIndCfg->interface_ind->data->has_min_data_agg_port_id = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->min_data_agg_port_id = interface_ind->data.min_data_agg_port_id;
- balIndCfg->interface_ind->data->has_min_data_svc_port_id = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->min_data_svc_port_id = interface_ind->data.min_data_svc_port_id;
- balIndCfg->interface_ind->data->has_transceiver_type = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->transceiver_type = interface_ind->data.transceiver_type;
- balIndCfg->interface_ind->data->has_ds_miss_mode = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->ds_miss_mode = interface_ind->data.ds_miss_mode;
- balIndCfg->interface_ind->data->has_mtu = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->mtu = interface_ind->data.mtu;
- balIndCfg->interface_ind->data->has_flow_control = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->flow_control = interface_ind->data.flow_control;
- balIndCfg->interface_ind->data->has_ds_tm = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->ds_tm = interface_ind->data.ds_tm;
- balIndCfg->interface_ind->data->has_us_tm = BAL_GRPC_PRES;
- balIndCfg->interface_ind->data->us_tm = interface_ind->data.us_tm;
-
- BalIdList *balFlows;
- balFlows = malloc(sizeof(BalIdList));
- memset(balFlows, 0, sizeof(BalIdList));
- bal_id_list__init(balFlows);
- balIndCfg->interface_ind->data->sub_term_id_list = balFlows;
-
- balIndCfg->interface_ind->data->sub_term_id_list->n_val = interface_ind->data.sub_term_id_list.len;
- balIndCfg->interface_ind->data->sub_term_id_list->val =
- (uint32_t *)malloc((balIndCfg->interface_ind->data->sub_term_id_list->n_val)*sizeof(uint32_t));
- memcpy(balIndCfg->interface_ind->data->sub_term_id_list->val, interface_ind->data.sub_term_id_list.val,
- balIndCfg->interface_ind->data->sub_term_id_list->n_val);
-
- list_node *bal_indication_node = malloc(sizeof(list_node));
- bal_indication_node->bal_indication = balIndCfg;
-
- pthread_mutex_lock(&bal_ind_queue_lock);
- add_bal_indication_node(bal_indication_node);
- pthread_mutex_unlock(&bal_ind_queue_lock);
- }
-
- return result;
-}
-
-/********************************************************************\
* Function : bal_sub_term_osc_indication_cb *
* Description : This function will handle the indications for *
* Subscriber term Operational State Change *
@@ -930,11 +498,7 @@
bal_subscriber_terminal_oper_status_change__init(subOscInd);
balIndCfg->terminal_op_state = subOscInd;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->terminal_op_state->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalSubscriberTerminalKey *subkey;
subkey = malloc(sizeof(BalSubscriberTerminalKey));
@@ -1015,11 +579,7 @@
bal_subscriber_terminal_sub_term_disc__init(subDiscInd);
balIndCfg->terminal_disc = subDiscInd;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->terminal_disc->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalSubscriberTerminalKey *subkey;
subkey = malloc(sizeof(BalSubscriberTerminalKey));
@@ -1132,11 +692,7 @@
bal_subscriber_terminal_sub_term_alarm__init(subTermAlarm);
balIndCfg->terminal_alarm = subTermAlarm;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->terminal_alarm->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalSubscriberTerminalKey *subkey;
subkey = malloc(sizeof(BalSubscriberTerminalKey));
@@ -1220,11 +776,7 @@
bal_subscriber_terminal_dgi__init(subDgiInd);
balIndCfg->terminal_dgi= subDgiInd;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->terminal_dgi->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalSubscriberTerminalKey *subkey;
subkey = malloc(sizeof(BalSubscriberTerminalKey));
@@ -1258,17 +810,16 @@
}
/********************************************************************\
- * Function : bal_sub_term_indication_cb *
- * Description : This function will handle the indications for *
- * Subscriber term indication *
+ * Function : bal_sub_term_dowi_indication_cb *
+ * Description : This function will handle dowi indication *
* *
********************************************************************/
-bcmos_errno bal_sub_term_indication_cb(bcmbal_obj *obj)
+bcmos_errno bal_sub_term_dowi_indication_cb(bcmbal_obj *obj)
{
- bcmos_errno result = BCM_ERR_OK;
+bcmos_errno result = BCM_ERR_OK;
if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
- bcmbal_subscriber_terminal_auto_id_ind != obj->subgroup)
+ bcmbal_subscriber_terminal_auto_id_dowi != obj->subgroup)
{
ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
@@ -1280,124 +831,49 @@
balIndCfg = malloc(sizeof(BalIndications));
memset(balIndCfg, 0, sizeof(BalIndications));
bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_IND;
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_DOWI;
balIndCfg->has_objtype = BAL_GRPC_PRES;
balIndCfg->objtype = obj->obj_type;
balIndCfg->has_sub_group = BAL_GRPC_PRES;
balIndCfg->sub_group = obj->subgroup;
balIndCfg->device_id = voltha_device_id;
- bcmbal_subscriber_terminal_ind *sub_ind = (bcmbal_subscriber_terminal_ind *)obj;
+ bcmbal_subscriber_terminal_dowi *sub_dowi_ind =
+ (bcmbal_subscriber_terminal_dowi *)obj;
- BalSubscriberTerminalInd *subInd;
- subInd = malloc(sizeof(BalSubscriberTerminalInd));
- memset(subInd, 0, sizeof(BalSubscriberTerminalInd));
- bal_subscriber_terminal_ind__init(subInd);
- balIndCfg->terminal_ind = subInd;
+ BalSubscriberTerminalDowi *subDowiInd;
+ subDowiInd = malloc(sizeof(BalSubscriberTerminalDowi));
+ memset(subDowiInd, 0, sizeof(BalSubscriberTerminalDowi));
+ bal_subscriber_terminal_dowi__init(subDowiInd);
+ balIndCfg->terminal_dowi= subDowiInd;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->terminal_ind->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalSubscriberTerminalKey *subkey;
subkey = malloc(sizeof(BalSubscriberTerminalKey));
memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
bal_subscriber_terminal_key__init(subkey);
- balIndCfg->terminal_ind->key = subkey;
+ balIndCfg->terminal_dowi->key = subkey;
- balIndCfg->terminal_ind->key->has_intf_id = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->key->intf_id = sub_ind->key.intf_id;
- balIndCfg->terminal_ind->key->has_sub_term_id = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->key->sub_term_id = sub_ind->key.sub_term_id;
+ balIndCfg->terminal_dowi->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_dowi->key->intf_id = sub_dowi_ind->key.intf_id;
+ balIndCfg->terminal_dowi->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_dowi->key->sub_term_id = sub_dowi_ind->key.sub_term_id;
- BalSubscriberTerminalIndData *subIndData;
- subIndData = malloc(sizeof(BalSubscriberTerminalIndData));
- memset(subIndData, 0, sizeof(BalSubscriberTerminalIndData));
- bal_subscriber_terminal_ind_data__init(subIndData);
- balIndCfg->terminal_ind->data = subIndData;
+ BalSubscriberTerminalDowiData *subDowiIndData;
+ subDowiIndData = malloc(sizeof(BalSubscriberTerminalDowiData));
+ memset(subDowiIndData, 0, sizeof(BalSubscriberTerminalDowiData));
+ bal_subscriber_terminal_dowi_data__init(subDowiIndData);
+ balIndCfg->terminal_dowi->data = subDowiIndData;
- balIndCfg->terminal_ind->data->has_admin_state = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->admin_state = sub_ind->data.admin_state;
- balIndCfg->terminal_ind->data->has_oper_status = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->oper_status = sub_ind->data.oper_status;
- balIndCfg->terminal_ind->data->has_svc_port_id = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->svc_port_id = sub_ind->data.svc_port_id;
- balIndCfg->terminal_ind->data->has_ds_tm = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->ds_tm = sub_ind->data.ds_tm;
- balIndCfg->terminal_ind->data->has_us_tm = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->us_tm = sub_ind->data.us_tm;
- balIndCfg->terminal_ind->data->has_sub_term_rate = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->sub_term_rate = sub_ind->data.sub_term_rate;
- char *password = malloc(sizeof(char)*MAX_CHAR_LENGTH*2);
- memset(password, 0, MAX_CHAR_LENGTH*2);
- strcpy(password,(const char *)sub_ind->data.password.arr);
- balIndCfg->terminal_ind->data->password = password;
- char *registration_id = malloc(sizeof(char)*MAX_CHAR_LENGTH*8);
- memset(registration_id, 0, MAX_CHAR_LENGTH*8);
- strcpy(registration_id,(const char *)sub_ind->data.registration_id.arr);
- balIndCfg->terminal_ind->data->registration_id = registration_id;
+ balIndCfg->terminal_dowi->data->has_dowi_status = BAL_GRPC_PRES;
+ balIndCfg->terminal_dowi->data->dowi_status = sub_dowi_ind->data.dowi_status;
-#if 0
- balIndCfg->terminal_ind->data->has_mac_address = BAL_GRPC_PRES;
- balIndCfg->terminal_ind->data->mac_address.len =
- (BCMOS_ETH_ALEN)*sizeof(sub_ind->data.mac_address.u8);
- uint8_t mac_address[balIndCfg->terminal_ind->data->mac_address.len];
- memset(&mac_address, 0 ,balIndCfg->terminal_ind->data->mac_address.len);
- strcpy((char *)mac_address,(const char *)sub_ind->data.mac_address.u8);
- balIndCfg->terminal_ind->data->mac_address.data = mac_address;
-#endif
+ balIndCfg->terminal_dowi->data->has_drift_value = BAL_GRPC_PRES;
+ balIndCfg->terminal_dowi->data->drift_value = sub_dowi_ind->data.drift_value;
- BalSerialNumber *serialNum;
- serialNum = malloc(sizeof(BalSerialNumber));
- memset(serialNum, 0, sizeof(BalSerialNumber));
- bal_serial_number__init(serialNum);
- balIndCfg->terminal_ind->data->serial_number = serialNum;
-
- //ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor id is %s", sub_ind->data.serial_number.vendor_id);
- //ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor specific is %s", sub_ind->data.serial_number.vendor_specific);
-
- char *vendor_id = malloc(sizeof(char)*MAX_CHAR_LENGTH);
- memset(vendor_id, 0, MAX_CHAR_LENGTH);
- sprintf(vendor_id,"%c%c%c%c",
- sub_ind->data.serial_number.vendor_id[0],
- sub_ind->data.serial_number.vendor_id[1],
- sub_ind->data.serial_number.vendor_id[2],
- sub_ind->data.serial_number.vendor_id[3]);
- balIndCfg->terminal_ind->data->serial_number->vendor_id = vendor_id;
- ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Activation:After decoding:Vendor id is %s",
- balIndCfg->terminal_ind->data->serial_number->vendor_id);
- char *vendor_specific = malloc(sizeof(char)*MAX_CHAR_LENGTH);
- memset(vendor_specific, 0, MAX_CHAR_LENGTH);
- sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X",
- sub_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f,
- sub_ind->data.serial_number.vendor_specific[0] & 0x0f,
- sub_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f,
- sub_ind->data.serial_number.vendor_specific[1] & 0x0f,
- sub_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f,
- sub_ind->data.serial_number.vendor_specific[2] & 0x0f,
- sub_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f,
- sub_ind->data.serial_number.vendor_specific[3] & 0x0f);
- balIndCfg->terminal_ind->data->serial_number->vendor_specific = vendor_specific;
- ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Activation:After decoding:Vendor specific is %s",
- balIndCfg->terminal_ind->data->serial_number->vendor_specific);
- ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Activation:After decoding:Registration ID is %s",
- balIndCfg->terminal_ind->data->registration_id);
-
- BalIdList *balAggportList;
- balAggportList = malloc(sizeof(BalIdList));
- memset(balAggportList, 0, sizeof(BalIdList));
- bal_id_list__init(balAggportList);
- balIndCfg->terminal_ind->data->agg_port_id_list = balAggportList;
-
-#if 0
- balIndCfg->terminal_ind->data->agg_port_id_list->n_val = sub_ind->data.agg_port_id_list.len;
- uint32_t agg_port_id_list[balIndCfg->terminal_ind->data->agg_port_id_list->n_val];
- memset(&agg_port_id_list, 0, balIndCfg->terminal_ind->data->agg_port_id_list->n_val);
- strcpy((char *)agg_port_id_list,(const char *)sub_ind->data.agg_port_id_list.val);
- balIndCfg->terminal_ind->data->agg_port_id_list->val = agg_port_id_list;
-#endif
+ balIndCfg->terminal_dowi->data->has_new_eqd = BAL_GRPC_PRES;
+ balIndCfg->terminal_dowi->data->new_eqd = sub_dowi_ind->data.new_eqd;
list_node *bal_indication_node = malloc(sizeof(list_node));
bal_indication_node->bal_indication = balIndCfg;
@@ -1406,39 +882,20 @@
add_bal_indication_node(bal_indication_node);
pthread_mutex_unlock(&bal_ind_queue_lock);
}
-
return result;
}
/********************************************************************\
- * Function : fill_bal_tm_red *
- * Description : This function will fill grpc-BalTmred struture *
- * from bal-bcmbal_tm_red structure *
+ * Function : bal_sub_term_looci_indication_cb *
+ * Description : This function will handle looci indication *
* *
********************************************************************/
-void fill_bal_tm_red(BalTmred *grpc_red, bcmbal_tm_red *bal_red)
+bcmos_errno bal_sub_term_looci_indication_cb(bcmbal_obj *obj)
{
- grpc_red->has_min_threshold = BAL_GRPC_PRES;
- grpc_red->min_threshold = bal_red->min_threshold;
- grpc_red->has_max_threshold = BAL_GRPC_PRES;
- grpc_red->max_threshold = bal_red->max_threshold;
- grpc_red->has_max_probability = BAL_GRPC_PRES;
- grpc_red->max_probability = bal_red->max_probability;
- return;
-}
+bcmos_errno result = BCM_ERR_OK;
-/********************************************************************\
- * Function : bal_tm_queue_indication_cb *
- * Description : This function will handle the indications for *
- * TM Queue indication *
- * *
- ********************************************************************/
-bcmos_errno bal_tm_queue_indication_cb(bcmbal_obj *obj)
-{
- bcmos_errno result = BCM_ERR_OK;
-
- if(BCMBAL_OBJ_ID_TM_QUEUE != obj->obj_type ||
- bcmbal_tm_queue_auto_id_ind != obj->subgroup)
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ bcmbal_subscriber_terminal_auto_id_looci != obj->subgroup)
{
ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
@@ -1450,148 +907,390 @@
balIndCfg = malloc(sizeof(BalIndications));
memset(balIndCfg, 0, sizeof(BalIndications));
bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_TM_QUEUE__IND;
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_LOOCI;
balIndCfg->has_objtype = BAL_GRPC_PRES;
balIndCfg->objtype = obj->obj_type;
balIndCfg->has_sub_group = BAL_GRPC_PRES;
balIndCfg->sub_group = obj->subgroup;
balIndCfg->device_id = voltha_device_id;
- bcmbal_tm_queue_ind *tm_que_ind = (bcmbal_tm_queue_ind *)obj;
+ bcmbal_subscriber_terminal_looci *sub_looci_ind =
+ (bcmbal_subscriber_terminal_looci *)obj;
- BalTmQueueInd *tmQueInd;
- tmQueInd = malloc(sizeof(BalTmQueueInd));
- memset(tmQueInd, 0, sizeof(BalTmQueueInd));
- bal_tm_queue_ind__init(tmQueInd);
- balIndCfg->tm_queue_ind = tmQueInd;
+ BalSubscriberTerminalLooci *subLoociInd;
+ subLoociInd = malloc(sizeof(BalSubscriberTerminalLooci));
+ memset(subLoociInd, 0, sizeof(BalSubscriberTerminalLooci));
+ bal_subscriber_terminal_looci__init(subLoociInd);
+ balIndCfg->terminal_looci= subLoociInd;
- BalTmQueueKey *tmQkey;
- tmQkey = malloc(sizeof(BalTmQueueKey));
- memset(tmQkey, 0, sizeof(BalTmQueueKey));
- bal_tm_queue_key__init(tmQkey);
- balIndCfg->tm_queue_ind->key = tmQkey;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
- balIndCfg->tm_queue_ind->key->has_sched_id = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->key->sched_id = tm_que_ind->key.sched_id;
- balIndCfg->tm_queue_ind->key->has_sched_dir = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->key->sched_dir = tm_que_ind->key.sched_dir;
- balIndCfg->tm_queue_ind->key->has_id = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->key->id = tm_que_ind->key.id;
+ BalSubscriberTerminalKey *subkey;
+ subkey = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(subkey);
+ balIndCfg->terminal_looci->key = subkey;
- BalTmQueueIndData *tmQIndData;
- tmQIndData = malloc(sizeof(BalTmQueueIndData));
- memset(tmQIndData, 0, sizeof(BalTmQueueIndData));
- bal_tm_queue_ind_data__init(tmQIndData);
- balIndCfg->tm_queue_ind->data = tmQIndData;
+ balIndCfg->terminal_looci->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_looci->key->intf_id = sub_looci_ind->key.intf_id;
+ balIndCfg->terminal_looci->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_looci->key->sub_term_id = sub_looci_ind->key.sub_term_id;
- balIndCfg->tm_queue_ind->data->has_priority = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->priority = tm_que_ind->data.priority;
- balIndCfg->tm_queue_ind->data->has_weight = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->weight = tm_que_ind->data.weight;
- balIndCfg->tm_queue_ind->data->has_create_mode = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->create_mode = tm_que_ind->data.create_mode;
- balIndCfg->tm_queue_ind->data->has_ref_count = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->ref_count = tm_que_ind->data.ref_count;
+ BalSubscriberTerminalLoociData *subLoociIndData;
+ subLoociIndData = malloc(sizeof(BalSubscriberTerminalLoociData));
+ memset(subLoociIndData, 0, sizeof(BalSubscriberTerminalLoociData));
+ bal_subscriber_terminal_looci_data__init(subLoociIndData);
+ balIndCfg->terminal_looci->data = subLoociIndData;
- BalTmShaping *balShape;
- balShape = malloc(sizeof(BalTmShaping));
- memset(balShape, 0, sizeof(BalTmShaping));
- bal_tm_shaping__init(balShape);
- balIndCfg->tm_queue_ind->data->rate = balShape;
+ balIndCfg->terminal_looci->data->has_looci_status = BAL_GRPC_PRES;
+ balIndCfg->terminal_looci->data->looci_status = sub_looci_ind->data.looci_status;
- balIndCfg->tm_queue_ind->data->rate->has_presence_mask = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->rate->presence_mask = tm_que_ind->data.rate.presence_mask;
- balIndCfg->tm_queue_ind->data->rate->has_cir = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->rate->cir = tm_que_ind->data.rate.cir;
- balIndCfg->tm_queue_ind->data->rate->has_pir = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->rate->pir = tm_que_ind->data.rate.pir;
- balIndCfg->tm_queue_ind->data->rate->has_burst = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->rate->burst = tm_que_ind->data.rate.burst;
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
- BalTmBac *balBac;
- balBac = malloc(sizeof(BalTmBac));
- memset(balBac, 0, sizeof(BalTmBac));
- bal_tm_bac__init(balBac);
- balIndCfg->tm_queue_ind->data->bac = balBac;
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ }
+ return result;
+}
- balIndCfg->tm_queue_ind->data->bac->has_type = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->bac->type = tm_que_ind->data.bac.type;
- switch(tm_que_ind->data.bac.type)
- {
- case BCMBAL_TM_BAC_TYPE_TAILDROP:
- {
- balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_TAILDROP;
- BalTMBacTaildrop *balTaildrop;
- balTaildrop = malloc(sizeof(BalTMBacTaildrop));
- memset(balTaildrop, 0, sizeof(BalTMBacTaildrop));
- bal_tmbac_taildrop__init(balTaildrop);
- balIndCfg->tm_queue_ind->data->bac->taildrop = balTaildrop;
+/********************************************************************\
+ * Function : bal_sub_term_processing_error_indication_cb *
+ * Description : This function will handle sub term processing error*
+ * *
+ ********************************************************************/
+bcmos_errno bal_sub_term_processing_error_indication_cb(bcmbal_obj *obj)
+{
+bcmos_errno result = BCM_ERR_OK;
- balIndCfg->tm_queue_ind->data->bac->taildrop->has_max_size = BAL_GRPC_PRES;
- balIndCfg->tm_queue_ind->data->bac->taildrop->max_size =
- tm_que_ind->data.bac.u.taildrop.max_size;
- }
- break;
- case BCMBAL_TM_BAC_TYPE_WTAILDROP:
- {
- /* No bal/grpc structure was defined */
- }
- break;
- case BCMBAL_TM_BAC_TYPE_RED:
- {
- balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_RED;
- BalTMBacRed *balBacRed;
- balBacRed = malloc(sizeof(BalTMBacRed));
- memset(balBacRed, 0, sizeof(BalTMBacRed));
- bal_tmbac_red__init(balBacRed);
- balIndCfg->tm_queue_ind->data->bac->red = balBacRed;
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ bcmbal_subscriber_terminal_auto_id_processing_error != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_PROC_ERR;
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->device_id = voltha_device_id;
- BalTmred *balRed;
- balRed = malloc(sizeof(BalTmred));
- memset(balRed, 0, sizeof(BalTmred));
- bal_tmred__init(balRed);
- balIndCfg->tm_queue_ind->data->bac->red->red = balRed;
- fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->red->red, &tm_que_ind->data.bac.u.red.red);
- }
- break;
- case BCMBAL_TM_BAC_TYPE_WRED:
- {
- balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_WRED;
- BalTMBacWred *balBacWred;
- balBacWred = malloc(sizeof(BalTMBacWred));
- memset(balBacWred, 0, sizeof(BalTMBacWred));
- bal_tmbac_wred__init(balBacWred);
- balIndCfg->tm_queue_ind->data->bac->wred = balBacWred;
+ bcmbal_subscriber_terminal_processing_error *sub_proc_err_ind =
+ (bcmbal_subscriber_terminal_processing_error *)obj;
- BalTmred *balGreen;
- balGreen = malloc(sizeof(BalTmred));
- memset(balGreen, 0, sizeof(BalTmred));
- bal_tmred__init(balGreen);
- balIndCfg->tm_queue_ind->data->bac->wred->green = balGreen;
- fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->wred->green, &tm_que_ind->data.bac.u.wred.green);
+ BalSubscriberTerminalProcessingError *subProcErrInd;
+ subProcErrInd = malloc(sizeof(BalSubscriberTerminalProcessingError));
+ memset(subProcErrInd, 0, sizeof(BalSubscriberTerminalProcessingError));
+ bal_subscriber_terminal_processing_error__init(subProcErrInd);
+ balIndCfg->terminal_proc_err= subProcErrInd;
- BalTmred *balYellow;
- balYellow = malloc(sizeof(BalTmred));
- memset(balYellow, 0, sizeof(BalTmred));
- bal_tmred__init(balYellow);
- balIndCfg->tm_queue_ind->data->bac->wred->yellow = balYellow;
- fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->wred->yellow, &tm_que_ind->data.bac.u.wred.yellow);
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
- BalTmred *balRed;
- balRed = malloc(sizeof(BalTmred));
- memset(balRed, 0, sizeof(BalTmred));
- bal_tmred__init(balRed);
- balIndCfg->tm_queue_ind->data->bac->wred->red = balRed;
- fill_bal_tm_red(balIndCfg->tm_queue_ind->data->bac->wred->red, &tm_que_ind->data.bac.u.wred.red);
- }
- break;
- default:
- {
- balIndCfg->tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U__NOT_SET;
- }
- break;
+ BalSubscriberTerminalKey *subkey;
+ subkey = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(subkey);
+ balIndCfg->terminal_proc_err->key = subkey;
- }
+ balIndCfg->terminal_proc_err->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_proc_err->key->intf_id = sub_proc_err_ind->key.intf_id;
+ balIndCfg->terminal_proc_err->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_proc_err->key->sub_term_id = sub_proc_err_ind->key.sub_term_id;
+
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ }
+ return result;
+}
+
+/********************************************************************\
+ * Function : bal_sub_term_sdi_indication_cb *
+ * Description : This function will handle sdi indication *
+ * *
+ ********************************************************************/
+bcmos_errno bal_sub_term_sdi_indication_cb(bcmbal_obj *obj)
+{
+bcmos_errno result = BCM_ERR_OK;
+
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ bcmbal_subscriber_terminal_auto_id_sdi != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SDI;
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->device_id = voltha_device_id;
+
+ bcmbal_subscriber_terminal_sdi *sub_sdi_ind =
+ (bcmbal_subscriber_terminal_sdi *)obj;
+
+ BalSubscriberTerminalSdi *subSdiInd;
+ subSdiInd = malloc(sizeof(BalSubscriberTerminalSdi));
+ memset(subSdiInd, 0, sizeof(BalSubscriberTerminalSdi));
+ bal_subscriber_terminal_sdi__init(subSdiInd);
+ balIndCfg->terminal_sdi= subSdiInd;
+
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
+
+ BalSubscriberTerminalKey *subkey;
+ subkey = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(subkey);
+ balIndCfg->terminal_sdi->key = subkey;
+
+ balIndCfg->terminal_sdi->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sdi->key->intf_id = sub_sdi_ind->key.intf_id;
+ balIndCfg->terminal_sdi->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sdi->key->sub_term_id = sub_sdi_ind->key.sub_term_id;
+
+ BalSubscriberTerminalSdiData *subSdiIndData;
+ subSdiIndData = malloc(sizeof(BalSubscriberTerminalSdiData));
+ memset(subSdiIndData, 0, sizeof(BalSubscriberTerminalSdiData));
+ bal_subscriber_terminal_sdi_data__init(subSdiIndData);
+ balIndCfg->terminal_sdi->data = subSdiIndData;
+
+ balIndCfg->terminal_sdi->data->has_sdi_status = BAL_GRPC_PRES;
+ balIndCfg->terminal_sdi->data->sdi_status = sub_sdi_ind->data.sdi_status;
+
+ balIndCfg->terminal_sdi->data->has_ber = BAL_GRPC_PRES;
+ balIndCfg->terminal_sdi->data->ber = sub_sdi_ind->data.ber;
+
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ }
+ return result;
+}
+
+/********************************************************************\
+ * Function : bal_sub_term_sfi_indication_cb *
+ * Description : This function will handle sfi indication *
+ * *
+ ********************************************************************/
+bcmos_errno bal_sub_term_sfi_indication_cb(bcmbal_obj *obj)
+{
+bcmos_errno result = BCM_ERR_OK;
+
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ bcmbal_subscriber_terminal_auto_id_sfi != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SFI;
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->device_id = voltha_device_id;
+
+ bcmbal_subscriber_terminal_sfi *sub_sfi_ind =
+ (bcmbal_subscriber_terminal_sfi *)obj;
+
+ BalSubscriberTerminalSfi *subSfiInd;
+ subSfiInd = malloc(sizeof(BalSubscriberTerminalSfi));
+ memset(subSfiInd, 0, sizeof(BalSubscriberTerminalSfi));
+ bal_subscriber_terminal_sfi__init(subSfiInd);
+ balIndCfg->terminal_sfi= subSfiInd;
+
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
+
+ BalSubscriberTerminalKey *subkey;
+ subkey = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(subkey);
+ balIndCfg->terminal_sfi->key = subkey;
+
+ balIndCfg->terminal_sfi->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sfi->key->intf_id = sub_sfi_ind->key.intf_id;
+ balIndCfg->terminal_sfi->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sfi->key->sub_term_id = sub_sfi_ind->key.sub_term_id;
+
+ BalSubscriberTerminalSfiData *subSfiIndData;
+ subSfiIndData = malloc(sizeof(BalSubscriberTerminalSfiData));
+ memset(subSfiIndData, 0, sizeof(BalSubscriberTerminalSfiData));
+ bal_subscriber_terminal_sfi_data__init(subSfiIndData);
+ balIndCfg->terminal_sfi->data = subSfiIndData;
+
+ balIndCfg->terminal_sfi->data->has_sfi_status = BAL_GRPC_PRES;
+ balIndCfg->terminal_sfi->data->sfi_status = sub_sfi_ind->data.sfi_status;
+
+ balIndCfg->terminal_sfi->data->has_ber = BAL_GRPC_PRES;
+ balIndCfg->terminal_sfi->data->ber = sub_sfi_ind->data.ber;
+
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ }
+ return result;
+}
+
+/********************************************************************\
+ * Function : bal_sub_term_act_fail_indication_cb *
+ * Description : This function will handle sub term activation fail *
+ * indication *
+ * *
+ ********************************************************************/
+bcmos_errno bal_sub_term_act_fail_indication_cb(bcmbal_obj *obj)
+{
+bcmos_errno result = BCM_ERR_OK;
+
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ bcmbal_subscriber_terminal_auto_id_sub_term_act_fail != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SUB_TERM_ACT_FAIL;
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->device_id = voltha_device_id;
+
+ bcmbal_subscriber_terminal_sub_term_act_fail *sub_term_act_fail_ind =
+ (bcmbal_subscriber_terminal_sub_term_act_fail *)obj;
+
+ BalSubscriberTerminalSubTermActFail *subTermActFailInd;
+ subTermActFailInd = malloc(sizeof(BalSubscriberTerminalSubTermActFail));
+ memset(subTermActFailInd, 0, sizeof(BalSubscriberTerminalSubTermActFail));
+ bal_subscriber_terminal_sub_term_act_fail__init(subTermActFailInd);
+ balIndCfg->terminal_sub_term_act_fail= subTermActFailInd;
+
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
+
+ BalSubscriberTerminalKey *subkey;
+ subkey = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(subkey);
+ balIndCfg->terminal_sub_term_act_fail->key = subkey;
+
+ balIndCfg->terminal_sub_term_act_fail->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sub_term_act_fail->key->intf_id = sub_term_act_fail_ind->key.intf_id;
+ balIndCfg->terminal_sub_term_act_fail->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sub_term_act_fail->key->sub_term_id = sub_term_act_fail_ind->key.sub_term_id;
+
+ BalSubscriberTerminalSubTermActFailData *subTermActFailIndData;
+ subTermActFailIndData = malloc(sizeof(BalSubscriberTerminalSubTermActFailData));
+ memset(subTermActFailIndData, 0, sizeof(BalSubscriberTerminalSubTermActFailData));
+ bal_subscriber_terminal_sub_term_act_fail_data__init(subTermActFailIndData);
+ balIndCfg->terminal_sub_term_act_fail->data = subTermActFailIndData;
+
+ balIndCfg->terminal_sub_term_act_fail->data->has_fail_reason = BAL_GRPC_PRES;
+ balIndCfg->terminal_sub_term_act_fail->data->fail_reason = sub_term_act_fail_ind->data.fail_reason;
+
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ }
+ return result;
+}
+
+/********************************************************************\
+ * Function : bal_sub_term_sufi_indication_cb *
+ * Description : This function will handle sufi indication *
+ * *
+ ********************************************************************/
+bcmos_errno bal_sub_term_sufi_indication_cb(bcmbal_obj *obj)
+{
+ bcmos_errno result = BCM_ERR_OK;
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ bcmbal_subscriber_terminal_auto_id_sufi != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SUFI;
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->device_id = voltha_device_id;
+
+ bcmbal_subscriber_terminal_sufi *sub_sufi_ind =
+ (bcmbal_subscriber_terminal_sufi *)obj;
+
+ BalSubscriberTerminalSufi *subSufiInd;
+ subSufiInd = malloc(sizeof(BalSubscriberTerminalSufi));
+ memset(subSufiInd, 0, sizeof(BalSubscriberTerminalSufi));
+ bal_subscriber_terminal_sufi__init(subSufiInd);
+ balIndCfg->terminal_sufi= subSufiInd;
+
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
+
+ BalSubscriberTerminalKey *subkey;
+ subkey = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(subkey, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(subkey);
+ balIndCfg->terminal_sufi->key = subkey;
+
+ balIndCfg->terminal_sufi->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sufi->key->intf_id = sub_sufi_ind->key.intf_id;
+ balIndCfg->terminal_sufi->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_sufi->key->sub_term_id = sub_sufi_ind->key.sub_term_id;
+
+ BalSubscriberTerminalSufiData *subSufiIndData;
+ subSufiIndData = malloc(sizeof(BalSubscriberTerminalSufiData));
+ memset(subSufiIndData, 0, sizeof(BalSubscriberTerminalSufiData));
+ bal_subscriber_terminal_sufi_data__init(subSufiIndData);
+ balIndCfg->terminal_sufi->data = subSufiIndData;
+
+ balIndCfg->terminal_sufi->data->has_sufi_status = BAL_GRPC_PRES;
+ balIndCfg->terminal_sufi->data->sufi_status = sub_sufi_ind->data.sufi_status;
list_node *bal_indication_node = malloc(sizeof(list_node));
bal_indication_node->bal_indication = balIndCfg;
@@ -1605,17 +1304,90 @@
}
/********************************************************************\
- * Function : bal_tm_sched_indication_cb *
- * Description : This function will handle the indications for *
- * TM Sched indication *
+ * Function : bal_sub_term_tiwi_indication_cb *
+ * Description : This function will handle tiwi indication *
* *
********************************************************************/
-bcmos_errno bal_tm_sched_indication_cb(bcmbal_obj *obj)
+bcmos_errno bal_sub_term_tiwi_indication_cb(bcmbal_obj *obj)
+{
+ bcmos_errno result = BCM_ERR_OK;
+ if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type ||
+ BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_TIWI != obj->subgroup)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
+ bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
+ result = BCM_ERR_INTERNAL;
+ }
+ else
+ {
+ BalIndications *balIndCfg;
+ balIndCfg = malloc(sizeof(BalIndications));
+ memset(balIndCfg, 0, sizeof(BalIndications));
+ bal_indications__init(balIndCfg);
+ balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_TIWI;
+ balIndCfg->has_objtype = BAL_GRPC_PRES;
+ balIndCfg->objtype = obj->obj_type;
+ balIndCfg->has_sub_group = BAL_GRPC_PRES;
+ balIndCfg->sub_group = obj->subgroup;
+ balIndCfg->device_id = voltha_device_id;
+
+ bcmbal_subscriber_terminal_tiwi *sub_term_tiwi =
+ (bcmbal_subscriber_terminal_tiwi *)obj;
+
+ BalSubscriberTerminalTiwi *subTermTiwi;
+ subTermTiwi = malloc(sizeof(BalSubscriberTerminalTiwi));
+ memset(subTermTiwi, 0, sizeof(BalSubscriberTerminalTiwi));
+ bal_subscriber_terminal_tiwi__init(subTermTiwi);
+ balIndCfg->terminal_tiwi = subTermTiwi;
+
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
+
+ BalSubscriberTerminalKey *sub_term_key;
+ sub_term_key = malloc(sizeof(BalSubscriberTerminalKey));
+ memset(sub_term_key, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(sub_term_key);
+ balIndCfg->terminal_tiwi->key = sub_term_key;
+
+ balIndCfg->terminal_tiwi->key->has_sub_term_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_tiwi->key->sub_term_id = sub_term_tiwi->key.sub_term_id;
+ balIndCfg->terminal_tiwi->key->has_intf_id = BAL_GRPC_PRES;
+ balIndCfg->terminal_tiwi->key->intf_id = sub_term_tiwi->key.intf_id;
+
+ BalSubscriberTerminalTiwiData *sub_term_tiwi_data;
+ sub_term_tiwi_data = malloc(sizeof(BalSubscriberTerminalTiwiData));
+ memset(sub_term_tiwi_data, 0, sizeof(BalSubscriberTerminalTiwiData));
+ bal_subscriber_terminal_tiwi_data__init(sub_term_tiwi_data);
+ balIndCfg->terminal_tiwi->data = sub_term_tiwi_data;
+
+ balIndCfg->terminal_tiwi->data->has_tiwi_status = BAL_GRPC_PRES;
+ balIndCfg->terminal_tiwi->data->tiwi_status = sub_term_tiwi->data.tiwi_status;
+
+ balIndCfg->terminal_tiwi->data->has_drift_value = BAL_GRPC_PRES;
+ balIndCfg->terminal_tiwi->data->drift_value = sub_term_tiwi->data.drift_value;
+
+ list_node *bal_indication_node = malloc(sizeof(list_node));
+ bal_indication_node->bal_indication = balIndCfg;
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ add_bal_indication_node(bal_indication_node);
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+ }
+
+ return result;
+}
+
+/********************************************************************\
+ * Function : bal_tm_sched_auto_id_oper_status_change_cb *
+ * Description : This function will handle tm sched operation status*
+ * change indication *
+ * *
+ ********************************************************************/
+bcmos_errno bal_tm_sched_auto_id_oper_status_change_cb(bcmbal_obj *obj)
{
bcmos_errno result = BCM_ERR_OK;
if(BCMBAL_OBJ_ID_TM_SCHED != obj->obj_type ||
- bcmbal_tm_sched_auto_id_ind != obj->subgroup)
+ bcmbal_tm_sched_auto_id_oper_status_change != obj->subgroup)
{
ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)",
bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status));
@@ -1627,38 +1399,47 @@
balIndCfg = malloc(sizeof(BalIndications));
memset(balIndCfg, 0, sizeof(BalIndications));
bal_indications__init(balIndCfg);
- balIndCfg->u_case = BAL_INDICATIONS__U_TM_SCHED__IND;
+ balIndCfg->u_case = BAL_INDICATIONS__U_TM_SCHED_OPER_STATS_CHANGE;
balIndCfg->has_objtype = BAL_GRPC_PRES;
balIndCfg->objtype = obj->obj_type;
balIndCfg->has_sub_group = BAL_GRPC_PRES;
balIndCfg->sub_group = obj->subgroup;
balIndCfg->device_id = voltha_device_id;
- bcmbal_tm_sched_ind *tm_sched_ind = (bcmbal_tm_sched_ind *)obj;
+ bcmbal_tm_sched_oper_status_change *tm_sched_osc =
+ (bcmbal_tm_sched_oper_status_change *)obj;
- BalTmSchedInd *tmSchedInd;
- tmSchedInd = malloc(sizeof(BalTmSchedInd));
- memset(tmSchedInd, 0, sizeof(BalTmSchedInd));
- bal_tm_sched_ind__init(tmSchedInd);
- balIndCfg->tm_sched_ind = tmSchedInd;
+ BalTmSchedOperStatusChange *tmSchedOsc;
+ tmSchedOsc = malloc(sizeof(BalTmSchedOperStatusChange));
+ memset(tmSchedOsc, 0, sizeof(BalTmSchedOperStatusChange));
+ bal_tm_sched_oper_status_change__init(tmSchedOsc);
+ balIndCfg->tm_sched_oper_stats_change = tmSchedOsc;
- BalTmSchedKey *tmSchedkey;
- tmSchedkey = malloc(sizeof(BalTmSchedKey));
- memset(tmSchedkey, 0, sizeof(BalTmSchedKey));
- bal_tm_sched_key__init(tmSchedkey);
- balIndCfg->tm_sched_ind->key = tmSchedkey;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
- balIndCfg->tm_sched_ind->key->has_dir = BAL_GRPC_PRES;
- balIndCfg->tm_sched_ind->key->dir = tm_sched_ind->key.dir;
- balIndCfg->tm_sched_ind->key->has_id = BAL_GRPC_PRES;
- balIndCfg->tm_sched_ind->key->id = tm_sched_ind->key.id;
+ BalTmSchedKey *tmSchedKey;
+ tmSchedKey = malloc(sizeof(BalTmSchedKey));
+ memset(tmSchedKey, 0, sizeof(BalTmSchedKey));
+ bal_tm_sched_key__init(tmSchedKey);
+ balIndCfg->tm_sched_oper_stats_change->key = tmSchedKey;
- BalTmSchedIndData *tmSIndData;
- tmSIndData = malloc(sizeof(BalTmSchedIndData));
- memset(tmSIndData, 0, sizeof(BalTmSchedIndData));
- bal_tm_sched_ind_data__init(tmSIndData);
- balIndCfg->tm_sched_ind->data = tmSIndData;
- /* TODO: data should be populate */
+ balIndCfg->tm_sched_oper_stats_change->key->has_dir = BAL_GRPC_PRES;
+ balIndCfg->tm_sched_oper_stats_change->key->dir = tm_sched_osc->key.dir;
+ balIndCfg->tm_sched_oper_stats_change->key->has_id = BAL_GRPC_PRES;
+ balIndCfg->tm_sched_oper_stats_change->key->id = tm_sched_osc->key.id;
+
+ BalTmSchedOperStatusChangeData *tmschedOscData;
+ tmschedOscData = malloc(sizeof(BalTmSchedOperStatusChangeData));
+ memset(tmschedOscData, 0, sizeof(BalTmSchedOperStatusChangeData));
+ bal_tm_sched_oper_status_change_data__init(tmschedOscData);
+ balIndCfg->tm_sched_oper_stats_change->data = tmschedOscData;
+
+ balIndCfg->tm_sched_oper_stats_change->data->has_new_oper_status = BAL_GRPC_PRES;
+ balIndCfg->tm_sched_oper_stats_change->data->new_oper_status =
+ tm_sched_osc->data.new_oper_status;
+ balIndCfg->tm_sched_oper_stats_change->data->has_old_oper_status = BAL_GRPC_PRES;
+ balIndCfg->tm_sched_oper_stats_change->data->old_oper_status =
+ tm_sched_osc->data.old_oper_status;
list_node *bal_indication_node = malloc(sizeof(list_node));
bal_indication_node->bal_indication = balIndCfg;
@@ -1709,11 +1490,7 @@
bal_packet_bearer_channel_rx__init(rxChannel);
balIndCfg->pktdata = rxChannel;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->pktdata->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalPacketKey *packetkey;
packetkey = malloc(sizeof(BalPacketKey));
@@ -1763,10 +1540,6 @@
BAL_GRPC_PRES;
balIndCfg->pktdata->key->packet_send_dest->sub_term->sub_term_id =
rx_channel->key.packet_send_dest.u.sub_term.sub_term_id;
- balIndCfg->pktdata->key->packet_send_dest->sub_term->has_sub_term_uni =
- BAL_GRPC_PRES;
- balIndCfg->pktdata->key->packet_send_dest->sub_term->sub_term_uni =
- rx_channel->key.packet_send_dest.u.sub_term.sub_term_uni;
balIndCfg->pktdata->key->packet_send_dest->sub_term->has_intf_id =
BAL_GRPC_PRES;
balIndCfg->pktdata->key->packet_send_dest->sub_term->intf_id =
@@ -1871,11 +1644,7 @@
bal_packet_itu_omci_channel_rx__init(omciChannel);
balIndCfg->balomciresp = omciChannel;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->balomciresp->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalPacketKey *packetkey;
packetkey = malloc(sizeof(BalPacketKey));
@@ -1992,11 +1761,7 @@
bal_packet_ieee_oam_channel_rx__init(oamChannel);
balIndCfg->baloamresp = oamChannel;
- BalObj *hdr;
- hdr = malloc(sizeof(BalObj));
- memset(hdr, 0, sizeof(BalObj));
- bal_obj__init(hdr);
- balIndCfg->baloamresp->hdr = hdr;
+ /*'hdr' field is not parsed by voltha adapter, hence not filled */
BalPacketKey *packetkey;
packetkey = malloc(sizeof(BalPacketKey));
diff --git a/src/bal_indications_hdlr.h b/src/bal_indications_hdlr.h
index 84b8e27..563fff9 100755
--- a/src/bal_indications_hdlr.h
+++ b/src/bal_indications_hdlr.h
@@ -36,20 +36,24 @@
extern bcmos_errno bal_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_acc_term_osc_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_acc_term_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_acc_term_processing_error_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_flow_osc_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_flow_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_group_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_flow_processing_error_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_interface_osc_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_interface_los_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_interface_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_sub_term_osc_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_sub_term_disc_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_sub_term_alarm_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_sub_term_dgi_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_sub_term_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_tm_queue_indication_cb(bcmbal_obj *obj);
-extern bcmos_errno bal_tm_sched_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_dowi_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_looci_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_processing_error_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_sdi_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_sfi_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_act_fail_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_sufi_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_sub_term_tiwi_indication_cb(bcmbal_obj *obj);
+extern bcmos_errno bal_tm_sched_auto_id_oper_status_change_cb(bcmbal_obj *obj);
extern bcmos_errno bal_packet_data_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_omci_data_indication_cb(bcmbal_obj *obj);
extern bcmos_errno bal_oam_data_indication_cb(bcmbal_obj *obj);
diff --git a/src/bal_interface_hdlr.c b/src/bal_interface_hdlr.c
index f59be37..ea70c08 100755
--- a/src/bal_interface_hdlr.c
+++ b/src/bal_interface_hdlr.c
@@ -61,18 +61,10 @@
interface_cfg->data->transceiver_type);
ASFVOLT_LOG(ASFVOLT_INFO, "Setting transceiver_type to : %d", interface_cfg->data->transceiver_type);
- ASFVOLT_CFG_PROP_SET(interface_obj, interface, ds_miss_mode,
- interface_cfg->data->has_ds_miss_mode,
- interface_cfg->data->ds_miss_mode);
-
ASFVOLT_CFG_PROP_SET(interface_obj, interface, mtu,
interface_cfg->data->has_mtu,
interface_cfg->data->mtu);
- ASFVOLT_CFG_PROP_SET(interface_obj, interface, flow_control,
- interface_cfg->data->has_flow_control,
- interface_cfg->data->flow_control);
-
ASFVOLT_CFG_PROP_SET(interface_obj, interface, ds_tm,
interface_cfg->data->has_ds_tm,
interface_cfg->data->ds_tm);
@@ -101,25 +93,14 @@
* Description : get the PON and NNI interfaces *
* of OLT Device *
********************************************************************/
-uint32_t bal_interface_cfg_get(BalInterfaceKey *interface_cfg_key,
- BalInterfaceCfg *interface_cfg)
+uint32_t bal_interface_cfg_get(BalInterfaceCfg *interface_cfg)
{
bcmos_errno err = BCM_ERR_OK;
bcmbal_interface_cfg interface_obj;
bcmbal_interface_key intf_key;
- if((interface_cfg_key->has_intf_id) && (interface_cfg_key->has_intf_type))
- {
- intf_key.intf_id = interface_cfg_key->intf_id;
- intf_key.intf_type = interface_cfg_key->intf_type;
- }
- else
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to get the interface cfg(OLT): Missing Key values "
- "Received key values intf-id(%d), intf-type(%d)",
- interface_cfg_key->intf_id, interface_cfg_key->intf_type);
- return BAL_ERRNO__BAL_ERR_NOENT;
- }
+ intf_key.intf_id = interface_cfg->key->intf_id;
+ intf_key.intf_type = interface_cfg->key->intf_type;
ASFVOLT_LOG(ASFVOLT_DEBUG, "Get interface cfg(for OLT) starts");
/*
@@ -141,7 +122,8 @@
ASFVOLT_LOG(ASFVOLT_INFO, "Get Interface cfg sent to OLT. "
"Interface ID(%d) Interface Type(%d)",
intf_key.intf_id, intf_key.intf_type);
- /* TODO - Add code to call grpc */
+
+ memcpy(interface_cfg->data, &interface_obj, sizeof(bcmbal_interface_cfg_data));
return BAL_ERRNO__BAL_ERR_OK;
}
diff --git a/src/bal_interface_hdlr.h b/src/bal_interface_hdlr.h
index 98d3079..1a40db2 100755
--- a/src/bal_interface_hdlr.h
+++ b/src/bal_interface_hdlr.h
@@ -15,7 +15,6 @@
*/
extern uint32_t bal_interface_cfg_set(BalInterfaceCfg *interface_cfg);
-extern uint32_t bal_interface_cfg_get(BalInterfaceKey *interface_cfg_key,
- BalInterfaceCfg *interface_cfg);
+extern uint32_t bal_interface_cfg_get(BalInterfaceCfg *interface_cfg);
extern uint32_t bal_interface_cfg_clear(BalInterfaceKey *interface_cfg_key);
extern bcmos_errno bal_interface_indication_cb(bcmbal_obj *obj);
diff --git a/src/bal_stats_hdlr.c b/src/bal_stats_hdlr.c
index 7865c7c..ee89d29 100755
--- a/src/bal_stats_hdlr.c
+++ b/src/bal_stats_hdlr.c
@@ -16,8 +16,6 @@
#include "bal_stats_hdlr.h"
-#define BAL_STAT_PRES 1
-
/********************************************************************\
* Function : asfvolt16_bal_stats_get *
* Description : Function to get stats based on *
@@ -53,47 +51,107 @@
* NOTE: When a CLEAR is specified during a NNI stats GET operation,
* all of the NNI stats are cleared, even the ones that are not retrieved.
*/
- err = bcmbal_stat_get(DEFAULT_ATERM_ID, &interface_stats.hdr, BCMOS_TRUE);
+ err = bcmbal_stat_get(DEFAULT_ATERM_ID, &interface_stats.hdr, BCMOS_FALSE);
if(err == BCM_ERR_OK)
{
/*interface key*/
- statKey->has_intf_id = BAL_STAT_PRES;
+ statKey->has_intf_id = BAL_ELEMENT_PRES;
statKey->intf_id = interface_stats.key.intf_id;
- statKey->has_intf_type = BAL_STAT_PRES;
+ statKey->has_intf_type = BAL_ELEMENT_PRES;
statKey->intf_type = interface_stats.key.intf_type;
/*interface stat data*/
- statData->has_rx_bytes = BAL_STAT_PRES;
+ statData->has_rx_bytes = BAL_ELEMENT_PRES;
statData->rx_bytes = interface_stats.data.rx_bytes;
- statData->has_rx_packets = BAL_STAT_PRES;
+ statData->has_rx_packets = BAL_ELEMENT_PRES;
statData->rx_packets = interface_stats.data.rx_packets;
- statData->has_rx_ucast_packets = BAL_STAT_PRES;
+ statData->has_rx_data_bytes = BAL_ELEMENT_PRES;
+ statData->rx_data_bytes = interface_stats.data.rx_data_bytes;
+ statData->has_rx_ucast_packets = BAL_ELEMENT_PRES;
statData->rx_ucast_packets = interface_stats.data.rx_ucast_packets;
- statData->has_rx_mcast_packets = BAL_STAT_PRES;
+ statData->has_rx_mcast_packets = BAL_ELEMENT_PRES;
statData->rx_mcast_packets = interface_stats.data.rx_mcast_packets;
- statData->has_rx_bcast_packets = BAL_STAT_PRES;
+ statData->has_rx_bcast_packets = BAL_ELEMENT_PRES;
statData->rx_bcast_packets = interface_stats.data.rx_bcast_packets;
- statData->has_rx_error_packets = BAL_STAT_PRES;
+ statData->rx_64_packets = BAL_ELEMENT_PRES;
+ statData->rx_64_packets = interface_stats.data.rx_64_packets;
+ statData->has_rx_65_127_packets = BAL_ELEMENT_PRES;
+ statData->rx_65_127_packets = interface_stats.data.rx_65_127_packets;
+ statData->has_rx_128_255_packets = BAL_ELEMENT_PRES;
+ statData->rx_128_255_packets = interface_stats.data.rx_128_255_packets;
+ statData->has_rx_256_511_packets = BAL_ELEMENT_PRES;
+ statData->rx_256_511_packets = interface_stats.data.rx_256_511_packets;
+ statData->has_rx_512_1023_packets = BAL_ELEMENT_PRES;
+ statData->rx_512_1023_packets = interface_stats.data.rx_512_1023_packets;
+ statData->has_rx_1024_1518_packets = BAL_ELEMENT_PRES;
+ statData->rx_1024_1518_packets = interface_stats.data.rx_1024_1518_packets;
+ statData->has_rx_1519_2047_packets = BAL_ELEMENT_PRES;
+ statData->rx_1519_2047_packets = interface_stats.data.rx_1519_2047_packets;
+ statData->has_rx_2048_4095_packets = BAL_ELEMENT_PRES;
+ statData->rx_2048_4095_packets = interface_stats.data.rx_2048_4095_packets;
+ statData->has_rx_4096_9216_packets = BAL_ELEMENT_PRES;
+ statData->rx_4096_9216_packets = interface_stats.data.rx_4096_9216_packets;
+ statData->has_rx_9217_16383_packets = BAL_ELEMENT_PRES;
+ statData->rx_9217_16383_packets = interface_stats.data.rx_9217_16383_packets;
+ statData->has_rx_error_packets = BAL_ELEMENT_PRES;
statData->rx_error_packets = interface_stats.data.rx_error_packets;
- statData->has_rx_unknown_protos = BAL_STAT_PRES;
+ statData->has_rx_unknown_protos = BAL_ELEMENT_PRES;
statData->rx_unknown_protos = interface_stats.data.rx_unknown_protos;
- statData->has_tx_bytes = BAL_STAT_PRES;
- statData->tx_bytes = interface_stats.data.tx_bytes;
- statData->has_tx_packets = BAL_STAT_PRES;
- statData->tx_packets = interface_stats.data.tx_packets;
- statData->has_tx_ucast_packets = BAL_STAT_PRES;
- statData->tx_ucast_packets = interface_stats.data.tx_ucast_packets;
- statData->has_tx_mcast_packets = BAL_STAT_PRES;
- statData->tx_mcast_packets = interface_stats.data.tx_mcast_packets;
- statData->has_tx_bcast_packets = BAL_STAT_PRES;
- statData->tx_bcast_packets = interface_stats.data.tx_bcast_packets;
- statData->has_tx_error_packets = BAL_STAT_PRES;
- statData->tx_error_packets = interface_stats.data.tx_error_packets;
- statData->has_rx_crc_errors = BAL_STAT_PRES;
+ statData->has_rx_crc_errors = BAL_ELEMENT_PRES;
statData->rx_crc_errors = interface_stats.data.rx_crc_errors;
- statData->has_bip_errors = BAL_STAT_PRES;
+ statData->has_bip_errors = BAL_ELEMENT_PRES;
statData->bip_errors = interface_stats.data.bip_errors;
+ statData->has_rx_mpcp = BAL_ELEMENT_PRES;
+ statData->rx_mpcp = interface_stats.data.rx_mpcp;
+ statData->has_rx_report = BAL_ELEMENT_PRES;
+ statData->rx_report = interface_stats.data.rx_report;
+ statData->has_rx_oam_bytes = BAL_ELEMENT_PRES;
+ statData->rx_oam_bytes = interface_stats.data.rx_oam_bytes;
+ statData->has_rx_oam_packets = BAL_ELEMENT_PRES;
+ statData->rx_oam_packets = interface_stats.data.rx_oam_packets;
+ statData->has_tx_bytes = BAL_ELEMENT_PRES;
+ statData->tx_bytes = interface_stats.data.tx_bytes;
+ statData->has_tx_packets = BAL_ELEMENT_PRES;
+ statData->tx_packets = interface_stats.data.tx_packets;
+ statData->has_tx_data_bytes = BAL_ELEMENT_PRES;
+ statData->tx_data_bytes = interface_stats.data.tx_data_bytes;
+ statData->has_tx_ucast_packets = BAL_ELEMENT_PRES;
+ statData->tx_ucast_packets = interface_stats.data.tx_ucast_packets;
+ statData->has_tx_mcast_packets = BAL_ELEMENT_PRES;
+ statData->tx_mcast_packets = interface_stats.data.tx_mcast_packets;
+ statData->has_tx_bcast_packets = BAL_ELEMENT_PRES;
+ statData->tx_bcast_packets = interface_stats.data.tx_bcast_packets;
+ statData->has_tx_64_packets = BAL_ELEMENT_PRES;
+ statData->tx_64_packets = interface_stats.data.tx_64_packets;
+ statData->has_tx_65_127_packets = BAL_ELEMENT_PRES;
+ statData->tx_65_127_packets = interface_stats.data.tx_65_127_packets;
+ statData->has_tx_128_255_packets = BAL_ELEMENT_PRES;
+ statData->tx_128_255_packets = interface_stats.data.tx_128_255_packets;
+ statData->has_tx_256_511_packets = BAL_ELEMENT_PRES;
+ statData->tx_256_511_packets = interface_stats.data.tx_256_511_packets;
+ statData->has_tx_512_1023_packets = BAL_ELEMENT_PRES;
+ statData->tx_512_1023_packets = interface_stats.data.tx_512_1023_packets;
+ statData->has_tx_1024_1518_packets = BAL_ELEMENT_PRES;
+ statData->tx_1024_1518_packets = interface_stats.data.tx_1024_1518_packets;
+ statData->has_tx_1519_2047_packets = BAL_ELEMENT_PRES;
+ statData->tx_1519_2047_packets = interface_stats.data.tx_1519_2047_packets;
+ statData->has_tx_2048_4095_packets = BAL_ELEMENT_PRES;
+ statData->tx_2048_4095_packets = interface_stats.data.tx_2048_4095_packets;
+ statData->has_tx_4096_9216_packets = BAL_ELEMENT_PRES;
+ statData->tx_4096_9216_packets = interface_stats.data.tx_4096_9216_packets;
+ statData->has_tx_9217_16383_packets = BAL_ELEMENT_PRES;
+ statData->tx_9217_16383_packets = interface_stats.data.tx_9217_16383_packets;
+ statData->has_tx_error_packets = BAL_ELEMENT_PRES;
+ statData->tx_error_packets = interface_stats.data.tx_error_packets;
+ statData->has_tx_mpcp = BAL_ELEMENT_PRES;
+ statData->tx_mpcp = interface_stats.data.tx_mpcp;
+ statData->has_tx_gate = BAL_ELEMENT_PRES;
+ statData->tx_gate = interface_stats.data.tx_gate;
+ statData->has_tx_oam_bytes = BAL_ELEMENT_PRES;
+ statData->tx_oam_bytes = interface_stats.data.tx_oam_bytes;
+ statData->has_tx_oam_packets = BAL_ELEMENT_PRES;
+ statData->tx_oam_packets = interface_stats.data.tx_oam_packets;
}
return err;
diff --git a/src/bal_subscriber_terminal_hdlr.c b/src/bal_subscriber_terminal_hdlr.c
index 91fcfac..42dccc2 100755
--- a/src/bal_subscriber_terminal_hdlr.c
+++ b/src/bal_subscriber_terminal_hdlr.c
@@ -49,18 +49,11 @@
{
bcmbal_serial_number serial_num = {} ;
bcmbal_serial_number zero_serial_num = {};
- bcmbal_registration_id registration_id = {};
int has_serial_num = BCMOS_FALSE;
- int has_registration_id = BCMOS_FALSE;
char two_digit_buf[3];
two_digit_buf[2] = 0;
- ASFVOLT_LOG(ASFVOLT_DEBUG, "Before encoding,Vendor Id(%s),Vendor Specific Id(%s), Registration Id(%s)",
- onu_cfg->data->serial_number->vendor_id,
- onu_cfg->data->serial_number->vendor_specific,
- onu_cfg->data->registration_id);
-
char vendor_id[20];
memset(&vendor_id, 0, 20);
sprintf(vendor_id,"%2X%2X%2X%2X",
@@ -69,11 +62,6 @@
onu_cfg->data->serial_number->vendor_id[2],
onu_cfg->data->serial_number->vendor_id[3]);
onu_cfg->data->serial_number->vendor_id = vendor_id;
- ASFVOLT_LOG(ASFVOLT_DEBUG, "After encoding,Vendor Id(%s),Vendor Specific Id(%s), Registration Id(%s)",
- onu_cfg->data->serial_number->vendor_id,
- onu_cfg->data->serial_number->vendor_specific,
- onu_cfg->data->registration_id);
-
/* Vendor Id is totally 16 byte string and should be
send in hexadecimmal format */
for(idx=0; idx<2*sizeof(serial_num.vendor_id); idx+=2)
@@ -91,17 +79,6 @@
ASFVOLT_CFG_PROP_SET(sub_term_obj, subscriber_terminal, serial_number,
has_serial_num, serial_num);
- /* Registration ID is a string and should be given in hexadecimal format */
- for(idx=0; idx<strlen(onu_cfg->data->registration_id) && idx<2*sizeof(registration_id.arr); idx+=2)
- {
- memcpy(two_digit_buf, &onu_cfg->data->registration_id[idx], 2);
- registration_id.arr[idx>>1] = strtol(two_digit_buf, NULL, 16);
- has_registration_id = BCMOS_TRUE;
- }
-
- ASFVOLT_CFG_PROP_SET(sub_term_obj, subscriber_terminal, registration_id,
- has_registration_id, registration_id);
-
if (!memcmp(&serial_num, &zero_serial_num, sizeof(serial_num)))
skip_onu = BCMOS_TRUE;
}
@@ -111,14 +88,6 @@
if (!skip_onu)
{
-
- /*ASFVOLT_LOG(ASFVOLT_DEBUG, "Onu's(%d) Serial number %02x%02x%02x%2x%02x%02x%02x%02x",
- onu_cfg->key->sub_term_id,
- sub_term_obj.data->serial_number.vendor_id[0], sub_term_obj.data->serial_number.vendor_id[1],
- sub_term_obj.data->serial_number.vendor_id[2], sub_term_obj.data->serial_number.vendor_id[3],
- sub_term_obj.data->serial_number.vendor_specific[0], sub_term_obj.data->serial_number.vendor_specific[1],
- sub_term_obj.data->serial_number.vendor_specific[2], sub_term_obj.data->serial_number.vendor_specific[3]);*/
-
err = bcmbal_cfg_set(DEFAULT_ATERM_ID, &(sub_term_obj.hdr));
ASFVOLT_LOG(ASFVOLT_DEBUG,
@@ -255,8 +224,7 @@
* Function : bal_subscriber_terminal_cfg_get *
* Description : Get the subscriber terminal(ONU) configuration *
********************************************************************/
-uint32_t bal_subscriber_terminal_cfg_get(BalSubscriberTerminalKey *terminal_key,
- BalSubscriberTerminalCfg *onu_cfg)
+uint32_t bal_subscriber_terminal_cfg_get(BalSubscriberTerminalCfg *onu_cfg)
{
bcmos_errno err = BCM_ERR_OK;
@@ -268,20 +236,8 @@
"Processing subscriber terminal cfg get: %d",
onu_cfg->key->sub_term_id);
- if (terminal_key->has_sub_term_id &&
- terminal_key->has_intf_id)
- {
- key.sub_term_id = terminal_key->sub_term_id ;
- key.intf_id = terminal_key->intf_id ;
- }
- else
- {
- ASFVOLT_LOG(ASFVOLT_ERROR,
- "Invalid Key to handle subscriber terminal Cfg Get subscriber_terminal_id(%d), Interface ID(%d)",
- key.sub_term_id, key.intf_id);
-
- return BAL_ERRNO__BAL_ERR_PARM;
- }
+ key.sub_term_id = onu_cfg->key->sub_term_id ;
+ key.intf_id = onu_cfg->key->intf_id ;
/* init the API struct */
BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);
@@ -312,7 +268,73 @@
return BAL_ERRNO__BAL_ERR_INTERNAL;
}
- ASFVOLT_LOG(ASFVOLT_INFO,
- "To-Do. Send subscriber terminal details to Adapter");
+ ASFVOLT_LOG(ASFVOLT_INFO, "Get Subscriber cfg sent to OLT for Subscriber Id(%d) on Interface(%d)",
+ key.sub_term_id, key.intf_id);
+
+ onu_cfg->key->has_sub_term_id = BAL_ELEMENT_PRES;
+ onu_cfg->key->sub_term_id = cfg.key.sub_term_id;
+
+ onu_cfg->key->has_intf_id = BAL_ELEMENT_PRES;
+ onu_cfg->key->intf_id = cfg.key.intf_id;
+
+ onu_cfg->data->has_admin_state = BAL_ELEMENT_PRES;
+ onu_cfg->data->admin_state = cfg.data.admin_state;
+
+ onu_cfg->data->has_oper_status = BAL_ELEMENT_PRES;
+ onu_cfg->data->oper_status = cfg.data.oper_status;
+
+ onu_cfg->data->has_svc_port_id = BAL_ELEMENT_PRES;
+ onu_cfg->data->svc_port_id = cfg.data.svc_port_id;
+
+ onu_cfg->data->has_ds_tm = BAL_ELEMENT_PRES;
+ onu_cfg->data->ds_tm = cfg.data.ds_tm;
+
+ onu_cfg->data->has_us_tm = BAL_ELEMENT_PRES;
+ onu_cfg->data->us_tm = cfg.data.us_tm;
+
+ onu_cfg->data->has_sub_term_rate = BAL_ELEMENT_PRES;
+ onu_cfg->data->sub_term_rate = cfg.data.sub_term_rate;
+
+ char *password = malloc(sizeof(char)*MAX_CHAR_LENGTH*2);
+ memset(password, 0, MAX_CHAR_LENGTH*2);
+ strcpy(password,(const char *)cfg.data.password.arr);
+ onu_cfg->data->password = password;
+
+ char *registration_id = malloc(sizeof(char)*MAX_REGID_LENGTH);
+ memset(registration_id, 0, MAX_REGID_LENGTH);
+ strcpy(registration_id,(const char *)cfg.data.registration_id.arr);
+ onu_cfg->data->registration_id = registration_id;
+
+ BalSerialNumber *serialNum;
+ serialNum = malloc(sizeof(BalSerialNumber));
+ memset(serialNum, 0, sizeof(BalSerialNumber));
+ bal_serial_number__init(serialNum);
+ onu_cfg->data->serial_number = serialNum;
+
+ char *vendor_id = malloc(sizeof(char)*MAX_CHAR_LENGTH);
+ memset(vendor_id, 0, MAX_CHAR_LENGTH);
+ sprintf(vendor_id,"%c%c%c%c",
+ cfg.data.serial_number.vendor_id[0],
+ cfg.data.serial_number.vendor_id[1],
+ cfg.data.serial_number.vendor_id[2],
+ cfg.data.serial_number.vendor_id[3]);
+
+ onu_cfg->data->serial_number->vendor_id = vendor_id;
+
+ char *vendor_specific = malloc(sizeof(char)*MAX_CHAR_LENGTH);
+ memset(vendor_specific, 0, MAX_CHAR_LENGTH);
+ sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X",
+ cfg.data.serial_number.vendor_specific[0]>>4 & 0x0f,
+ cfg.data.serial_number.vendor_specific[0] & 0x0f,
+ cfg.data.serial_number.vendor_specific[1]>>4 & 0x0f,
+ cfg.data.serial_number.vendor_specific[1] & 0x0f,
+ cfg.data.serial_number.vendor_specific[2]>>4 & 0x0f,
+ cfg.data.serial_number.vendor_specific[2] & 0x0f,
+ cfg.data.serial_number.vendor_specific[3]>>4 & 0x0f,
+ cfg.data.serial_number.vendor_specific[3] & 0x0f);
+ onu_cfg->data->serial_number->vendor_specific = vendor_specific;
+
+ free(list_mem);
+
return BAL_ERRNO__BAL_ERR_OK;
}
diff --git a/src/bal_subscriber_terminal_hdlr.h b/src/bal_subscriber_terminal_hdlr.h
index 94989cd..17236d8 100755
--- a/src/bal_subscriber_terminal_hdlr.h
+++ b/src/bal_subscriber_terminal_hdlr.h
@@ -17,7 +17,6 @@
extern uint32_t bal_subscriber_terminal_cfg_set(BalSubscriberTerminalCfg *onu_cfg);
extern bcmos_errno bal_subscriber_terminal_indication_cb(bcmbal_obj *obj);
extern uint32_t bal_subscriber_terminal_cfg_clear(BalSubscriberTerminalKey *terminal_key);
-extern uint32_t bal_subscriber_terminal_cfg_get(BalSubscriberTerminalKey *terminal_key,
- BalSubscriberTerminalCfg *onu_cfg);
+extern uint32_t bal_subscriber_terminal_cfg_get(BalSubscriberTerminalCfg *onu_cfg);
#define BAL_DYNAMIC_LIST_BUFFER_SIZE (32 * 1024)
diff --git a/src/bal_tmqueue_hdlr.c b/src/bal_tmqueue_hdlr.c
index eb52db9..31cab15 100755
--- a/src/bal_tmqueue_hdlr.c
+++ b/src/bal_tmqueue_hdlr.c
@@ -228,25 +228,15 @@
* Description : Get the OLT device tm queue configuration *
********************************************************************/
-uint32_t bal_tm_queue_cfg_get(BalTmQueueKey *tm_queue_key, BalTmQueueCfg *tm_queue_cfg)
+uint32_t bal_tm_queue_cfg_get(BalTmQueueCfg *tm_queue_cfg)
{
bcmos_errno err = BCM_ERR_OK;
bcmbal_tm_queue_cfg tm_queue_obj; /**< declare main API struct */
bcmbal_tm_queue_key key = { }; /**< declare key */
- if((tm_queue_key->has_id) && (tm_queue_key->has_sched_id) && (tm_queue_key->has_sched_dir))
- {
- key.id = tm_queue_key->id;
- key.sched_id = tm_queue_key->sched_id;
- key.sched_dir = tm_queue_key->sched_dir;
- }
- else
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to get the tm queue cfg(OLT): Missing Key values "
- "Received key values Id(%d), Sched-Dir(%d), Sched-Id(%d)",
- tm_queue_key->sched_id, tm_queue_key->sched_dir, tm_queue_key->id);
- return BAL_ERRNO__BAL_ERR_NOENT;
- }
+ key.id = tm_queue_cfg->key->id;
+ key.sched_id = tm_queue_cfg->key->sched_id;
+ key.sched_dir = tm_queue_cfg->key->sched_dir;
ASFVOLT_LOG(ASFVOLT_DEBUG, "Get tm queue cfg(for OLT) starts");
@@ -267,6 +257,10 @@
ASFVOLT_LOG(ASFVOLT_INFO, "Get tm Queue sent to OLT. "
"Queue ID(%d) Sched ID(%d) Sched Dir(%d)",
key.id, key.sched_id, key.sched_dir );
+
+ memcpy(tm_queue_cfg->key, &key, sizeof(BalTmQueueKey));
+ memcpy(tm_queue_cfg->data, &tm_queue_obj, sizeof(BalTmQueueCfgData));
+
return err;
}
diff --git a/src/bal_tmqueue_hdlr.h b/src/bal_tmqueue_hdlr.h
index 1ba5196..fdec188 100755
--- a/src/bal_tmqueue_hdlr.h
+++ b/src/bal_tmqueue_hdlr.h
@@ -16,5 +16,5 @@
extern uint32_t bal_tm_queue_cfg_set(BalTmQueueCfg *tm_queue_cfg);
extern uint32_t bal_tm_queue_cfg_clear(BalTmQueueKey *tm_queue_key);
-extern uint32_t bal_tm_queue_cfg_get(BalTmQueueKey *tm_queue_key, BalTmQueueCfg *tm_queue_cfg);
+extern uint32_t bal_tm_queue_cfg_get(BalTmQueueCfg *tm_queue_cfg);
extern bcmos_errno bal_tm_queue_cfg_indication_cb(bcmbal_obj *obj);
diff --git a/src/bal_tmsched_hdlr.c b/src/bal_tmsched_hdlr.c
index 73c738b..a0a92ac 100755
--- a/src/bal_tmsched_hdlr.c
+++ b/src/bal_tmsched_hdlr.c
@@ -98,20 +98,6 @@
}
}
break;
- case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
- if(tmScOwn->uni->has_intf_id)
- {
- valtmScOwn.u.uni.intf_id = tmScOwn->uni->intf_id;
- }
- if(tmScOwn->uni->has_sub_term_id)
- {
- valtmScOwn.u.uni.sub_term_id = tmScOwn->uni->sub_term_id;
- }
- if(tmScOwn->uni->has_idx)
- {
- valtmScOwn.u.uni.idx = tmScOwn->uni->idx;
- }
- break;
case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
if(tmScOwn->virtual_->has_idx)
{
@@ -149,10 +135,6 @@
ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, sched_parent, BCMOS_TRUE, valSchedPar);
}
- ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, sched_child_type,
- tm_sched_cfg->data->has_sched_child_type,
- tm_sched_cfg->data->sched_child_type);
-
/* rating/shaping */
BalTmShaping *balShaping = (BalTmShaping *)tm_sched_cfg->data->rate;
bcmbal_tm_shaping val = {};
@@ -250,7 +232,7 @@
}
/* Subsidiary queues */
- BalIdList *balQueues = (BalIdList *)tm_sched_cfg->data->queues;
+ BalTmQueueIdList *balQueues = (BalTmQueueIdList *)tm_sched_cfg->data->queues;
bcmbal_tm_queue_id_list_u8 valQueues = {};
if(balQueues != NULL && balQueues->n_val)
{
@@ -264,11 +246,11 @@
}
memcpy((void *)valQueues.val, (const void *)balQueues->val,
(balQueues->n_val)*sizeof(uint32_t));
- ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, queues, BCMOS_TRUE, valQueues);
+ ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, queue_list, BCMOS_TRUE, valQueues);
}
/* Subsidiary schedulers */
- BalIdList *balSubScheds = (BalIdList *)tm_sched_cfg->data->sub_scheds;
+ BalTmSchedIdList *balSubScheds = (BalTmSchedIdList *)tm_sched_cfg->data->sub_scheds;
bcmbal_tm_sched_id_list_u8 valSubScheds = {};
if(balSubScheds != NULL && balSubScheds->n_val)
{
@@ -282,7 +264,7 @@
}
memcpy((void *)valSubScheds.val, (const void *)balSubScheds->val,
(balSubScheds->n_val)*sizeof(uint32_t));
- ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, sub_scheds, BCMOS_TRUE, valSubScheds);
+ ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, sub_sched_list, BCMOS_TRUE, valSubScheds);
}
ASFVOLT_CFG_PROP_SET(tm_sched_obj, tm_sched, num_priorities,
@@ -308,25 +290,14 @@
* Description : get the OLT device tm queue configuration *
********************************************************************/
-uint32_t bal_tm_sched_cfg_get(BalTmSchedKey *tm_sched_key, BalTmSchedCfg *tm_sched_cfg)
+uint32_t bal_tm_sched_cfg_get(BalTmSchedCfg *tm_sched_cfg)
{
bcmos_errno err = BCM_ERR_OK;
bcmbal_tm_sched_cfg tm_sched_obj; /**< declare main API struct */
bcmbal_tm_sched_key key = { }; /**< declare key */
- if((tm_sched_cfg->key->has_dir) && (tm_sched_cfg->key->has_id))
- {
- key.dir = tm_sched_cfg->key->dir;
- key.id = tm_sched_cfg->key->id;
- }
- else
- {
- ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to get the tm schedule cfg(OLT): Missing Key values "
- "Received key values Sched-Dir(%d), Sched-Id(%d)",
- tm_sched_cfg->key->dir, tm_sched_cfg->key->id);
- return BAL_ERRNO__BAL_ERR_NOENT;
- }
-
+ key.dir = tm_sched_cfg->key->dir;
+ key.id = tm_sched_cfg->key->id;
ASFVOLT_LOG(ASFVOLT_DEBUG, "Gem tm scheduler cfg (for OLT) starts");
@@ -346,6 +317,10 @@
ASFVOLT_LOG(ASFVOLT_INFO, "Get tm scheduler cfg sent to OLT. "
"Sched ID(%d) Sched Dir(%d)", key.id, key.dir);
+
+ memcpy(tm_sched_cfg->key, &key, sizeof(BalTmSchedKey));
+ memcpy(tm_sched_cfg->data, &tm_sched_obj, sizeof(BalTmSchedCfgData));
+
return err;
}
diff --git a/src/bal_tmsched_hdlr.h b/src/bal_tmsched_hdlr.h
index a625bee..eba3d1f 100755
--- a/src/bal_tmsched_hdlr.h
+++ b/src/bal_tmsched_hdlr.h
@@ -15,7 +15,7 @@
*/
extern uint32_t bal_tm_sched_cfg_set(BalTmSchedCfg *tm_sched_cfg);
-extern uint32_t bal_tm_sched_cfg_get(BalTmSchedKey *tm_sched_key, BalTmSchedCfg *tm_sched_cfg);
+extern uint32_t bal_tm_sched_cfg_get(BalTmSchedCfg *tm_sched_cfg);
extern uint32_t bal_tm_sched_cfg_clear(BalTmSchedKey *tm_sched_key);
extern bcmos_errno bal_tm_sched_cfg_indication_cb(bcmbal_obj *obj);
diff --git a/src/voltha_bal_driver.c b/src/voltha_bal_driver.c
new file mode 100755
index 0000000..12b7fcf
--- /dev/null
+++ b/src/voltha_bal_driver.c
@@ -0,0 +1,1267 @@
+/*
+** Copyright 2017-present Open Networking Foundation
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <sys/time.h>
+#include "bal_msg_type.grpc-c.h"
+#include "bal_osmsg.grpc-c.h"
+#include "bal_model_ids.grpc-c.h"
+#include "bal_obj.grpc-c.h"
+#include "bal_model_types.grpc-c.h"
+#include "bal_errno.grpc-c.h"
+#include "bal.grpc-c.h"
+#include "asfvolt.grpc-c.h"
+
+#include "asfvolt16_driver.h"
+
+#include <sys/reboot.h>
+#include "bal_indications_queue.h"
+
+/* Global varibles */
+balCoreIpInfo coreIpPortInfo;
+
+/* extern variables*/
+list_node *bal_ind_queue_tail = NULL;
+list_node *bal_ind_queue_head = NULL;
+pthread_mutex_t bal_ind_queue_lock;
+unsigned int num_of_nodes = 0;
+
+/* static variables*/
+static grpc_c_server_t *test_server;
+static void sigint_handler (int x) {
+ grpc_c_server_destroy(test_server);
+ exit(0);
+}
+static bool is_init_done = false;
+
+/*MACRO Definitions*/
+#define ASFVOLT_FIELD_LEN 200
+
+void is_grpc_write_pending(int return_value)
+{
+ if (return_value != GRPC_C_WRITE_OK)
+ {
+ if(return_value == GRPC_C_WRITE_PENDING)
+ {
+ /* TODO: Register call back with grpc-c which will give an indication whenever write was succussful */
+ ASFVOLT_LOG(ASFVOLT_INFO, "write(%d) is pending, sleep for 5 sec", return_value);
+ sleep(5);
+ }
+ else
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write %d", return_value);
+ }
+ }
+
+}
+
+/*
+ * This functions gets invoked whenever bal Heartbeat RPC gets called
+ */
+void bal__bal_api_heartbeat_cb(grpc_c_context_t *context)
+{
+ BalHeartbeat *bal_hb;
+ BalRebootState bal_reboot;
+ int ret_val;
+ /*
+ * Read incoming message into set_cfg
+ */
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&bal_hb, 0);
+ }
+
+ bal_reboot_state__init(&bal_reboot);
+
+ bal_reboot.has_is_reboot = 1;
+ bal_reboot.is_reboot = is_reboot;
+
+ /*
+ * Write reply back to the client
+ */
+ ret_val = context->gcc_stream->write(context, &bal_reboot, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+}
+
+/*
+ * This functions gets invoked whenever Bal reboot gets called
+ */
+void bal__bal_api_reboot_cb(grpc_c_context_t *context)
+{
+ BalReboot *read_device;
+ BalErr bal_err;
+ int ret_val;
+
+ /*
+ * Read incoming message into get_cfg
+ */
+ if (context->gcc_payload)
+ {
+ context->gcc_stream->read(context, (void **)&read_device, 0);
+ ASFVOLT_LOG(ASFVOLT_INFO, "Bal Server - Reboot : Device ID is %s",read_device->device_id);
+ }
+
+
+ /*
+ * send it to BAL
+ */
+
+ bal_err__init(&bal_err);
+
+ bal_err.err= 0;
+
+ /*
+ * Write reply back to the client
+ */
+ ret_val = context->gcc_stream->write(context, &bal_err, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+
+ ret_val = system("shutdown -r now");
+ sleep(30); /* allow system to shutdown gracefully */
+ sync(); /* force shutdown if graceful did not work */
+ reboot(RB_AUTOBOOT);
+}
+
+/*
+This function reads the specified field from the 'onldump -o' command.
+If the field was successfully read, it returns the field value.
+If it failed to read the field, then null charecter is returned
+*/
+char* asfvolt_read_sysinfo(char* field_name, char* field_val)
+{
+ FILE *fp;
+ /* Prepare the command*/
+ char command[150];
+
+ snprintf(command, sizeof command, "bash -l -c \"onlpdump -s\" | perl -ne 'print $1 if /%s: (\\S+)/'", field_name);
+ /* Open the command for reading. */
+ fp = popen(command, "r");
+ if (fp == NULL) {
+ /*The client has to check for a Null mac address in this case*/
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to query the mac address");
+ return field_val;
+ }
+
+ /*Read the field value*/
+ if (fp) {
+ fread(field_val, ASFVOLT_FIELD_LEN, 1, fp);
+ pclose(fp);
+ }
+ return field_val;
+}
+
+/*
+ * This functions gets invoked whenever AsfvoltGetSystemInfo RPC gets called
+ */
+void asfvolt__asfvolt_get_system_info_cb(grpc_c_context_t *context)
+{
+ BalDefault *dummy;
+ AsfSystemInfo asf_system_info;
+ char product_name[ASFVOLT_FIELD_LEN] = "\0";
+ char part_num[ASFVOLT_FIELD_LEN] = "\0";
+ char serial_num[ASFVOLT_FIELD_LEN] = "\0";
+ char mac_address[ASFVOLT_FIELD_LEN] = "\0";
+ char mac_range[ASFVOLT_FIELD_LEN] = "\0";
+ char manufacturer[ASFVOLT_FIELD_LEN] = "\0";
+ char manufacturer_date[ASFVOLT_FIELD_LEN] = "\0";
+ char vendor[ASFVOLT_FIELD_LEN] = "\0";
+ char platform_name[ASFVOLT_FIELD_LEN] = "\0";
+ char label_revision[ASFVOLT_FIELD_LEN] = "\0";
+ char coutry_code[ASFVOLT_FIELD_LEN] = "\0";
+ char diag_version[ASFVOLT_FIELD_LEN] = "\0";
+ char onie_version[ASFVOLT_FIELD_LEN] = "\0";
+ int ret_val;
+
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&dummy, 0);
+ }
+
+ asf_system_info__init(&asf_system_info);
+
+ asf_system_info.product_name = asfvolt_read_sysinfo("Product Name", product_name);
+ asf_system_info.part_num = asfvolt_read_sysinfo("Part Number", part_num);
+ asf_system_info.serial_num = asfvolt_read_sysinfo("Serial Number", serial_num);
+ asf_system_info.mac_address = asfvolt_read_sysinfo("MAC", mac_address);
+ asf_system_info.mac_range = asfvolt_read_sysinfo("MAC Range", mac_range);
+ asf_system_info.manufacturer = asfvolt_read_sysinfo("Manufacturer", manufacturer);
+ asf_system_info.manufacture_date = asfvolt_read_sysinfo("Manufacture Date", manufacturer_date);
+ asf_system_info.vendor = asfvolt_read_sysinfo("Vendor", vendor);
+ asf_system_info.platform_name = asfvolt_read_sysinfo("Platform Name", platform_name);
+ asf_system_info.label_revision = asfvolt_read_sysinfo("Label Revision", label_revision);
+ asf_system_info.country_code = asfvolt_read_sysinfo("Country Code", coutry_code);
+ asf_system_info.diag_version = asfvolt_read_sysinfo("Diag Version", diag_version);
+ asf_system_info.onie_version = asfvolt_read_sysinfo("ONIE Version", onie_version);
+
+ /*
+ * Write reply back to the client
+ */
+ ret_val = context->gcc_stream->write(context, &asf_system_info, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+}
+
+/*
+This function reads the SFP presence map information from 'onlpdump -p' system command
+and returns a bitmap with the presence information.
+*/
+unsigned int asfvolt_read_sfp_presence_bitmap(void)
+{
+ char command[150];
+ char sfp_presence_output[ASFVOLT_FIELD_LEN];
+ unsigned int sfp_presence_bitmap = 0;
+ char delim[2] = " ";
+ char *field = NULL;
+ FILE *fp;
+ snprintf(command, sizeof command, "bash -l -c \"onlpdump -p\" | perl -ne 'print $1 if /Presence: ([0-9 ]+)/'");
+ /* Open the command for reading. */
+ fp = popen(command, "r");
+ if (fp == NULL) {
+ /*The client has to check for a Null mac address in this case*/
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to query the sfp presence map");
+ return sfp_presence_bitmap;
+ }
+
+ /*Read the field value*/
+ fread(sfp_presence_output, ASFVOLT_FIELD_LEN, 1, fp);
+ pclose(fp);
+
+ field = strtok(sfp_presence_output, delim);
+ while (field != NULL) {
+ sfp_presence_bitmap |= (1 << atoi(field));
+ field = strtok(NULL, delim);
+ }
+
+ return sfp_presence_bitmap;
+}
+
+/*
+ * This functions gets invoked whenever AsfvoltGetSfpPresenceBitmap RPC gets called
+ */
+void asfvolt__asfvolt_get_sfp_presence_bitmap_cb(grpc_c_context_t *context)
+{
+ BalDefault *dummy;
+ AsfSfpPresenceBitmap sfp_presence_bitmap;
+ int ret_val;
+
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&dummy, 0);
+ }
+
+ asf_sfp_presence_bitmap__init(&sfp_presence_bitmap);
+
+ sfp_presence_bitmap.bitmap = asfvolt_read_sfp_presence_bitmap();
+ sfp_presence_bitmap.has_bitmap = true;
+
+ /*
+ * Write reply back to the client
+ */
+ ret_val = context->gcc_stream->write(context, &sfp_presence_bitmap, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+}
+
+/*
+ * This functions gets invoked whenever Bal Stats gets called
+ */
+void bal__bal_cfg_stat_get_cb(grpc_c_context_t *context)
+{
+ BalInterfaceKey *read_stats = 0;
+ int ret_val;
+
+ /*
+ * Read incoming message into get_cfg
+ */
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&read_stats, 0);
+ ASFVOLT_LOG(ASFVOLT_DEBUG, "Bal Server - Get Stats :NNI port is %d",read_stats->intf_id);
+ }
+
+
+ BalInterfaceStat get_stats;
+ memset(&get_stats, 0, sizeof(BalInterfaceStat));
+ bal_interface_stat__init(&get_stats);
+
+ BalInterfaceStatData stat_data;
+ memset(&stat_data, 0, sizeof(BalInterfaceStatData));
+ bal_interface_stat_data__init(&stat_data);
+
+ BalInterfaceKey stat_key;
+ memset(&stat_key, 0, sizeof(BalInterfaceKey));
+ bal_interface_key__init(&stat_key);
+
+ /* Interface Type, Interface ID
+ stat_data - Statistics Data */
+ if ((read_stats) && (is_init_done == true)) {
+ asfvolt16_bal_stats_get(read_stats->intf_type, read_stats->intf_id, &stat_data, &stat_key);
+ }
+
+ get_stats.data = &stat_data;
+ get_stats.key = &stat_key;
+
+ ret_val = context->gcc_stream->write(context, &get_stats, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+}
+
+void bal_cfg_get__free_mem_sub_term_cfg_get(BalCfg *balCfgRsp)
+{
+ free(balCfgRsp->terminal->data->password);
+ free(balCfgRsp->terminal->data->registration_id);
+ free(balCfgRsp->terminal->data->serial_number->vendor_id);
+ free(balCfgRsp->terminal->data->serial_number->vendor_specific);
+ free(balCfgRsp->terminal->data->serial_number);
+}
+
+void bal_cfg_get__free_mem(BalCfg *balCfgRsp)
+{
+ switch (balCfgRsp->hdr->obj_type)
+ {
+ case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL:
+ break;
+
+ case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE:
+ break;
+
+ case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL:
+ bal_cfg_get__free_mem_sub_term_cfg_get(balCfgRsp);
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*
+ * This functions gets invoked whenever bal RPC gets called
+ */
+void bal__bal_cfg_get_cb(grpc_c_context_t *context)
+{
+ BalKey *bal_key = 0;
+ int ret_val;
+
+ /*
+ * Read incoming message into bal_key
+ */
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&bal_key, 0);
+ }
+
+ /*
+ * send it to BAL
+ */
+ BalCfg get_cfg_resp;
+ memset(&get_cfg_resp, 0, sizeof(BalCfg));
+ bal_cfg__init(&get_cfg_resp);
+
+ BalObj hdr_cfg;
+ memset(&hdr_cfg, 0, sizeof(BalObj));
+ bal_obj__init(&hdr_cfg);
+ get_cfg_resp.hdr = &hdr_cfg;
+
+ BalCommMsgHdr comm_hdr;
+ memset(&comm_hdr, 0, sizeof(BalCommMsgHdr));
+ bal_comm_msg_hdr__init(&comm_hdr);
+ get_cfg_resp.hdr->comm_hdr = &comm_hdr;
+
+ if (bal_key) {
+ switch(bal_key->hdr->obj_type)
+ {
+ case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL:
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Bal Get For Access Terminal Received\n");
+
+ get_cfg_resp.obj_case = BAL_CFG__OBJ_CFG;
+
+ get_cfg_resp.hdr->obj_type = BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL;
+
+ BalAccessTerminalCfg access_term_cfg;
+ memset(&access_term_cfg, 0, sizeof(BalAccessTerminalCfg));
+ bal_access_terminal_cfg__init(&access_term_cfg);
+ get_cfg_resp.cfg = &access_term_cfg;
+
+ BalAccessTerminalCfgData access_term_cfg_data;
+ memset(&access_term_cfg_data, 0, sizeof(BalAccessTerminalCfgData));
+ bal_access_terminal_cfg_data__init(&access_term_cfg_data);
+ get_cfg_resp.cfg->data = &access_term_cfg_data;
+
+ BalTopology access_term_cfg_data_topology;
+ memset(&access_term_cfg_data_topology, 0, sizeof(BalTopology));
+ bal_topology__init(&access_term_cfg_data_topology);
+ get_cfg_resp.cfg->data->topology = &access_term_cfg_data_topology;
+
+ BalSwVersion access_term_cfg_data_sw_version;
+ memset(&access_term_cfg_data_sw_version, 0, sizeof(BalSwVersion));
+ bal_sw_version__init(&access_term_cfg_data_sw_version);
+ get_cfg_resp.cfg->data->sw_version = &access_term_cfg_data_sw_version;
+
+ BalAccessTerminalKey access_term_key;
+ memset(&access_term_key, 0, sizeof(BalAccessTerminalKey));
+ bal_access_terminal_key__init(&access_term_key);
+ get_cfg_resp.cfg->key = &access_term_key;
+
+ if (is_init_done == true) {
+ asfvolt16_bal_cfg_get(&get_cfg_resp);
+ }
+ }
+ break;
+
+ case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE:
+ {
+ BalInterfaceCfg intf_cfg;
+ memset(&intf_cfg, 0, sizeof(BalInterfaceCfg));
+ bal_interface_cfg__init(&intf_cfg);
+ get_cfg_resp.interface = &intf_cfg;
+
+ BalInterfaceCfgData intf_cfg_data;
+ memset(&intf_cfg_data, 0, sizeof(BalInterfaceCfgData));
+ bal_interface_cfg_data__init(&intf_cfg_data);
+ get_cfg_resp.interface->data = &intf_cfg_data;
+
+ BalInterfaceKey intf_key;
+ memset(&intf_key, 0, sizeof(BalInterfaceKey));
+ bal_interface_key__init(&intf_key);
+ get_cfg_resp.interface->key = &intf_key;
+
+ if (is_init_done == true) {
+ asfvolt16_bal_cfg_get(&get_cfg_resp);
+ }
+ }
+ break;
+
+ case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL:
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Bal Get For Subscriber Terminal Received\n");
+
+ get_cfg_resp.obj_case = BAL_CFG__OBJ_TERMINAL;
+
+ get_cfg_resp.hdr->obj_type = BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL;
+
+ BalSubscriberTerminalCfg sub_term_cfg;
+ memset(&sub_term_cfg, 0, sizeof(BalSubscriberTerminalCfg));
+ bal_subscriber_terminal_cfg__init(&sub_term_cfg);
+ get_cfg_resp.terminal = &sub_term_cfg;
+
+ BalSubscriberTerminalCfgData sub_term_cfg_data;
+ memset(&sub_term_cfg_data, 0, sizeof(BalSubscriberTerminalCfgData));
+ bal_subscriber_terminal_cfg_data__init(&sub_term_cfg_data);
+ get_cfg_resp.terminal->data = &sub_term_cfg_data;
+
+ BalSerialNumber serial_number;
+ memset(&serial_number, 0, sizeof(BalSerialNumber));
+ bal_serial_number__init(&serial_number);
+ get_cfg_resp.terminal->data->serial_number = &serial_number;
+
+ BalSubscriberTerminalKey sub_term_key;
+ memset(&sub_term_key, 0, sizeof(BalSubscriberTerminalKey));
+ bal_subscriber_terminal_key__init(&sub_term_key);
+ get_cfg_resp.terminal->key = &sub_term_key;
+
+ get_cfg_resp.terminal->key->has_sub_term_id = true;
+ get_cfg_resp.terminal->key->sub_term_id = bal_key->terminal_key->sub_term_id;
+
+ get_cfg_resp.terminal->key->has_intf_id = true;
+ get_cfg_resp.terminal->key->intf_id = bal_key->terminal_key->intf_id;
+
+ if (is_init_done == true) {
+ asfvolt16_bal_cfg_get(&get_cfg_resp);
+ }
+ }
+ break;
+ default:
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Bal Get not implemented for %d object type", bal_key->hdr->obj_type);
+ }
+ break;
+ }
+ }
+
+ /*
+ * Write reply back to the client
+ */
+ ret_val = context->gcc_stream->write(context, &get_cfg_resp, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+ bal_cfg_get__free_mem(&get_cfg_resp);
+}
+
+/*
+ * This functions gets invoked whenever bal RPC gets called
+ */
+void bal__bal_cfg_set_cb(grpc_c_context_t *context)
+{
+ BalCfg *set_cfg = 0;
+ BalErr bal_err;
+ int ret_val = 0;
+
+ /*
+ * Read incoming message into set_cfg
+ */
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&set_cfg, 0);
+ }
+
+ /*
+ * send it to BAL
+ */
+
+ bal_err__init(&bal_err);
+
+ bal_err.err= 0;
+
+ /*
+ * Write reply back to the client
+ */
+
+ ret_val = context->gcc_stream->write(context, &bal_err, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+
+ if (set_cfg) {
+
+ if(BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL == set_cfg->hdr->obj_type)
+ {
+ sleep(5); /* enable this if running with gdb */
+ }
+
+
+ asfvolt16_bal_cfg_set(set_cfg);
+ }
+}
+
+
+/*
+ * This functions gets invoked whenever bal clear RPC gets called
+ */
+void bal__bal_cfg_clear_cb(grpc_c_context_t *context)
+{
+ BalKey *clear_key = 0;
+ BalErr bal_err;
+ int ret_val = 0;
+
+ /*
+ * Read incoming message into clear_key
+ */
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&clear_key, 0);
+ }
+
+ /*
+ * send it to BAL
+ */
+
+ bal_err__init(&bal_err);
+
+ bal_err.err= 0;
+
+ /*
+ * Write reply back to the client
+ */
+
+ ret_val = context->gcc_stream->write(context, &bal_err, 0);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+
+ if (clear_key) {
+ asfvolt16_bal_cfg_clear(clear_key);
+ }
+}
+
+
+/*
+ * This functions gets invoked whenever bal Init RPC gets called
+ */
+void bal__bal_api_init_cb(grpc_c_context_t *context)
+{
+ BalInit *bal_init = 0;
+ BalErr bal_err;
+ int ret_val;
+
+ /*
+ * Read incoming message into set_cfg
+ */
+ if (context->gcc_payload)
+ {
+ context->gcc_stream->read(context, (void **)&bal_init, 0);
+ }
+
+ /*
+ * send it to BAL
+ */
+
+ ASFVOLT_LOG(ASFVOLT_INFO, "Received API Init msg");
+
+ bal_err__init(&bal_err);
+
+ bal_err.err= 0;
+
+ /*
+ * Write reply back to the client
+ */
+ ret_val = context->gcc_stream->write(context, &bal_err, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+
+ if (bal_init) {
+ asfvolt16_bal_init(bal_init, &coreIpPortInfo);
+ }
+ is_init_done = true;
+}
+
+
+void bal_get_ind__free_mem_access_term_ind_op_state(BalIndications *balIndCfg)
+{
+ free(balIndCfg->access_term_ind_op_state->data);
+ free(balIndCfg->access_term_ind_op_state->key);
+ free(balIndCfg->access_term_ind_op_state);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_access_term_proc_err(BalIndications *balIndCfg)
+{
+ free(balIndCfg->access_term_proc_err->key);
+ free(balIndCfg->access_term_proc_err);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_flow_op_state(BalIndications *balIndCfg)
+{
+ free(balIndCfg->flow_op_state->data);
+ free(balIndCfg->flow_op_state->key);
+ free(balIndCfg->flow_op_state);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_flow_proc_err(BalIndications *balIndCfg)
+{
+ free(balIndCfg->flow_proc_err->key);
+ free(balIndCfg->flow_proc_err);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_interface_op_state(BalIndications *balIndCfg)
+{
+ free(balIndCfg->interface_op_state->data);
+ free(balIndCfg->interface_op_state->key);
+ free(balIndCfg->interface_op_state);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_interface_los(BalIndications *balIndCfg)
+{
+ free(balIndCfg->interface_los->data);
+ free(balIndCfg->interface_los);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_op_state(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_op_state->data);
+ free(balIndCfg->terminal_op_state->key);
+ free(balIndCfg->terminal_op_state);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_disc(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_disc->data->serial_number->vendor_specific);
+ free(balIndCfg->terminal_disc->data->serial_number->vendor_id);
+ free(balIndCfg->terminal_disc->data->serial_number);
+ free(balIndCfg->terminal_disc->data);
+ free(balIndCfg->terminal_disc->key);
+ free(balIndCfg->terminal_disc);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_alarm(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_alarm->data->alarm);
+ free(balIndCfg->terminal_alarm->data);
+ free(balIndCfg->terminal_alarm->key);
+ free(balIndCfg->terminal_alarm);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_dgi(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_dgi->data);
+ free(balIndCfg->terminal_dgi->key);
+ free(balIndCfg->terminal_dgi);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_dowi(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_dowi->data);
+ free(balIndCfg->terminal_dowi->key);
+ free(balIndCfg->terminal_dowi);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_looci(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_looci->data);
+ free(balIndCfg->terminal_looci->key);
+ free(balIndCfg->terminal_looci);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_proc_err(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_proc_err->key);
+ free(balIndCfg->terminal_proc_err);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_sdi(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_sdi->data);
+ free(balIndCfg->terminal_sdi->key);
+ free(balIndCfg->terminal_sdi);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_sfi(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_sfi->data);
+ free(balIndCfg->terminal_sfi->key);
+ free(balIndCfg->terminal_sfi);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_sufi(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_sufi->data);
+ free(balIndCfg->terminal_sufi->key);
+ free(balIndCfg->terminal_sufi);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_sub_term_act_fail(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_sub_term_act_fail->data);
+ free(balIndCfg->terminal_sub_term_act_fail->key);
+ free(balIndCfg->terminal_sub_term_act_fail);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_terminal_tiwi(BalIndications *balIndCfg)
+{
+ free(balIndCfg->terminal_tiwi->data);
+ free(balIndCfg->terminal_tiwi->key);
+ free(balIndCfg->terminal_tiwi);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_tm_sched_osc(BalIndications *balIndCfg)
+{
+ free(balIndCfg->tm_sched_oper_stats_change->data);
+ free(balIndCfg->tm_sched_oper_stats_change->key);
+ free(balIndCfg->tm_sched_oper_stats_change);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_pkt_data(BalIndications *balIndCfg)
+{
+ free(balIndCfg->pktdata->data->pkt.data);
+ free(balIndCfg->pktdata->data);
+ switch(balIndCfg->pktdata->key->packet_send_dest->type)
+ {
+ case BAL_DEST_TYPE__BAL_DEST_TYPE_NNI:
+ free(balIndCfg->pktdata->key->packet_send_dest->nni);
+ break;
+ case BAL_DEST_TYPE__BAL_DEST_TYPE_SUB_TERM:
+ free(balIndCfg->pktdata->key->packet_send_dest->sub_term);
+ break;
+ case BAL_DEST_TYPE__BAL_DEST_TYPE_SVC_PORT:
+ free(balIndCfg->pktdata->key->packet_send_dest->svc_port);
+ break;
+ default:
+ /*Nothing to do*/
+ break;
+ }
+ free(balIndCfg->pktdata->key->packet_send_dest);
+ free(balIndCfg->pktdata->key);
+ free(balIndCfg->pktdata);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_bal_omci_resp(BalIndications *balIndCfg)
+{
+ switch(balIndCfg->balomciresp->key->packet_send_dest->type)
+ {
+ case BAL_DEST_TYPE__BAL_DEST_TYPE_ITU_OMCI_CHANNEL:
+ free(balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel);
+ break;
+ default:
+ /*Nothing to do*/
+ break;
+ }
+ free(balIndCfg->balomciresp->key->packet_send_dest);
+ free(balIndCfg->balomciresp->data->pkt.data);
+ free(balIndCfg->balomciresp->data);
+ free(balIndCfg->balomciresp->key);
+ free(balIndCfg->balomciresp);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem_u_bal_oam_resp(BalIndications *balIndCfg)
+{
+ free(balIndCfg->baloamresp->data->pkt.data);
+ free(balIndCfg->baloamresp->data);
+ switch(balIndCfg->baloamresp->key->packet_send_dest->type)
+ {
+ case BAL_DEST_TYPE__BAL_DEST_TYPE_IEEE_OAM_CHANNEL:
+ free(balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel);
+ break;
+ default:
+ /*Nothing to do*/
+ break;
+ }
+ free(balIndCfg->baloamresp->key->packet_send_dest);
+ free(balIndCfg->baloamresp->key);
+ free(balIndCfg->baloamresp);
+ free(balIndCfg);
+}
+
+void bal_get_ind__free_mem(BalIndications *balIndCfg)
+{
+ switch (balIndCfg->u_case)
+ {
+ case BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE:
+ bal_get_ind__free_mem_access_term_ind_op_state(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_ACCESS_TERM_PROC_ERR:
+ bal_get_ind__free_mem_access_term_proc_err(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_FLOW_OP_STATE:
+ bal_get_ind__free_mem_flow_op_state(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_FLOW_PROC_ERR:
+ bal_get_ind__free_mem_flow_proc_err(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_INTERFACE_OP_STATE:
+ bal_get_ind__free_mem_interface_op_state(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_INTERFACE_LOS:
+ bal_get_ind__free_mem_interface_los(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_OP_STATE:
+ bal_get_ind__free_mem_terminal_op_state(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_DISC:
+ bal_get_ind__free_mem_terminal_disc(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_ALARM:
+ bal_get_ind__free_mem_terminal_alarm(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_DGI:
+ bal_get_ind__free_mem_terminal_dgi(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_DOWI:
+ bal_get_ind__free_mem_terminal_dowi(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_LOOCI:
+ bal_get_ind__free_mem_terminal_looci(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_PROC_ERR:
+ bal_get_ind__free_mem_terminal_proc_err(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_SDI:
+ bal_get_ind__free_mem_terminal_sdi(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_SFI:
+ bal_get_ind__free_mem_terminal_sfi(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_SUFI:
+ bal_get_ind__free_mem_terminal_sufi(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_SUB_TERM_ACT_FAIL:
+ bal_get_ind__free_mem_terminal_sub_term_act_fail(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TERMINAL_TIWI:
+ bal_get_ind__free_mem_terminal_tiwi(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_TM_SCHED_OPER_STATS_CHANGE:
+ bal_get_ind__free_mem_tm_sched_osc(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_PKT_DATA:
+ bal_get_ind__free_mem_u_pkt_data(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_BAL_OMCI_RESP:
+ bal_get_ind__free_mem_u_bal_omci_resp(balIndCfg);
+ break;
+
+ case BAL_INDICATIONS__U_BAL_OAM_RESP:
+ bal_get_ind__free_mem_u_bal_oam_resp(balIndCfg);
+ break;
+
+ default:
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Unknown BAL indication %u", balIndCfg->u_case);
+ break;
+ }
+}
+
+void bal_get_ind__bal_get_ind_from_device_cb(grpc_c_context_t *context)
+{
+ BalDefault *dummy;
+ BalIndications *bal_indication;
+ list_node *node = NULL;
+ int ret_val = 0;
+
+ /*
+ * Read incoming message into set_cfg
+ */
+ if (context->gcc_payload) {
+ context->gcc_stream->read(context, (void **)&dummy, 0);
+ }
+
+ /*
+ * send it to BAL
+ */
+
+ pthread_mutex_lock(&bal_ind_queue_lock);
+ node = get_bal_indication_node();
+ pthread_mutex_unlock(&bal_ind_queue_lock);
+
+ if(node != NULL)
+ {
+ bal_indication = node->bal_indication;
+ bal_indication->ind_present = true;
+ bal_indication->has_ind_present = true;
+ }
+ else
+ {
+ bal_indication = malloc(sizeof(BalIndications));
+ memset(bal_indication, 0, sizeof(BalIndications));
+ bal_indications__init(bal_indication);
+ bal_indication->ind_present = false;
+ bal_indication->has_ind_present = true;
+ }
+
+ /*
+ * Write reply back to the client
+ */
+
+ ret_val = context->gcc_stream->write(context, bal_indication, -1);
+ is_grpc_write_pending(ret_val);
+
+ grpc_c_status_t status;
+ status.gcs_code = 0;
+
+ /*
+ * Finish response for RPC
+ */
+ if (context->gcc_stream->finish(context, &status))
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to write status");
+ }
+
+ /*Free memory for 'bal_indication' and 'node'*/
+ if (bal_indication->ind_present)
+ {
+ bal_get_ind__free_mem(bal_indication);
+ free(node);
+ }
+ else
+ {
+ free(bal_indication);
+ }
+}
+
+/*
+ * This functions gets invoked whenever bal finish RPC gets called
+ */
+void bal__bal_api_finish_cb(grpc_c_context_t *context)
+{
+
+}
+
+void bal_ind__bal_acc_term_oper_sts_cng_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_acc_term_cfg_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_acc_term_proc_err_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_flow_oper_sts_cng_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_flow_proc_err_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_iface_oper_sts_cng_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_iface_los_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_iface_stat_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_oper_sts_cng_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_discovery_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_alarm_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_dgi_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_proc_err_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_dowi_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_looci_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_sdi_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_sfi_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_sufi_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_subs_term_tiwi_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_sub_term_act_fail_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_tm_sched_oper_stats_change_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_pkt_bearer_channel_rx_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_pkt_omci_channel_rx_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_pkt_ieee_oam_channel_rx_ind_cb(grpc_c_context_t *context)
+{
+}
+void bal_ind__bal_sys_profile_ind_cb(grpc_c_context_t *context)
+{
+}
+
+/*
+** ASFVOLT_HEX2LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is",
+** balIndCfg.balomciresp->data->pkt.data, balIndCfg.balomciresp->data->pkt.len);
+*/
+#define SYSLOG_MAX_SIZE 1024
+void asfvolt_hexlog2(int prio, const char *_file_loc, int _file_line, const char *pFormat, void* pData, size_t len)
+{
+ unsigned char *inpPtr = pData;
+ char tempBuf[SYSLOG_MAX_SIZE];
+ size_t idx = 0;
+
+ idx += snprintf(tempBuf+idx, SYSLOG_MAX_SIZE-1, pFormat, len);
+ while (len-- > 0 && idx < SYSLOG_MAX_SIZE)
+ {
+ idx += snprintf(tempBuf+idx, SYSLOG_MAX_SIZE-idx, "%02x", *inpPtr++);
+ }
+ ASFVOLT_LOG_LOC(prio, _file_loc, _file_line, "%s", tempBuf);
+}
+
+/*
+ * Takes socket path as argument
+ */
+int main (int argc, char **argv)
+{
+ int i = 0;
+ grpc_c_server_t *server = NULL;
+
+ if (argc < 4)
+ {
+ fprintf(stderr, "Missing arguments\n");
+ exit(1);
+ }
+
+ strcpy(coreIpPortInfo.bal_core_arg1, argv[2] /*, strlen(argv[2])*/);
+ strcpy(coreIpPortInfo.bal_core_ip_port, argv[3]/*, strlen(argv[3])*/);
+
+ signal(SIGINT, sigint_handler);
+
+ /*
+ ** syslog initialization
+ */
+ //setlogmask (LOG_UPTO (LOG_NOTICE));
+
+ openlog (ASFVOLT_SYSLOG_NAME, ASFVOLT_SYSLOG_MODE, LOG_LOCAL1);
+
+ /*
+ * Initialize grpc-c library to be used with vanilla gRPC
+ */
+ grpc_c_init(GRPC_THREADS, NULL);
+
+ /*
+ * Create server object
+ */
+ test_server = grpc_c_server_create(argv[1]);
+
+ if (test_server == NULL)
+ {
+ ASFVOLT_LOG(ASFVOLT_ERROR, "Failed to create server");
+ exit(1);
+ }
+
+ /*
+ * Initialize greeter service
+ */
+ ASFVOLT_LOG(ASFVOLT_INFO, "voltha_bal_driver running.....");
+ bal__service_init(test_server);
+ bal_get_ind__service_init(test_server);
+ asfvolt__service_init(test_server);
+
+ /*
+ * Start server
+ */
+ grpc_c_server_start(test_server);
+
+ /*
+ * Blocks server to wait to completion
+ */
+ grpc_c_server_wait(test_server);
+
+ /* code added for example Makefile to compile grpc-c along with edgecore driver */
+ bal__service_init(server);
+ bal_get_ind__service_init(server);
+ asfvolt__service_init(server);
+}