[VOL-1852][BAL3.0 Brigade] Support Edge-core OLT ASFvOLT16 (XGS-PON) and
ASGvOLT64 (GPON) devices
Change-Id: I316d35bc76c38b5381e8896148b4ee5cebbd1099
VOL-1850: Fix packet duplication with TM Queue Mapping profile
Fix for US and DS scheduler ID allocation irrespective of device type(asfvolt16/asfvolt64)
README.md file update with BAL3.1.1.1 specifications
Change-Id: I255bf7a4ff35771e9c628bb822ba2190a1fcd5ed
diff --git a/agent/device/asfvolt16/mkdebian/build_asfvolt16_deb.sh b/agent/device/asfvolt16/mkdebian/build_asfvolt16_deb.sh
new file mode 100755
index 0000000..b42cdf7
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/build_asfvolt16_deb.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Copyright 2018-present Open Networking Foundation
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+export ONL_ARCH="amd64"
+dpkg-buildpackage -b -us -uc -a"$ONL_ARCH"
diff --git a/agent/device/asfvolt16/mkdebian/debian/.debhelper/generated/asfvolt16/triggers b/agent/device/asfvolt16/mkdebian/debian/.debhelper/generated/asfvolt16/triggers
new file mode 100644
index 0000000..884a015
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/.debhelper/generated/asfvolt16/triggers
@@ -0,0 +1,2 @@
+# Triggers added by dh_makeshlibs
+activate-noawait ldconfig
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.install b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.install
new file mode 100644
index 0000000..ceeb05b
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.install
@@ -0,0 +1 @@
+/tmp
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
new file mode 100644
index 0000000..44693f2
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# Copyright 2018-present Open Networking Foundation
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+rm -rf /opt/bcm68620
+rm -rf /broadcom
+tar zxf /tmp/release_asfvolt16_V3.1.1.201908010203.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
+cp /tmp/init.d/dev_mgmt_daemon /etc/init.d
+cp /tmp/init.d/openolt /etc/init.d
+cp /tmp/logrotate.d/openolt /etc/logrotate.d
+chmod +x /etc/init.d/dev_mgmt_daemon
+chmod +x /etc/init.d/openolt
+update-rc.d dev_mgmt_daemon defaults
+update-rc.d openolt defaults
+mv /tmp/openolt /broadcom
+mv /tmp/libgrpc++.so.1 /usr/local/lib
+mv /tmp/libgrpc.so.6 /usr/local/lib
+mv /tmp/libstdc++.so.6 /usr/local/lib
+mv /tmp/libbal_host_api.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
new file mode 100644
index 0000000..3f45572
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Copyright 2018-present Open Networking Foundation
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+rm -rf /opt/bcm68620
+rm -rf /broadcom
+sed -i '\/opt\/bcm68620\/svk_init.sh/d' /etc/rc.local
+rm -rf /run/bcm68620
+rm -rf /usr/local/lib/libgrpc++.so.1
+rm -rf /usr/local/lib/libgrpc.so.6
+rm -rf /usr/local/lib/libbal_host_api.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
new file mode 100644
index 0000000..f3c0cbf
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+# Copyright 2018-present Open Networking Foundation
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# kill CLI applications
+echo "kill running time application"
+[ -n "`pidof dev_mgmt_daemon`" ] && killall dev_mgmt_daemon
+[ -n "`pidof bcm.user`" ] && killall bcm.user
+[ -n "`pidof dev_mgmt_attach`" ] && killall dev_mgmt_attach
+[ -n "`pidof embedded_console`" ] && killall embedded_console
+[ -n "`pidof example_user_appl`" ] && killall example_user_appl
+[ -n "`pidof openolt`" ] && killall openolt
+rm -f /tmp/root_dev_mgmt_pid /tmp/root_dev_mgmt_init_done
+sleep 3
+# unload drivers
+echo "unload kernel drivers"
+[ -n "`lsmod | grep i2c_devs`" ] && rmmod i2c_devs && sleep 1
+[ -n "`lsmod | grep nltr`" ] && rmmod nltr && sleep 1
+[ -n "`lsmod | grep pcie_proxy`" ] && rmmod pcie_proxy && sleep 1
+[ -n "`lsmod | grep devmem`" ] && rmmod devmem && sleep 1
+[ -n "`lsmod | grep fld_linux`" ] && rmmod fld_linux && sleep 1
+[ -n "`lsmod | grep os_linux`" ] && rmmod os_linux && sleep 1
+[ -n "`lsmod | grep ll_pcie`" ] && rmmod ll_pcie && sleep 1
+[ -n "`lsmod | grep linux_user_bde`" ] && rmmod linux-user-bde && sleep 1
+[ -n "`lsmod | grep linux_kernel_bde`" ] && rmmod linux-kernel-bde && sleep 1
+rm -rf /dev/maple_i2c
+rm -rf /dev/bcmolt_pcie_proxy
+rm -rf /dev/linux-uk-proxy
+rm -rf /dev/linux-user-bde
+rm -rf /dev/linux-kernel-bde
+rm -rf /dev/coop_dba_example
+rm -rf /dev/coop_dba
+for i in {0..7}; do
+ [ ! -f /dev/bcmolt_devmem_sram$i ] && rm -f /dev/bcmolt_devmem_sram$i
+ [ ! -f /dev/bcmolt_devmem_ddr$i ] && rm -f /dev/bcmolt_devmem_ddr$i
+ [ ! -f /dev/bcmolt_devmem_regs$i ] && rm -f /dev/bcmolt_devmem_regs$i
+done
+
+rm -rf /opt/bcm68620
+rm -rf /run/bcm68620
+
+rm -rf /broadcom
+
+rm -rf /usr/local/lib/libgrpc++.so.1
+rm -rf /usr/local/lib/libgrpc.so.6
+rm -rf /usr/local/lib/libbal_host_api.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
new file mode 100644
index 0000000..26396dd
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/changelog
@@ -0,0 +1,6 @@
+asfvolt16 (3.1.1.1+edgecore-V201908010203) stable; urgency=high
+
+ * Based on code from SW-BCM68620_3_1_1_1.tgz.
+ * Merged the Accton's fixed to ACCTON_BAL_3.1.1.1-V201908010203.patch.
+
+ -- Jason Huang <jasonsc_huang@edge-core.com> Thu, 08 AUG 2019 01:02:03 +0800
diff --git a/agent/device/asfvolt16/mkdebian/debian/compat b/agent/device/asfvolt16/mkdebian/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/agent/device/asfvolt16/mkdebian/debian/control b/agent/device/asfvolt16/mkdebian/debian/control
new file mode 100644
index 0000000..1c0e2bd
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/control
@@ -0,0 +1,13 @@
+Source: asfvolt16
+Section: misc
+Priority: optional
+Maintainer: Jason Huang <jasonsc_huang@edge-core.com>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.2
+
+Package: asfvolt16
+Architecture: amd64
+Depends: ${shlibs:Depends}
+Description: Broadcom OLT drivers,CLI
+ ported from Broadcom SDK-3.1.1.1 package
+
diff --git a/agent/device/asfvolt16/mkdebian/debian/copyright b/agent/device/asfvolt16/mkdebian/debian/copyright
new file mode 100644
index 0000000..0e527f0
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/copyright
@@ -0,0 +1 @@
+(C) Copyright Broadcom Corporation 2003-2016
diff --git a/agent/device/asfvolt16/mkdebian/debian/files b/agent/device/asfvolt16/mkdebian/debian/files
new file mode 100644
index 0000000..3f61427
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/files
@@ -0,0 +1 @@
+asfvolt16_3.1.1.1+edgecore-V201908010203_amd64.deb misc optional
diff --git a/agent/device/asfvolt16/mkdebian/debian/logrotate.d/openolt b/agent/device/asfvolt16/mkdebian/debian/logrotate.d/openolt
new file mode 100644
index 0000000..c224dbd
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/logrotate.d/openolt
@@ -0,0 +1,10 @@
+/var/log/bal_core_dist.log
+/var/log/openolt.log
+{
+ rotate 7
+ daily
+ compress
+ missingok
+ delaycompress
+ copytruncate
+}
diff --git a/agent/device/asfvolt16/mkdebian/debian/rules b/agent/device/asfvolt16/mkdebian/debian/rules
new file mode 100755
index 0000000..0fa5d87
--- /dev/null
+++ b/agent/device/asfvolt16/mkdebian/debian/rules
@@ -0,0 +1,74 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+#DH_VERBOSE = 1
+
+# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/default.mk
+
+# see FEATURE AREAS in dpkg-buildflags(1)
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# see ENVIRONMENT in dpkg-buildflags(1)
+# package maintainers to append CFLAGS
+#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+# package maintainers to append LDFLAGS
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+# main packaging script based on dh7 syntax
+%:
+ dh $@
+
+DOCS=LEGAL_TERMS README LICENSE_APACHE20
+
+DEB_DH_INSTALL_SOURCEDIR = $(CURDIR)/debian/tmp
+
+override_dh_auto_install:
+ mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+ cp -a $(CURDIR)/debian/release_asfvolt16_V3.1.1.201908010203.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+ cp -a $(CURDIR)/debian/libgrpc++.so.1 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+ cp -a $(CURDIR)/debian/libgrpc.so.6 $(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/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
+
+#override_dh_shlibdeps:
+# dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l$(ONLP_LIB_PATH):$(OFDPA_LIB_PATH)
+
+# avoid auto strip for debug ofagentapp.dbg
+#
+#override_dh_strip:
+# echo "No auto strip!"
+
+#override_dh_installdeb:
+# dh_installdeb
+# for pkg in $$(dh_listpackages); do \
+# sed -i -e 's!#DEB_SOURCE#!$(DEB_SOURCE)!' debian/$$pkg/DEBIAN/*; \
+# sed -i -e 's!#OPDPA_VER_SUFFIX#!-$(OPDPA_VER)!g' debian/$$pkg/DEBIAN/*; \
+# done
+
+test:
+ @echo DEB_SOURCE=$(DEB_SOURCE)
+ @echo DEB_VERSION=$(DEB_VERSION)
+ @echo DEB_VERSION_EPOCH_UPSTREAM=$(DEB_VERSION_EPOCH_UPSTREAM)
+ @echo DEB_VERSION_UPSTREAM_REVISION=$(DEB_VERSION_UPSTREAM_REVISION)
+ @echo DEB_VERSION_UPSTREAM=$(DEB_VERSION_UPSTREAM)
+ @echo DEB_DISTRIBUTION=$(DEB_DISTRIBUTION)
+ @echo DEB_HOST_ARCH=$(DEB_HOST_ARCH)
+ @echo DEB_HOST_ARCH_CPU=$(DEB_HOST_ARCH_CPU)
+ @echo DEB_HOST_ARCH_OS=$(DEB_HOST_ARCH_OS)
+ @echo DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE)
+ @echo DEB_HOST_GNU_CPU=$(DEB_HOST_GNU_CPU)
+ @echo DEB_HOST_GNU_SYSTEM=$(DEB_HOST_GNU_SYSTEM)
+ @echo DEB_BUILD_ARCH=$(DEB_BUILD_ARCH)
+ @echo DEB_BUILD_ARCH_CPU=$(DEB_BUILD_ARCH_CPU)
+ @echo DEB_BUILD_ARCH_OS=$(DEB_BUILD_ARCH_OS)
+ @echo DEB_BUILD_GNU_TYPE=$(DEB_BUILD_GNU_TYPE)
+ @echo DEB_BUILD_GNU_CPU=$(DEB_BUILD_GNU_CPU)
+ @echo DEB_BUILD_GNU_SYSTEM=$(DEB_BUILD_GNU_SYSTEM)
+ @echo ONLP_LIB_PATH=$(ONLP_LIB_PATH)
+# @echo OFDPA_LIB_PATH=$(OFDPA_LIB_PATH)
+# @echo OFDPA_BIN_PATH=$(OFDPA_BIN_PATH)
diff --git a/agent/device/asfvolt16/vendor.h b/agent/device/asfvolt16/vendor.h
index 12cc60c..6a34814 100644
--- a/agent/device/asfvolt16/vendor.h
+++ b/agent/device/asfvolt16/vendor.h
@@ -18,5 +18,7 @@
#ifndef __VENDOR_H__
#define __VENDOR_H__
#define VENDOR_ID "EdgeCore"
+#define ASFVOLT16
#define MODEL_ID "asfvolt16"
+#define MAX_SUPPORTED_PON 16
#endif