VOL-4245: Migration to BAL3.10.2.2

Change-Id: I8b847660e949c91504ced760b1393e4def2300e8
diff --git a/.gitignore b/.gitignore
index 5200942..392ae60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,7 +38,9 @@
 .vscode
 
 # for unit tests
-keystore/
+agent/test/keystore/
+agent/test/lib
+agent/test/bal-oss-api-*
 
 # for Rx optical power test app and test data
 agent/src/read_rxtx_power
@@ -47,3 +49,6 @@
 
 # downloaded Accton patch files and BAL packages
 agent/download/*
+
+# debian build artifacts
+**/.debhelper
diff --git a/BUILDING.md b/BUILDING.md
index 8392411..261eb59 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -2,7 +2,7 @@
 
 ## Supported BAL API versions
 
-Currently, OpenOLT supports Broadcom's BAL API, version *3.4.9.6*.
+Currently, OpenOLT supports Broadcom's BAL API, version *3.10.2.2*.
 
 ## Proprietary software requirements
 
@@ -15,14 +15,16 @@
 
 The versions currently supported by the OpenOLT agent for Accton/Edgecore ASXvOLT16/ASGvOLT64 are:
 
-* `SW-BCM686OLT_3_4_9_6.tgz`
-* `sdk-all-6.5.13.tar.gz`
-* `ACCTON_BAL_3.4.9.6-V202012040101.patch`. This is downloadable from the common CSP CS00003233745.
+* `SW-BCM686OLT_3.10.2.2.tgz`
+* `sdk-all-6.5.21.tar.gz`
+* `ACCTON_BAL_3.10.2.2-V202111040101-BROADCOM-IP.patch`. This is downloadable from the common CSP CS00003233745.
+* `ACCTON_BAL_3.10.2.2-V202111040101.patch`. This is provided by Edgecore
+* `ACCTON_BAL_API_3.10.2.2-V202111090101.patch`. This is provided by Edgecore
 
 The versions currently supported by the OpenOLT agent for Phoenix/Radisys RLT-3200G-W are:
 
 * `SW-BCM686OLT_3_4_9_9.tgz`
-* `sdk-all-6.5.13.tar.gz`
+* `sdk-all-6.5.21.tar.gz`
 * `PHOENIX_BAL_3.4.9.9_V20210727.patch`. This is downloadable from the common CSP CS00003233745.
 
 > NOTE: the repository does not contain the above three source packages.  These
@@ -110,6 +112,7 @@
 
 ```shell
 git clone -b v20.08 https://github.com/seladb/PcapPlusPlus.git
+cd PcapPlusPlus
 ./configure-linux.sh —default
 make all
 sudo make install
@@ -152,7 +155,7 @@
 
 ```shell
 cd <dir containing Broadcom source and patch files>
-cp ACCTON_BAL_3.4.9.6-V202012040101.patch SW-BCM686OLT_3_4_9_6.tgz sdk-all-6.5.13.tar.gz <cloned openolt repo path>/agent/download
+cp ACCTON_BAL_API_3.10.2.2-V202111090101.patch ACCTON_BAL_3.10.2.2-V202111040101-BROADCOM-IP.patch ACCTON_BAL_3.10.2.2-V202111040101.patch SW-BCM686OLT_3.10.2.2.tgz sdk-all-6.5.21.tar.gz <cloned openolt repo path>/agent/download
 ```
 
 Run the configure script to generate the appropriate Makefile scaffolding for
@@ -183,7 +186,7 @@
 make OPENOLTDEVICE=asfvolt16 OPENOLT_PROTO_VER=master
 ```
 
-By default, the `OPENOLT_PROTO_VER` defaults to git tag *v4.2.0* of the
+By default, the `OPENOLT_PROTO_VER` defaults to git tag *v5.1.0* of the
 [voltha-protos](https://gerrit.opencord.org/gitweb?p=voltha-protos.git;a=summary)
 repo.
 
@@ -320,7 +323,7 @@
 make OPENOLTDEVICE=rlt-3200g-w OPENOLT_PROTO_VER=master
 ```
 
-By default, the `OPENOLT_PROTO_VER` defaults to git tag *v4.2.0* of the
+By default, the `OPENOLT_PROTO_VER` defaults to git tag *v5.1.0* of the
 [voltha-protos](https://gerrit.opencord.org/gitweb?p=voltha-protos.git;a=summary)
 repo.
 
diff --git a/Makefile b/Makefile
index 76fa0f0..6abcae2 100644
--- a/Makefile
+++ b/Makefile
@@ -26,8 +26,8 @@
 export OPENOLT_ROOT_DIR=$(shell pwd)
 
 ## Variables
-OPENOLTDEVICE     ?= asfvolt16
-OPENOLT_PROTO_VER ?= v4.2.0
+OPENOLTDEVICE     ?= sim
+OPENOLT_PROTO_VER ?= v5.1.0
 
 DOCKER                     ?= docker
 DOCKER_REGISTRY            ?=
diff --git a/README.md b/README.md
index 008ad04..c62563d 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@
 interfacing with the Maple/Qumran chipsets in OLTs such as the Edgecore/Accton
 ASXvOLT16 and with Aspen/Qumran chipsets in OLTs such as the Radisys/Phoenix
 RLT-3200G-W.
+The current version of the Broadcom BAL integrated with OpenOLT agent is BAL3.10.2.2.
 
 ```text
 
@@ -56,14 +57,6 @@
 `/ASXvOLT16/OpenOLT_Agent/From_ONF_Distribution/` and pick the right version of
 `.deb` package required for your testing.
 
-`voltha-2.6/openolt_<OPENOLTDEVICE>-2.6.0-<GIT Commit ID>.deb` is the latest version of package with support
-for BAL v3.4.9.6 .
-
-The pre-built debian packages have been tested on [Open Networking Linux
-(ONL)](http://opennetlinux.org/) version 4.14. The ONL Installer required for
-`voltha-2.6/openolt_<OPENOLTDEVICE>-2.6.0-<GIT Commit ID>.deb` is also available at in the same path, i.e.,
-voltha-2.6/.
-
 ## Install OpenOLT
 
 Copy the debian package to the OLT. For example:
@@ -75,13 +68,9 @@
 Install the *openolt.deb* package using *dpkg*:
 
 ```shell
-dpkg -i openolt_<OPENOLTDEVICE>-2.6.0-<GIT Commit ID>.deb
+dpkg -i openolt_<OPENOLTDEVICE>-<Version>-<GIT Commit ID>.deb
 ```
 
-The ONL version required for BAL v3.4.9.6 is ONL `4.14.151-OpenNetworkLinux`. Radisys RLT-3200G-W
-requires BAL v3.4.9.9 and ONL version `4.19-OpenNetworkLinux`. This will be built as part of
-build procedure described in `Build OpenOLT` section.
-
 ## Run OpenOLT as a Linux service
 
 Rebooting the OLT (after the installation) will start `dev_mgmt_daemon` and
@@ -330,33 +319,7 @@
 making this change.
 
 
-### Why does the Broadcom ONU not forward eapol packets?
 
-The firmware on the ONU is likely not setup to forward 802.1x EAPOL traffic on
-the Linux bridge. Drop down to the shell in the Broadcom ONU's console and
-configure the Linux bridge to forward 802.1x.
-
-```shell
-> sh
-# echo 8 > /sys/class/net/bronu513/bridge/group_fwd_mask
-```
-
-Version 1.7 of VOLTHA has a known issue where the ONU is only able to pass
-EAPOL packets from a specific LAN port (e.g. LAN port 1 on ALPHA ONUs)
-
-### How do I check packet counters on the ONU?
-
-LAN port packet counters:
-
-```shell
-bs /b/e port/index=lan{0,1,2,3,4,5,6}
-```
-
-WAN port packet counters:
-
-```shell
-bs /b/e port/index=wan0
-```
 
 ### How to get access to BAL CLI on OLT box
 
@@ -490,12 +453,3 @@
 Bandwidth-Profiles-for-Ethernet-Services](https://wiki.mef.net/display/CESG/Bandwidth+Profile)
 [Technology Profile Implementation
 Note](https://www.opennetworking.org/wp-content/uploads/2019/09/2pm-Shaun-Missett-Technology-Profile-and-Speed-Profile-Implementation.pdf)
-
-
-## Known Issues
-
-* The Minimum BW that should be configured for ITU PON Alloc Object has changed from 16Kbps
-  to 32Kbps from BAL3.1 to BAL3.2 release if you are using ALPHA ONUs.
-  As per BAL3.x documents, when FEC is disabled, the minimum BW is 16Kbps on the ITU PON Alloc Object.
-  This seems to be a discrepancy on the ALPHA ONU. So, ensure that `cir` + `eir` value is greater than
-  equal to *32000* for XGSPON use case for ALPHA ONU.
diff --git a/VERSION b/VERSION
index ded27b0..40c341b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.5.2-dev
+3.6.0
diff --git a/agent/Makefile.in b/agent/Makefile.in
index 9a92dcb..668fcbb 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -18,7 +18,7 @@
 ##        Config
 ##
 ##
-TOP_DIR=`pwd`
+TOP_DIR=$(shell pwd)
 OPENOLTDEVICE ?= generic
 
 #
@@ -27,27 +27,28 @@
 # sdk-all-<SDK_VER>.tar.gz - Broadcom Qumran SDK.
 # ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch.
 BAL_MAJOR_VER = 3
-BAL_MINOR_VER = 4
-BAL_REV_A_VER = 9
+BAL_MINOR_VER = 10
+BAL_REV_HOST_VER = 2
+BAL_REV_EMBEDDED_VER = 2
+BAL_API_SO_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_HOST_VER)
+BAL_VER = $(BAL_API_SO_VER).$(BAL_REV_EMBEDDED_VER)
 ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
-BAL_REV_B_VER = 9
-DEV_VER = 20210727
+DEV_VER = 202111040101
 # Version of Open Network Linux (ONL).
 ONL_KERN_VER_MAJOR = 4.19
 else
-BAL_REV_B_VER = 9
-DEV_VER = 202107300101
+DEV_VER = 202111040101
+API_VER = 202111090101
+# Version of Open Network Linux (ONL).
 ONL_KERN_VER_MAJOR = 4.14
 endif
-BAL_API_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER)
-BAL_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER)
-SDK_VER = 6.5.13
+SDK_VER = 6.5.21
 
 # OpenOLT Proto version.
 # This specifies the GIT tag in https://github.com/opencord/voltha-protos
 # repo that we need to refer to, to pick the right version of
 # openolt.proto and tech_profile.proto
-OPENOLT_PROTO_VER ?= v4.2.0
+OPENOLT_PROTO_VER ?= v5.1.0
 
 # Variables used for Inband build
 INBAND = "n"
@@ -115,10 +116,9 @@
 
 # Enabling SCALE_AND_PERF for higher performance and scaling to 512 subscribers. Enabling the flag will
 # disable the handling in FLOW_CHECKER and also disable flow statistics
-# Setting SW_UTIL_SHELL=y will enable QAX debug shell when compiling for Broadcom chip based OLT
 CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBAL_VER=\"$(BAL_VER)\" -DLABEL_VCS_URL=\"$(LABEL_VCS_URL)\" \
             -DLABEL_VCS_REF=\"$(LABEL_VCS_REF)\" -DLABEL_BUILD_DATE=\"$(LABEL_BUILD_DATE)\" \
-            -DLABEL_COMMIT_DATE=\"$(LABEL_COMMIT_DATE)\" -DFLOW_CHECKER -USCALE_AND_PERF -DSW_UTIL_SHELL=n
+            -DLABEL_COMMIT_DATE=\"$(LABEL_COMMIT_DATE)\" -DFLOW_CHECKER -USCALE_AND_PERF
 CPPFLAGS += -I./
 CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix
 LDFLAGS += @LDFLAGS@
@@ -141,6 +141,7 @@
 		git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
 		cp download/Makefile.onl $(ONL_DIR)/Makefile; \
 		install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux; \
+		cp download/disable-certificate-validation*.patch $(ONL_DIR)/OpenNetworkLinux; \
 		if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600x-w" ]; \
 		then \
 			cp $(TOP_DIR)/device/$(OPENOLTDEVICE)/update_kernel_options.sh $(ONL_DIR)/OpenNetworkLinux/.; \
@@ -157,90 +158,103 @@
 distclean-onl:
 	sudo rm -rf $(ONL_DIR)
 
+
 ########################################################################
 ##
 ##
-##        Broadcom LIBRARY APIs
+##        Broadcom LIBRARY OSS API
 ##
 ##
-BAL_API_DIR = $(BUILD_DIR)/bal-api-$(BAL_API_VER)
+BAL_API_DIR = $(TOP_DIR)/$(BUILD_DIR)/bal-oss-api-$(BAL_VER)
+BAL_API_PATCH = ACCTON_BAL_API_$(BAL_VER)-V$(API_VER).patch
 
-bal-api-$(BAL_API_VER):
+$(BUILD_DIR)/libbal_host_api-oss.so:
 	if [ ! -d "$(BAL_API_DIR)" ]; then \
 		mkdir -p $(BAL_API_DIR); \
-		git clone https://github.com/balapi/bal-api-$(BAL_API_VER).git $(BAL_API_DIR); \
+		cd $(BAL_API_DIR); \
+		git clone https://github.com/balapi/bal-sdk.git -b $(BAL_VER); \
+		mv bal-sdk bal-sdk-$(BAL_VER); \
+		cat $(TOP_DIR)/download/$(BAL_API_PATCH) | patch -p1 -d $(BAL_API_DIR)/bal-sdk-$(BAL_VER); \
+		cd $(BAL_API_DIR)/bal-sdk-$(BAL_VER); \
+		make BOARD=$(OPENOLTDEVICE); \
+		cp build/fs/libbal_host_api-oss.$(BAL_API_SO_VER).so ../../../$(BUILD_DIR)/libbal_host_api-oss.so; \
+		cp config/$(OPENOLTDEVICE)/bcm_config.h build/fs/include; \
+		cd .. && ln -s bal-sdk-$(BAL_VER)/build/fs/include include; \
+		cd; \
 	fi;
+
+
 bal-api-clean:
-	rm -rf $(BAL_API_DIR)
+	if [ -d "$(BAL_API_DIR)" ]; then \
+		rm -rf $(BAL_API_DIR); \
+	fi;
+	rm -rf $(BUILD_DIR)/libbal_host_api-oss.so
+
+########################################################################
+#
+# Choose api type: open api (api-oss) or proprietary api (api-nda-req)
+BAL_API_TYPE = api-oss
+#BAL_API_TYPE = api-nda-req
 
 ########################################################################
 ##
 ##
-##        BAL
+##        BAL OSS API
 ##
 ##
-BAL_ZIP = SW-BCM686OLT_$(subst .,_,$(BAL_VER)).tgz
-SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
-ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
-PATCH_FILE = PHOENIX_BAL_$(BAL_VER)_V$(DEV_VER).patch
-else
-PATCH_FILE = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
-BAL_IP_PATCH_FILE = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER)-BROADCOM-IP.patch
-endif
 BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal
-BCM_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER)
-BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api
-BALLIBNAME = bal_host_api
-BAL_INC = -I$(BAL_DIR)/host_driver/bal/bal_include \
-          -I$(BAL_DIR)/host_driver/topology \
-          -I$(BAL_DIR)/host_driver/utils \
-          -I$(BAL_DIR)/host_driver/api \
-          -I$(BAL_DIR)/host_driver/metadata \
-          -I$(BAL_DIR)/host_customized/os_abstraction \
-          -I$(BAL_DIR)/host_customized/os_abstraction/posix \
-          -I$(BAL_DIR)/host_customized/config \
-          -I$(BAL_DIR)/host_driver/api_conn_mgr \
-          -I$(BAL_DIR)/host_driver/conn_mgr \
-          -I$(BAL_DIR)/host_driver/api/host/topology \
-          -I$(BAL_DIR)/host_reference/cli \
-          -I$(BAL_DIR)/host_reference/api_cli \
-          -I$(BAL_API_DIR)/include \
-          -I$(BAL_API_DIR)/include/object_model
-CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline
+BALLIBDIR = $(BUILD_DIR)
+BALLIBNAME = bal_host_$(BAL_API_TYPE)
+BAL_INC = -I$(BAL_API_DIR)/include 
+CXXFLAGS += $(BAL_INC)
 CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG -DENABLE_CLI
 PORT_SPEED_FILE = $(BAL_DIR)/switch_sdk/$(SDK_VER)/rc/$(OPENOLTDEVICE)/board_files/broadcom/port_speed.soc
 
-sdk: onl bal-api-$(BAL_API_VER)
+########################################################################
+##
+##  BAL proprietary elements - NDA is required with Broadcom
+##
+##  For Accton patch - contact Accton corporation
+##
+##  Not required when building the OpenOLT agent from github source
+##
+##  !!!NOTE: libbal_host_api-nda_req.so is proprietary and must not be
+##           published in any open debian package or otherwise made
+##           available to third parties that do not have an SLA and
+##           NDA with Broadcom
+##
+BAL_SDK_ZIP = SW-BCM686OLT_$(subst .,_,$(BAL_VER)).tgz
+CSG_SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
+ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
+BROADCOM_IP_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER)-BROADCOM-IP.patch 
+BCM_SWITCH_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER)
+
+sdk: onl
 ifeq ("$(wildcard $(BAL_DIR))","")
 	mkdir $(BAL_DIR)
-	tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR)
-	cp download/$(SDK_ZIP) $(BCM_SDK)
+	tar zxvf download/$(BAL_SDK_ZIP) --strip 1 -C $(BAL_DIR)
+	cp download/$(CSG_SDK_ZIP) $(BCM_SWITCH_SDK)
 	chmod -R 744 $(BAL_DIR)
-	cat download/$(PATCH_FILE) | patch -p1 -d $(BAL_DIR)
-	cat download/$(BAL_IP_PATCH_FILE) | patch -p1 -d $(BAL_DIR)
+	cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR)
+	cat download/$(BROADCOM_IP_PATCH) | patch -p1 -d $(BAL_DIR)
+
 ifeq ("$(strip $(OPENOLTDEVICE))","asfvolt16")
 	echo "setenv port_speed_for_100 $(PORT_100G_SPEED)" > $(PORT_SPEED_FILE)
 else ifeq ("$(strip $(OPENOLTDEVICE))","asgvolt64")
 	echo "setenv port_speed_for_100 $(PORT_100G_SPEED)" > $(PORT_SPEED_FILE)
 	echo "setenv port_speed_for_25 $(PORT_25G_SPEED)" >> $(PORT_SPEED_FILE)
 endif
+
 ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
 	chmod 0755 $(BAL_DIR)/onu_mgmt/libomcistack/me_codegen/omci_stack_codegen
-	make -C $(BAL_DIR) BOARD=phoenix ONL=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux ONL_DEBIAN_SUITE=$(shell lsb_release -c -s) OPEN_SOURCE=y
+	make -C $(BAL_DIR) BOARD=phoenix ONL=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux ONL_DEBIAN_SUITE=$(shell lsb_release -c -s)
 	make -C $(BAL_DIR) BOARD=phoenix release_board
 else
-	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux OPEN_SOURCE=y
+	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux
 	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
 endif
 endif
 
-bal-release: sdk
-ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
-	make -C $(BAL_DIR) BOARD=phoenix release_board
-else
-	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
-endif
-
 bal-clean:
 	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all
 
@@ -300,15 +314,9 @@
 DEPS = $(SRCS:.cc=.d)
 .DEFAULT_GOAL := all
 all: $(BUILD_DIR)/openolt
-$(BUILD_DIR)/openolt: sdk protos $(OBJS)
+$(BUILD_DIR)/openolt: $(BUILD_DIR)/lib$(BALLIBNAME).so sdk protos $(OBJS)
 	$(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) $(PCAPPLUSPLUS_LIB_PATH)
-ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
-	ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/phoenix/release/release_phoenix_v$(BAL_VER).tar.gz $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
-else
 	ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/.
-endif
-	ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_api.so $(BUILD_DIR)/.
-	ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_driver/dev_mgmt_daemon/dev_mgmt_daemon $(BUILD_DIR)/.
 	ln -sf $(LIBGRPC_PATH)/libz.so.1 $(BUILD_DIR)/libz.so.1
 	ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6
 	strip $(BUILD_DIR)/openolt
@@ -327,7 +335,7 @@
 	cp $(BUILD_DIR)/openolt device/$(OPENOLTDEVICE)/mkdebian/debian
 	cp $(BUILD_DIR)/libz.so.1 device/$(OPENOLTDEVICE)/mkdebian/debian
 	cp $(BUILD_DIR)/libstdc++.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian
-	cp $(BUILD_DIR)/libbal_host_api.so device/$(OPENOLTDEVICE)/mkdebian/debian
+	cp $(BUILD_DIR)/libbal_host_api-oss.so device/$(OPENOLTDEVICE)/mkdebian/debian
 	cp -a scripts/init.d device/$(OPENOLTDEVICE)/mkdebian/debian
 	cp -a $(RXTX_POWER_EXE) device/$(OPENOLTDEVICE)/mkdebian/debian
 ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
@@ -397,7 +405,7 @@
 	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/debhelper-build-stamp
 	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libz.so.1
 	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libstdc++.so.6
-	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libbal_host_api.so
+	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libbal_host_api-oss.so
 	@rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/
 	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/openolt
 	@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
@@ -414,7 +422,7 @@
 	@rm -f $(OBJS) $(DEPS)
 	@rm -rf $(OPENOLT_PROTOS_DIR)/googleapis
 	@rm -f $(BUILD_DIR)/libz.so.1
-	@rm -f $(BUILD_DIR)/libbal_host_api.so
+	@rm -f $(BUILD_DIR)/libbal_host_api-oss.so
 	@rm -f $(BUILD_DIR)/openolt
 	@rm -f $(BUILD_DIR)/dev_mgmt_daemon
 	@rm -f $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
diff --git a/agent/device/asfvolt16/mkdebian/debian/.debhelper/generated/asfvolt16/triggers b/agent/device/asfvolt16/mkdebian/debian/.debhelper/generated/asfvolt16/triggers
deleted file mode 100644
index 884a015..0000000
--- a/agent/device/asfvolt16/mkdebian/debian/.debhelper/generated/asfvolt16/triggers
+++ /dev/null
@@ -1,2 +0,0 @@
-# Triggers added by dh_makeshlibs
-activate-noawait ldconfig
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
index 908ff90..351f28e 100644
--- a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
@@ -17,7 +17,7 @@
 
 rm -rf /opt/bcm68620
 rm -rf /broadcom
-tar zxf /tmp/release_asfvolt16_V3.4.9.9.202107300101.tar.gz -C / 2>&1 > /dev/null
+tar zxf /tmp/release_asfvolt16_V3.10.2.2.202111040101.tar.gz -C / 2>&1 > /dev/null
 grep -q '\/opt\/bcm68620\/svk_init.sh' /etc/rc.local || sed -i -e '$i \/opt\/bcm68620\/svk_init.sh' /etc/rc.local
 rm -f /run/bcm68620
 mkdir -p /opt/openolt && cp /tmp/watchdog/openolt_dev_mgmt_daemon_process_watchdog /opt/openolt && cp /tmp/watchdog/watchdog.config /opt/openolt
@@ -33,7 +33,7 @@
 mv /tmp/openolt /broadcom
 mv /tmp/libz.so.1 /usr/local/lib
 mv /tmp/libstdc++.so.6 /usr/local/lib
-mv /tmp/libbal_host_api.so /usr/local/lib
+mv /tmp/libbal_host_api-oss.so /usr/local/lib
 /opt/bcm68620/svk_init.sh
 [ "A`cat ~/.bashrc| grep LD_LIBRARY_PATH`" = "A" ] && echo "export LD_LIBRARY_PATH=/broadcom:\$LD_LIBRARY_PATH" >> ~/.bashrc; . ~/.bashrc
 ldconfig /broadcom
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
index 96c91af..653eb48 100644
--- a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
@@ -21,5 +21,5 @@
 sed -i '\/opt\/bcm68620\/svk_init.sh/d' /etc/rc.local
 rm -rf /run/bcm68620
 rm -rf /usr/local/lib/libz.so.1
-rm -rf /usr/local/lib/libbal_host_api.so
+rm -rf /usr/local/lib/libbal_host_api-oss.so
 rm -rf /usr/local/lib/libstdc++.so.6
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
index c2e0343..5bf06fb 100644
--- a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
@@ -55,6 +55,6 @@
 rm -rf  /broadcom
 
 rm -rf /usr/local/lib/libz.so.1
-rm -rf /usr/local/lib/libbal_host_api.so
+rm -rf /usr/local/lib/libbal_host_api-oss.so
 rm -rf /usr/local/lib/libstdc++.so.6
 
diff --git a/agent/device/asfvolt16/mkdebian/debian/changelog b/agent/device/asfvolt16/mkdebian/debian/changelog
index e41b18e..7605b2e 100644
--- a/agent/device/asfvolt16/mkdebian/debian/changelog
+++ b/agent/device/asfvolt16/mkdebian/debian/changelog
@@ -1,6 +1,6 @@
-asfvolt16 (3.4.9.9+edgecore-V202107300101) stable; urgency=high
+asfvolt16 (3.10.2.2+edgecore-V202111040101) stable; urgency=high
 
-    * Based on code from SW-BCM686OLT_3.4.9.9.tgz.
-    * Merged the Accton's fixed to ACCTON_BAL_3.4.9.9-V202107300101.patch.
+    * Based on code from SW-BCM686OLT_3.10.2.2.tgz.
+    * Merged the Accton's fixed to ACCTON_BAL_3.10.2.2-V202111040101.patch.
 
- -- Jason Huang <jasonsc_huang@edge-core.com>  Mon, 30 NOV 2020 01:01:03 +0800
+ -- Jason Huang <jasonsc_huang@edge-core.com>  Thu, 21 Oct 2021 01:01:03 +0800
diff --git a/agent/device/asfvolt16/mkdebian/debian/control b/agent/device/asfvolt16/mkdebian/debian/control
index 66defdd..9f67c3b 100644
--- a/agent/device/asfvolt16/mkdebian/debian/control
+++ b/agent/device/asfvolt16/mkdebian/debian/control
@@ -9,5 +9,5 @@
 Architecture: amd64
 Depends: ${shlibs:Depends}
 Description: Broadcom OLT drivers,CLI
-  ported from Broadcom SDK-3.4.9.9 package
+  ported from Broadcom SDK-3.10.2.2 package
 
diff --git a/agent/device/asfvolt16/mkdebian/debian/files b/agent/device/asfvolt16/mkdebian/debian/files
index 39b81d8..fad9c5c 100644
--- a/agent/device/asfvolt16/mkdebian/debian/files
+++ b/agent/device/asfvolt16/mkdebian/debian/files
@@ -1 +1 @@
-asfvolt16_3.4.9.9+edgecore-V202107300101_amd64.deb misc optional
+asfvolt16_3.10.2.2+edgecore-V202111040101_amd64.deb misc optional
diff --git a/agent/device/asfvolt16/mkdebian/debian/rules b/agent/device/asfvolt16/mkdebian/debian/rules
index ede3cfa..6303703 100755
--- a/agent/device/asfvolt16/mkdebian/debian/rules
+++ b/agent/device/asfvolt16/mkdebian/debian/rules
@@ -26,10 +26,10 @@
 
 override_dh_auto_install:
 	mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
-	cp -a $(CURDIR)/debian/release_asfvolt16_V3.4.9.9.202107300101.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/release_asfvolt16_V3.10.2.2.202111040101.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/libz.so.1 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/libstdc++.so.6 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
-	cp -a $(CURDIR)/debian/libbal_host_api.so $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/libbal_host_api-oss.so $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/openolt $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/init.d $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/logrotate.d $(DEB_DH_INSTALL_SOURCEDIR)/tmp
diff --git a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst
index 0ec400d..803413a 100644
--- a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst
+++ b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst
@@ -17,7 +17,7 @@
 
 rm -rf /opt/bcm68620
 rm -rf /broadcom
-tar zxf /tmp/release_asgvolt64_V3.4.9.9.202107300101.tar.gz -C / 2>&1 > /dev/null
+tar zxf /tmp/release_asgvolt64_V3.10.2.2.202111040101.tar.gz -C / 2>&1 > /dev/null
 grep -q '\/opt\/bcm68620\/svk_init.sh' /etc/rc.local || sed -i -e '$i \/opt\/bcm68620\/svk_init.sh' /etc/rc.local
 rm -f /run/bcm68620
 mkdir -p /opt/openolt && cp /tmp/watchdog/openolt_dev_mgmt_daemon_process_watchdog /opt/openolt && cp /tmp/watchdog/watchdog.config /opt/openolt
@@ -33,7 +33,7 @@
 mv /tmp/openolt /broadcom
 mv /tmp/libz.so.1 /usr/local/lib
 mv /tmp/libstdc++.so.6 /usr/local/lib
-mv /tmp/libbal_host_api.so /usr/local/lib
+mv /tmp/libbal_host_api-oss.so /usr/local/lib
 /opt/bcm68620/svk_init.sh
 [ "A`cat ~/.bashrc| grep LD_LIBRARY_PATH`" = "A" ] && echo "export LD_LIBRARY_PATH=/broadcom:\$LD_LIBRARY_PATH" >> ~/.bashrc; . ~/.bashrc
 ldconfig /broadcom
diff --git a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm
index 96c91af..653eb48 100644
--- a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm
+++ b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm
@@ -21,5 +21,5 @@
 sed -i '\/opt\/bcm68620\/svk_init.sh/d' /etc/rc.local
 rm -rf /run/bcm68620
 rm -rf /usr/local/lib/libz.so.1
-rm -rf /usr/local/lib/libbal_host_api.so
+rm -rf /usr/local/lib/libbal_host_api-oss.so
 rm -rf /usr/local/lib/libstdc++.so.6
diff --git a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst
index c2e0343..5bf06fb 100644
--- a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst
+++ b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst
@@ -55,6 +55,6 @@
 rm -rf  /broadcom
 
 rm -rf /usr/local/lib/libz.so.1
-rm -rf /usr/local/lib/libbal_host_api.so
+rm -rf /usr/local/lib/libbal_host_api-oss.so
 rm -rf /usr/local/lib/libstdc++.so.6
 
diff --git a/agent/device/asgvolt64/mkdebian/debian/changelog b/agent/device/asgvolt64/mkdebian/debian/changelog
index 0565235..531eb3d 100644
--- a/agent/device/asgvolt64/mkdebian/debian/changelog
+++ b/agent/device/asgvolt64/mkdebian/debian/changelog
@@ -1,6 +1,6 @@
-asgvolt64 (3.4.9.9+edgecore-V202107300101) stable; urgency=high
+asgvolt64 (3.10.2.2+edgecore-V202111040101) stable; urgency=high
 
-    * Based on code from SW-BCM686OLT_3.4.9.9.tgz.
-    * Merged the Accton's fixed to ACCTON_BAL_3.4.9.9-V202107300101.patch.
+    * Based on code from SW-BCM686OLT_3.10.2.2.tgz.
+    * Merged the Accton's fixed to ACCTON_BAL_3.10.2.2-V202111040101.patch.
 
- -- Jason Huang <jasonsc_huang@edge-core.com>  Mon, 30 NOV 2020 01:01:03 +0800
+ -- Jason Huang <jasonsc_huang@edge-core.com>  Thu, 21 Oct 2021 01:01:03 +0800
diff --git a/agent/device/asgvolt64/mkdebian/debian/control b/agent/device/asgvolt64/mkdebian/debian/control
index 71d2075..f0c889d 100644
--- a/agent/device/asgvolt64/mkdebian/debian/control
+++ b/agent/device/asgvolt64/mkdebian/debian/control
@@ -9,5 +9,5 @@
 Architecture: amd64
 Depends: ${shlibs:Depends}
 Description: Broadcom OLT drivers,CLI
-  ported from Broadcom SDK-3.4.9.9 package
+  ported from Broadcom SDK-3.10.2.2 package
 
diff --git a/agent/device/asgvolt64/mkdebian/debian/files b/agent/device/asgvolt64/mkdebian/debian/files
index 4030926..f622278 100644
--- a/agent/device/asgvolt64/mkdebian/debian/files
+++ b/agent/device/asgvolt64/mkdebian/debian/files
@@ -1 +1 @@
-asgvolt64_3.4.9.9+edgecore-V202107300101_amd64.deb misc optional
+asgvolt64_3.10.2.2+edgecore-V202111090101_amd64.deb misc optional
diff --git a/agent/device/asgvolt64/mkdebian/debian/rules b/agent/device/asgvolt64/mkdebian/debian/rules
index 3fa5527..846675c 100755
--- a/agent/device/asgvolt64/mkdebian/debian/rules
+++ b/agent/device/asgvolt64/mkdebian/debian/rules
@@ -26,10 +26,10 @@
 
 override_dh_auto_install:
 	mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
-	cp -a $(CURDIR)/debian/release_asgvolt64_V3.4.9.9.202107300101.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/release_asgvolt64_V3.10.2.2.202111040101.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/libz.so.1 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/libstdc++.so.6 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
-	cp -a $(CURDIR)/debian/libbal_host_api.so $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/libbal_host_api-oss.so $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/openolt $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/init.d $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/logrotate.d $(DEB_DH_INSTALL_SOURCEDIR)/tmp
diff --git a/agent/device/sim/vendor.cc b/agent/device/sim/vendor.cc
new file mode 100644
index 0000000..86836ff
--- /dev/null
+++ b/agent/device/sim/vendor.cc
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2018-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 "vendor.h"
+
+void vendor_init()
+{
+}
diff --git a/agent/device/sim/vendor.h b/agent/device/sim/vendor.h
new file mode 100644
index 0000000..3cecd88
--- /dev/null
+++ b/agent/device/sim/vendor.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2018-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.
+ */
+
+#ifndef __VENDOR_H__
+#define __VENDOR_H__
+#define VENDOR_ID "ONF"
+#define SIM
+#define MODEL_ID  "sim"
+#define MAX_SUPPORTED_PON 16
+#define ONU_BIT_TRANSMISSION_DELAY 0.1004823/1000 /* unit: ns to us */
+#define MINIMUM_ONU_RESPONSE_RANGING_TIME 1572135 /* hardcore: this is ranging time for the shortest distance, typically 35us */
+
+// DeviceInfo definitions
+
+#define ONU_ID_START 1
+#define ONU_ID_END 32
+#define MAX_ONUS_PER_PON (ONU_ID_END - ONU_ID_START + 1)
+
+#define MAX_ALLOC_ID_PER_ONU 4
+#define ALLOC_ID_START 1024
+#define ALLOC_ID_END (ALLOC_ID_START + MAX_ONUS_PER_PON * MAX_ALLOC_ID_PER_ONU)
+
+#define GEM_PORT_ID_PER_ALLOC_ID 8
+#define GEM_PORT_ID_START 1024
+#define GEM_PORT_ID_END (GEM_PORT_ID_START + MAX_ONUS_PER_PON * MAX_ALLOC_ID_PER_ONU * GEM_PORT_ID_PER_ALLOC_ID)
+
+#define FLOW_ID_START 1
+#define FLOW_ID_END 65535
+#define MAX_FLOW_ID FLOW_ID_END
+#define INVALID_FLOW_ID 0
+
+#endif
diff --git a/agent/download/Makefile.onl b/agent/download/Makefile.onl
index d7ac044..5fdf412 100644
--- a/agent/download/Makefile.onl
+++ b/agent/download/Makefile.onl
@@ -18,9 +18,9 @@
 
 onl-4.14:
 	if [ $(INBAND) = y ]; then \
-	    cd OpenNetworkLinux && git checkout -B $@ $(COMMIT_ID) && git apply inband-$(COMMIT_ID).patch && docker/tools/onlbuilder --non-interactive -8 -c ./build-onl.sh; \
+	    cd OpenNetworkLinux && git checkout -B $@ $(COMMIT_ID) && git apply disable-certificate-validation-v$(COMMIT_ID).patch && git apply inband-$(COMMIT_ID).patch && docker/tools/onlbuilder --non-interactive -8 -c ./build-onl.sh; \
 	else \
-	    cd OpenNetworkLinux && git stash && git checkout -B $@ $(COMMIT_ID) && docker/tools/onlbuilder --non-interactive -8 -c ./build-onl.sh; \
+	cd OpenNetworkLinux && git stash && git checkout -B $@ $(COMMIT_ID) && git apply disable-certificate-validation-v$(COMMIT_ID).patch && docker/tools/onlbuilder --non-interactive -8 -c ./build-onl.sh; \
 	fi;
 onl-4.19:
 	if [ "$(BOARD)" = "rlt-3200g-w" ]; then \
diff --git a/agent/download/disable-certificate-validation-v72b95a7.patch b/agent/download/disable-certificate-validation-v72b95a7.patch
new file mode 100644
index 0000000..f4a073e
--- /dev/null
+++ b/agent/download/disable-certificate-validation-v72b95a7.patch
@@ -0,0 +1,13 @@
+diff --git a/make/kbuild.mk b/make/kbuild.mk
+index 8be2961b..f5048c5b 100644
+--- a/make/kbuild.mk
++++ b/make/kbuild.mk
+@@ -114,7 +114,7 @@ K_DTBS_DIR := $(K_SOURCE_DIR)-dtbs
+ # The kernel source archive. Download if not present.
+ #
+ $(K_ARCHIVE_PATH):
+-	cd $(ONL_KERNELS)/archives && wget $(K_ARCHIVE_URL)
++	cd $(ONL_KERNELS)/archives && wget --no-check-certificate $(K_ARCHIVE_URL)
+ 
+ 
+ .PHONY : ksource kpatched
diff --git a/agent/scripts/init.d/dev_mgmt_daemon b/agent/scripts/init.d/dev_mgmt_daemon
index 647ab92..2fc2b86 100755
--- a/agent/scripts/init.d/dev_mgmt_daemon
+++ b/agent/scripts/init.d/dev_mgmt_daemon
@@ -34,22 +34,7 @@
     OLT_MODEL=$PRODUCT_NAME
 fi
 
-if [ "$OLT_MODEL" = "ASXvOLT16" ]; then
-    Port_100G_SPEED=`cat $PORT_SPEED_FILE | awk -F "port_speed_for_100 " '{print $2}'`
-    [ "$Port_100G_SPEED" = "10000" ] && TOPOLOGY_CONFIG_FILE="$APPDIR/topology_config_16_ports.ini"
-    APPARGS="-pcie -d -port_100g_speed $Port_100G_SPEED -topology_config_file $TOPOLOGY_CONFIG_FILE"
-elif [ "$OLT_MODEL" = "ASGvOLT64" ]; then
-    Port_100G_SPEED=`cat $PORT_SPEED_FILE | awk -F "port_speed_for_100 " '{print $2}'`
-    [ "$Port_100G_SPEED" = "10000" ] && TOPOLOGY_CONFIG_FILE="$APPDIR/topology_config_16_ports.ini"
-    Port_25G_SPEED=`cat $PORT_SPEED_FILE | awk -F "port_speed_for_25 " '{print $2}'`
-    APPARGS="-pcie -d -port_100g_speed $Port_100G_SPEED -pcie -port_25g_speed $Port_25G_SPEED -topology_config_file $TOPOLOGY_CONFIG_FILE"
-elif [ "$OLT_MODEL" = "RLT-3200G" ] || [ "$OLT_MODEL" = "RLT-1600G" ] || [ "$OLT_MODEL" = "RLT-1600X" ]; then
     APPARGS="-pcie -d"
-else
-    Port_100G_SPEED="100000"
-    Port_25G_SPEED="25000"
-    APPARGS="-pcie -d -port_100g_speed $Port_100G_SPEED -pcie -port_25g_speed $Port_25G_SPEED -topology_config_file $TOPOLOGY_CONFIG_FILE"
-fi
 
 # Include functions
 set -e
diff --git a/agent/src/core_api_handler.cc b/agent/src/core_api_handler.cc
index b32781e..e3821c4 100644
--- a/agent/src/core_api_handler.cc
+++ b/agent/src/core_api_handler.cc
@@ -2373,6 +2373,7 @@
         // bcmbal_tm_sched_parent
         // The parent for the sub_term scheduler is the PON scheduler in the downstream
         BCMOLT_MSG_FIELD_SET(&tm_sched_cfg, attachment_point.u.tm_sched.tm_sched_id, get_default_tm_sched_id(intf_id, direction));
+        BCMOLT_MSG_FIELD_SET(&tm_sched_cfg, attachment_point.u.tm_sched.tm_sched_param.type, BCMOLT_TM_SCHED_PARAM_TYPE_PRIORITY);
         BCMOLT_MSG_FIELD_SET(&tm_sched_cfg, attachment_point.u.tm_sched.tm_sched_param.u.priority.priority, priority);
         /* removed by BAL v3.0, N/A - No direct attachment point of type ONU, same functionality may
            be achieved using the' virtual' type of attachment.
@@ -2820,6 +2821,7 @@
 
     BCMOLT_CFG_INIT(&cfg, tm_queue, key);
     BCMOLT_MSG_FIELD_SET(&cfg, tm_sched_param.u.priority.priority, priority);
+    BCMOLT_MSG_FIELD_SET(&cfg, tm_sched_param.type, BCMOLT_TM_SCHED_PARAM_TYPE_PRIORITY);
 
     err = bcmolt_cfg_set(dev_id, &cfg.hdr);
     if (err) {
diff --git a/agent/src/core_utils.cc b/agent/src/core_utils.cc
index 9081498..f50980a 100644
--- a/agent/src/core_utils.cc
+++ b/agent/src/core_utils.cc
@@ -871,7 +871,6 @@
     BCMOLT_CFG_INIT(&pon_cfg, pon_interface, pon_key);
     BCMOLT_FIELD_SET_PRESENT(&pon_cfg.data, pon_interface_cfg_data, state);
     BCMOLT_FIELD_SET_PRESENT(&pon_cfg.data, pon_interface_cfg_data, los_status);
-    BCMOLT_FIELD_SET_PRESENT(&pon_cfg.data, pon_interface_cfg_data, itu);
     #ifdef TEST_MODE
     // It is impossible to mock the setting of pon_cfg.data.state because
     // the actual bcmolt_cfg_get passes the address of pon_cfg.hdr and we cannot
diff --git a/agent/test/Makefile b/agent/test/Makefile
index 24a4382..26e984a 100644
--- a/agent/test/Makefile
+++ b/agent/test/Makefile
@@ -19,9 +19,9 @@
 ##
 ##
 TOP_DIR=`pwd`
-OPENOLTDEVICE ?= asfvolt16
+OPENOLTDEVICE ?= sim
 
-OPENOLT_PROTO_VER ?= v4.2.0
+OPENOLT_PROTO_VER ?= v5.1.0
 
 ########################################################################
 ##
@@ -41,8 +41,14 @@
 
 export CXX CXXFLAGS OPENOLT_PROTO_VER
 
-BAL_API_VER ?= bal-api-3.4.9.9
-BAL_API_DIR=$(BAL_API_VER)
+BAL_MAJOR_VER = 3
+BAL_MINOR_VER = 10
+BAL_REV_HOST_VER = 2
+BAL_REV_EMBEDDED_VER = 2
+BAL_API_SO_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_HOST_VER)
+BAL_API_VER = $(BAL_API_SO_VER).$(BAL_REV_EMBEDDED_VER)
+
+BAL_API_DIR=bal-oss-api-$(BAL_API_VER)
 BALLIBNAME=bcm_host_api_stubs
 BALLIBDIR=$(BAL_API_DIR)/stubs
 BAL_INC = -I$(BAL_API_DIR)/include \
@@ -93,10 +99,17 @@
 	if [ -d $(BAL_API_DIR) ]; then \
 		echo "$(BAL_API_DIR) exists"; \
 	else \
-		git clone https://github.com/balapi/$(BAL_API_VER).git ;\
-		sed -i "\$$i #include \"$(OPENOLT_ROOT_DIR)/agent/test/inc/bcmos_system_test.h\"" ./$(BAL_API_DIR)/include/bcmos_system.h; \
-		sed -i "\$$i #include \"$(OPENOLT_ROOT_DIR)/agent/test/inc/bcmos_common_test.h\"" ./$(BAL_API_DIR)/include/bcmos_common.h; \
-		sed -i "\$$i #include \"$(OPENOLT_ROOT_DIR)/agent/test/inc/bcmolt_api_model_api_structs_test.h\"" ./$(BAL_API_DIR)/include/object_model/bcmolt_api_model_api_structs.h; \
+		mkdir -p $(BAL_API_DIR); \
+		mkdir -p lib; \
+		cd $(BAL_API_DIR); \
+		git clone https://github.com/balapi/bal-sdk.git -b $(BAL_API_VER); \
+		mv bal-sdk bal-sdk-$(BAL_API_VER); \
+		cd bal-sdk-$(BAL_API_VER); \
+		make BOARD=$(OPENOLTDEVICE); \
+		cp build/fs/libbal_host_api-oss.$(BAL_API_SO_VER).so ../../lib/libbal_host_api-oss.so; \
+		cd .. && ln -s bal-sdk-$(BAL_API_VER)/build/fs/include include; \
+		sed -i 's/BUG_ON_PRINT((condition),/printf(/g' include/bcmos_system.h; \
+		cd ..;\
 	fi
 
 # openoltapi
diff --git a/agent/test/inc/bcmcli_session.h b/agent/test/inc/bcmcli_session.h
index c9de0c3..42f1e83 100644
--- a/agent/test/inc/bcmcli_session.h
+++ b/agent/test/inc/bcmcli_session.h
@@ -20,17 +20,25 @@
 typedef int bcmcli_session;
 typedef char bcmcli_entry[50];
 typedef char bcmcli_cmd_parm;
-struct bcmos_task {
-    char task_name[50];
-};
 
 typedef struct bcmcli_session_parm {
     void *get_prompt;
     int access_right;
 } bcmcli_session_parm;
 
+typedef struct bcmcli_cmd_cb {
+    int dummy;
+} bcmcli_cmd_cb;
+
+typedef struct bcmcli_access_right {
+    int dummy;
+} bcmcli_access_right;
+
+typedef struct bcmcli_cmd_extra_parm {
+    int dummy;
+} bcmcli_cmd_extra_parm;
+
 #define BCMCLI_ACCESS_ADMIN 0xff
-#define BUG_ON //
 #define BCMCLI_MAKE_CMD_NOPARM(ptr, command1, command2, command3)
 #define BAL_API_VERSION 3
 
diff --git a/agent/test/inc/bcmolt_conn_mgr.h b/agent/test/inc/bcmolt_conn_mgr.h
index 9b94fab..9fdfcb7 100644
--- a/agent/test/inc/bcmolt_conn_mgr.h
+++ b/agent/test/inc/bcmolt_conn_mgr.h
@@ -22,9 +22,5 @@
 
 typedef int bcmolt_goid;
 
-typedef struct bcmos_fastlock {
-    pthread_mutex_t lock;
-} bcmos_fastlock;
-
 }
 #endif
diff --git a/agent/test/inc/test_stub.h b/agent/test/inc/test_stub.h
index 9dc5814..5ad0df3 100644
--- a/agent/test/inc/test_stub.h
+++ b/agent/test/inc/test_stub.h
@@ -31,10 +31,6 @@
 
 
 void bcmos_usleep(uint32_t us);
-void* bcmos_calloc(uint32_t size);
-void bcmos_fastlock_init(bcmos_fastlock *lock, uint32_t flags);
-long bcmos_fastlock_lock(bcmos_fastlock *lock);
-void bcmos_fastlock_unlock(bcmos_fastlock *lock, long flags);
 
 #endif //__TEST_STUB_H__
 
diff --git a/agent/test/src/bal_stub.cc b/agent/test/src/bal_stub.cc
index 62eb931..73e9c5c 100644
--- a/agent/test/src/bal_stub.cc
+++ b/agent/test/src/bal_stub.cc
@@ -36,32 +36,12 @@
     usleep (10000);
 }
 
-void* bcmos_calloc(uint32_t size) {
-    void *ptr = malloc(size);
-    if (ptr) {
-       memset(ptr, 0, size);
-    }
-    return ptr;
-}
-
 void bcmos_free(void *ptr) {
     if (ptr) {
        free(ptr);
     }
 }
 
-void bcmos_fastlock_init(bcmos_fastlock *lock, uint32_t flags)  {
-    pthread_mutex_init(&(lock->lock), NULL);
-}
-
-long bcmos_fastlock_lock(bcmos_fastlock *lock) {
-    pthread_mutex_lock(&(lock->lock));
-}
-
-void bcmos_fastlock_unlock(bcmos_fastlock *lock, long flags) {
-    pthread_mutex_unlock(&(lock->lock));
-}
-
 /* Initialize API layer */
 bcmos_errno bcmolt_api_init(void)
 {
@@ -323,4 +303,45 @@
     printf ("-- stub bcmolt_api_conn_mgr_is_connected called --\n");
     return true;
 }
+
+bcmos_errno bcmos_mutex_create(bcmos_mutex *mutex, uint32_t flags, const char *name)
+{
+    pthread_mutexattr_t attr;
+    if (pthread_mutexattr_init(&attr) != 0) {
+      printf("pthread_mutex_attr_init() error");
+      exit(1);
+    }
+    pthread_mutex_init(&mutex->m, &attr);
+    return BCM_ERR_OK;
+}
+
+/* Destroy mutex */
+void bcmos_mutex_destroy(bcmos_mutex *mutex)
+{
+    pthread_mutex_destroy(&mutex->m);
+}
+
+/* Lock mutex */
+void bcmos_mutex_lock(bcmos_mutex *mutex)
+{
+    pthread_mutex_lock(&mutex->m);
+}
+
+/* Release mutex */
+void bcmos_mutex_unlock(bcmos_mutex *mutex)
+{
+    pthread_mutex_unlock(&mutex->m);
+}
+
+void *bcmos_alloc(uint32_t size)
+{
+    return malloc(size);
+}
+
+bcmos_errno bcmcli_cmd_add(bcmcli_entry *dir, const char *name, bcmcli_cmd_cb cmd_cb,
+                  const char *help, bcmcli_access_right access_right,
+                  const bcmcli_cmd_extra_parm *extras, bcmcli_cmd_parm parms[]) {
+    return BCM_ERR_OK;
+}
+
 }
diff --git a/protos/Makefile b/protos/Makefile
index 06a68c0..e56d45e 100644
--- a/protos/Makefile
+++ b/protos/Makefile
@@ -19,7 +19,7 @@
 # This specifies the GIT tag in https://github.com/opencord/voltha-protos
 # repo that we need to refer to, to pick the right version of
 # openolt.proto, ext_config.proto and tech_profile.proto
-OPENOLT_PROTO_VER ?= v4.2.0
+OPENOLT_PROTO_VER ?= v5.1.0
 
 CXX ?= g++
 CPPFLAGS += `pkg-config --cflags protobuf grpc` -I googleapis/gens -I./
@@ -29,7 +29,7 @@
 GRPC_CPP_PLUGIN = grpc_cpp_plugin
 GRPC_CPP_PLUGIN_PATH ?= $(shell which grpc_cpp_plugin)
 
-OBJS = voltha_protos/common.pb.o voltha_protos/common.grpc.pb.o voltha_protos/tech_profile.pb.o voltha_protos/tech_profile.grpc.pb.o voltha_protos/ext_config.pb.o voltha_protos/ext_config.grpc.pb.o voltha_protos/openolt.pb.o voltha_protos/openolt.grpc.pb.o ./googleapis/gens/google/api/annotations.grpc.pb.o ./googleapis/gens/google/api/annotations.pb.o ./googleapis/gens/google/api/http.pb.o
+OBJS = voltha_protos/common.pb.o voltha_protos/common.grpc.pb.o voltha_protos/tech_profile.pb.o voltha_protos/tech_profile.grpc.pb.o voltha_protos/ext_config.pb.o voltha_protos/ext_config.grpc.pb.o voltha_protos/extensions.pb.o voltha_protos/extensions.grpc.pb.o voltha_protos/openolt.pb.o voltha_protos/openolt.grpc.pb.o ./googleapis/gens/google/api/annotations.grpc.pb.o ./googleapis/gens/google/api/annotations.pb.o ./googleapis/gens/google/api/http.pb.o
 
 .DEFAULT_GOAL := all
 
@@ -62,6 +62,9 @@
 	if [ ! -e "voltha_protos/ext_config.proto" ]; then \
                 wget -O voltha_protos/ext_config.proto https://raw.githubusercontent.com/opencord/voltha-protos/$(OPENOLT_PROTO_VER)/protos/voltha_protos/ext_config.proto; \
         fi;
+	if [ ! -e "voltha_protos/extensions.proto" ]; then \
+                wget -O voltha_protos/extensions.proto https://raw.githubusercontent.com/opencord/voltha-protos/$(OPENOLT_PROTO_VER)/protos/voltha_protos/extensions.proto; \
+        fi;
 
 
 grpc-target:
@@ -69,12 +72,14 @@
 	$(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) voltha_protos/openolt.proto
 	$(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) voltha_protos/tech_profile.proto
 	$(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) voltha_protos/ext_config.proto
+	$(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) voltha_protos/extensions.proto
 
 protobuf-target: voltha_protos
 	$(PROTOC) --proto_path=. -I./googleapis -I./ --cpp_out=. voltha_protos/common.proto
 	$(PROTOC) --proto_path=. -I./googleapis -I./ --cpp_out=. voltha_protos/openolt.proto
 	$(PROTOC) --proto_path=. -I./googleapis -I./ --cpp_out=. voltha_protos/tech_profile.proto
 	$(PROTOC) --proto_path=. -I./googleapis -I./ --cpp_out=. voltha_protos/ext_config.proto
+	$(PROTOC) --proto_path=. -I./googleapis -I./ --cpp_out=. voltha_protos/extensions.proto
 
 clean:
 	rm -rf *.a voltha_protos