support for sda3016ss
Change-Id: Id86e26e2389455e04173a1568b503d3bd77dac6d
diff --git a/agent/Makefile.in b/agent/Makefile.in
index ab9de52..494bc81 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -36,6 +36,9 @@
DEV_VER = 20211129
# Version of Open Network Linux (ONL).
ONL_KERN_VER_MAJOR = 4.19
+else ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+BAL_VER = 3.10.0.0
+DEV_VER = 20220425
else
DEV_VER = 202111040101
API_VER = 202111090101
@@ -135,19 +138,33 @@
##
ONL_REPO = onl
ONL_DIR = $(BUILD_DIR)/$(ONL_REPO)
+ONL_COMMIT_ID = 11ed2140
onl:
if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \
mkdir -p $(ONL_DIR); \
git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
- cp download/Makefile.onl $(ONL_DIR)/Makefile; \
- install -m 755 download/build-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/.; \
- chmod 0755 $(ONL_DIR)/OpenNetworkLinux/update_kernel_options.sh; \
+ if [ "$(OPENOLTDEVICE)" = "sda3016ss" ]; then \
+ tar zxvf download/onl_zyxel_sda3016ss.tar.gz -C $(ONL_DIR)/OpenNetworkLinux; \
+ cp download/onl_workaround.patch $(ONL_DIR)/OpenNetworkLinux; \
+ cd $(ONL_DIR)/OpenNetworkLinux; \
+ git checkout $(ONL_COMMIT_ID); \
+ git apply --whitespace=nowarn onl_zyxel_sda3016ss.patch; \
+ git apply --whitespace=nowarn onl_workaround.patch; \
+ export VERSION=8; \
+ make docker; \
+ cd packages/base/amd64/kernels/kernel-4.19-lts-x86-64-all/builds/jessie; tar zcf linux-4.19.81.tgz linux-4.19.81; \
+ mv $(BUILD_DIR)/$(ONL_REPO)/OpenNetworkLinux/packages/base/amd64/kernels/kernel-4.19-lts-x86-64-all/builds/jessie/linux-4.19.81.tgz download/; \
+ else \
+ 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/.; \
+ chmod 0755 $(ONL_DIR)/OpenNetworkLinux/update_kernel_options.sh; \
+ fi; \
+ make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR) INBAND=n BOARD=$(OPENOLTDEVICE); \
fi; \
- make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR) INBAND=n BOARD=$(OPENOLTDEVICE); \
else \
if [ "$(INBAND)" = n -a "$$(grep "inband" $(ONL_DIR)/onl_build.mode | cut -d= -f 2)" = y ]; then \
make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR) INBAND=n; \
@@ -212,7 +229,7 @@
#
# 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_API_TYPE = api-nda_req
########################################################################
##
@@ -224,6 +241,27 @@
BALLIBDIR = $(BUILD_DIR)
BALLIBNAME = bal_host_$(BAL_API_TYPE)
BAL_INC = -I$(BAL_API_DIR)/include
+ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+BALLIBDIR = $(BAL_DIR)/build/host_reference/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_driver/system_types \
+ -I$(BAL_DIR)/host_driver/transport \
+ -I$(BAL_DIR)/host_reference/cli \
+ -I$(BAL_DIR)/host_reference/api_cli \
+ -I$(BAL_DIR)/host_reference/dev_log \
+ -I$(BAL_DIR)/host_reference/host_api \
+ -I$(BAL_DIR)/lib/cmdline
+endif
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
@@ -247,6 +285,7 @@
RADISYS_PATCH = RADISYS_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)
+ZYXEL_PATCH = ZYXEL_BAL_$(BAL_VER)_V$(DEV_VER).patch
sdk: onl
ifeq ("$(wildcard $(BAL_DIR))","")
@@ -256,6 +295,9 @@
chmod -R 744 $(BAL_DIR)
ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
cat download/$(RADISYS_PATCH) | patch -p1 -d $(BAL_DIR)
+else ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+ tar zxf download/sda3016ss_rootfs.tar.gz -C $(BAL_DIR)
+ cat download/$(ZYXEL_PATCH) | patch -p1 -d $(BAL_DIR)
else
cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR)
cat download/$(BROADCOM_IP_PATCH) | patch -p1 -d $(BAL_DIR)
@@ -273,6 +315,13 @@
chmod 0755 $(BCM_SWITCH_SDK)/sdk_patches_apply.sh
make -C $(BAL_DIR) BOARD=radisys ONL=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux ONL_DEBIAN_SUITE=$(shell lsb_release -c -s)
make -C $(BAL_DIR) BOARD=radisys release_board
+else ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+ cp download/Dockerfile $(BAL_DIR)
+ tar zxf download/linux-4.19.81.tgz -C $(BAL_DIR)
+ docker build $(BAL_DIR) -t tt_ub18
+ docker run -v $(TOP_DIR)/$(BAL_DIR):/mnt -w /mnt tt_ub18 bash -c 'make'
+ cp download/sda3016_nni_init.conf $(BAL_DIR)/sda3016ss_rootfs/opt/bcm68620/
+ docker run -v $(TOP_DIR)/$(BAL_DIR):/mnt -w /mnt tt_ub18 bash -c 'make release_board'
else
make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux
make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
@@ -280,8 +329,11 @@
endif
bal-clean:
+ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+ docker run -v $(TOP_DIR)/$(BAL_DIR):/mnt -w /mnt tt_ub18 bash -c 'make clean_all'
+else
make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all
-
+endif
########################################################################
##
##
@@ -338,9 +390,25 @@
ANSIBLE_DIR = /etc/ansible
OBJS = $(SRCS:.cc=.o)
DEPS = $(SRCS:.cc=.d)
+ZYXEL_DOCKER_PATCH = ZYXEL_Docker_V$(DEV_VER).patch
+
+ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+PREREQ = sdk
+else
+PREREQ = $(BUILD_DIR)/lib$(BALLIBNAME).so sdk protos $(OBJS)
+endif
.DEFAULT_GOAL := all
all: $(BUILD_DIR)/openolt
-$(BUILD_DIR)/openolt: $(BUILD_DIR)/lib$(BALLIBNAME).so sdk protos $(OBJS)
+$(BUILD_DIR)/openolt: $(PREREQ)
+ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+ if [ ! -f "Dockerfile" ]; then \
+ git apply --whitespace=nowarn download/$(ZYXEL_DOCKER_PATCH); \
+ fi;
+ if !(docker images | grep -q onl-builder-8-openolt); then \
+ docker build . -t onl-builder-8-openolt; \
+ fi;
+ docker/tools/onlbuilder -8 --isolate -c make -C agent OPENOLTDEVICE=sda3016ss openolt-in-docker
+else
$(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/radisys/release/release_radisys_v$(BAL_VER).tar.gz $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
@@ -356,11 +424,32 @@
make deb; \
make inband-onl; \
fi;
+endif
+
+openolt-in-docker: protos $(OBJS)
+ $(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $(BUILD_DIR)/openolt -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) $(PCAPPLUSPLUS_LIB_PATH)
+ ln -sf $(TOP_DIR)/$(BAL_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER)-$(DEV_VER).tar.gz $(BUILD_DIR)/.
+ ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_$(BAL_API_TYPE).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
+ echo "inband=n" > $(ONL_DIR)/onl_build.mode
+ mkdir -p tmp/opt/openolt
+ cp build/libbal_host_$(BAL_API_TYPE).so build/openolt tmp/opt/openolt
+ tar zcf build/release_$(OPENOLTDEVICE)_openolt_V$(BAL_VER)-$(DEV_VER).tar.gz tmp/
+ rm -rf tmp
src/%.o: src/%.cc
$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) $(CPPFLAGS) -I./common -c $< -o $@
deb: rxtx-power
+ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss")
+ mkdir -p device/$(OPENOLTDEVICE)/mkdebian/tmp
+ cp download/release_$(OPENOLTDEVICE)_custom_V2.0.0.1-$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/tmp
+ cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER)-$(DEV_VER) device/$(OPENOLTDEVICE)/mkdebian/tmp
+ cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_openolt_V$(BAL_VER)-$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/tmp
+else
cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/debian
cp $(BUILD_DIR)/openolt device/$(OPENOLTDEVICE)/mkdebian/debian
cp $(BUILD_DIR)/libz.so.1 device/$(OPENOLTDEVICE)/mkdebian/debian
@@ -368,10 +457,11 @@
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
+ cp -a scripts/watchdog device/$(OPENOLTDEVICE)/mkdebian/debian
+endif
ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
sed -i '/\/opt\/bcm68650\/svk_init.sh/c\ \/opt\/bcm68650\/svk_init.sh -qsfp_speed=$(PORT_QSFP_SPEED) -sfp_speed=$(PORT_SFP_SPEED)' device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/dev_mgmt_daemon
endif
- cp -a scripts/watchdog device/$(OPENOLTDEVICE)/mkdebian/debian
cd device/$(OPENOLTDEVICE)/mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh
mv device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_*.deb $(BUILD_DIR)/openolt_$(OPENOLTDEVICE)-$(VERSION)-$(LABEL_VCS_REF).deb
make deb-cleanup
@@ -444,6 +534,7 @@
@rm -f device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes
@rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(RXTX_POWER_EXE)
@rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/watchdog/
+ @rm -rf device/$(OPENOLTDEVICE)/mkdebian/tmp/
inband-onl-cleanup:
@rm -f $(ONL_DIR)/OpenNetworkLinux/*.patch
diff --git a/agent/common/core.h b/agent/common/core.h
index 6dba610..2159716 100644
--- a/agent/common/core.h
+++ b/agent/common/core.h
@@ -170,6 +170,7 @@
#define NUM_OF_PRIORITIES 8
#define NUMBER_OF_DEFAULT_INTERFACE_QUEUES 4 // <= NUM_OF_PRIORITIES
#define FILL_ARRAY(ARRAY,START,END,VALUE) for(int i=START;i<END;ARRAY[i++]=VALUE);
+#define FILL_ARRAY2(ARRAY,START,END,VALUE) for(int i=START;i<END;ARRAY[i]=VALUE,i+=2);
#define COUNT_OF(array) (sizeof(array) / sizeof(array[0]))
#define NUMBER_OF_PBITS 8
#define NUMBER_OF_REPLICATED_FLOWS NUMBER_OF_PBITS
diff --git a/agent/common/server.cc b/agent/common/server.cc
index 3199a51..83a66f3 100644
--- a/agent/common/server.cc
+++ b/agent/common/server.cc
@@ -42,6 +42,7 @@
const char *serverPort = "0.0.0.0:9191";
int signature;
+std::unique_ptr<Server> server;
Queue<openolt::Indication> oltIndQ;
@@ -240,6 +241,7 @@
openolt::Empty* response) override {
uint8_t ret = system("shutdown -r now");
+ server->Shutdown();
return Status::OK;
@@ -419,7 +421,7 @@
builder.AddListeningPort(server_address, credentials);
builder.RegisterService(&service);
- std::unique_ptr<Server> server(builder.BuildAndStart());
+ server = builder.BuildAndStart();
time_t now;
time(&now);
diff --git a/agent/device/sda3016ss/mkdebian/build_sda3016ss_deb.sh b/agent/device/sda3016ss/mkdebian/build_sda3016ss_deb.sh
new file mode 100755
index 0000000..fd381a7
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/build_sda3016ss_deb.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+#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.
+
+export DEB_VERSION="3.10.0.0-ABXZ-a12"
+
+echo -e "sda3016ss (${DEB_VERSION}) stable; urgency=high\n" > debian/changelog
+echo -e " * Based on code from SW-BCM686OLT_3_10_0_0.tgz.\n" >> debian/changelog
+echo -e " -- Wilson Lee <Wilson.Lee@zyxel.com.tw> Tue, 12 OCT 2021 01:01:03 +0800" >> debian/changelog
+
+export ONL_ARCH="amd64"
+dpkg-buildpackage -b -us -uc -a"$ONL_ARCH" --no-check-builddeps
diff --git a/agent/device/sda3016ss/mkdebian/debian/changelog b/agent/device/sda3016ss/mkdebian/debian/changelog
new file mode 100644
index 0000000..b7b0586
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/changelog
@@ -0,0 +1,5 @@
+sda3016ss (3.10.0.0-ABXZ-a12) stable; urgency=high
+
+ * Based on code from SW-BCM686OLT_3_10_0_0.tgz.
+
+ -- Wilson Lee <Wilson.Lee@zyxel.com.tw> Tue, 12 OCT 2021 01:01:03 +0800
diff --git a/agent/device/sda3016ss/mkdebian/debian/compat b/agent/device/sda3016ss/mkdebian/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/agent/device/sda3016ss/mkdebian/debian/control b/agent/device/sda3016ss/mkdebian/debian/control
new file mode 100644
index 0000000..c775d71
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/control
@@ -0,0 +1,13 @@
+Source: sda3016ss
+Section: misc
+Priority: optional
+Maintainer: Wilson Lee <Wilson.Lee@zyxel.com.tw>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.2
+
+Package: sda3016ss
+Architecture: amd64
+Depends: ${shlibs:Depends}
+Description: Broadcom OLT drivers,CLI
+ ported from Broadcom SDK-3.10.0.0 package
+
diff --git a/agent/device/sda3016ss/mkdebian/debian/copyright b/agent/device/sda3016ss/mkdebian/debian/copyright
new file mode 100644
index 0000000..db307cb
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/copyright
@@ -0,0 +1 @@
+(C) Copyright Broadcom Corporation 2016-2020
diff --git a/agent/device/sda3016ss/mkdebian/debian/files b/agent/device/sda3016ss/mkdebian/debian/files
new file mode 100644
index 0000000..9251daf
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/files
@@ -0,0 +1,2 @@
+sda3016ss_3.10.0.0-ABXZ-a12_amd64.buildinfo misc optional
+sda3016ss_3.10.0.0-ABXZ-a12_amd64.deb misc optional
diff --git a/agent/device/sda3016ss/mkdebian/debian/rules b/agent/device/sda3016ss/mkdebian/debian/rules
new file mode 100755
index 0000000..80bb7ba
--- /dev/null
+++ b/agent/device/sda3016ss/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)/tmp
+#
+#override_dh_auto_install:
+# mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+# cp -a $(CURDIR)/debian/release_asfvolt16_V3.4.3.3.202002100101.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 -- --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/sda3016ss/mkdebian/debian/sda3016ss.install b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.install
new file mode 100644
index 0000000..ceeb05b
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.install
@@ -0,0 +1 @@
+/tmp
diff --git a/agent/device/sda3016ss/mkdebian/debian/sda3016ss.postinst b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.postinst
new file mode 100644
index 0000000..5df67ab
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.postinst
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+#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.
+
+
+rm -rf /opt/bcm68620
+tar zxf /tmp/release_sda3016ss_custom_V2.0.0.1-20220425.tar.gz --strip-components=1 -C / 2>&1 > /dev/null
+tar zxf /tmp/release_sda3016ss_V3.10.0.0-20220425.tar.gz --strip-components=1 -C / 2>&1 > /dev/null
+rm -f /tmp/release_sda3016ss_custom_V2.0.0.1-20220425.tar.gz
+rm -f /tmp/release_sda3016ss_V3.10.0.0-20220425.tar.gz
+ln -sf /lib/platform-config/x86-64-zyxel-sda3016ss-r0/onl/lib/libonlp-x86-64-zyxel-sda3016ss.so /lib/platform-config/x86-64-zyxel-sda3016ss-r0/onl/lib/libonlp-x86-64-zyxel-sda3016ss.so.1
+chmod +x /opt/bcm68620/sda3016ss/htp/htpNniLb
+chmod +x /opt/bcm68620/sda3016ss/htp/htpPonLb
+chmod +x /etc/init.d/dev_mgmt_svc
+chmod +x /etc/init.d/openolt
+chmod +x /etc/init.d/hwmon_svc
+chmod +x /etc/init.d/htp_svc
+update-rc.d dev_mgmt_svc defaults
+update-rc.d openolt defaults
+update-rc.d hwmon_svc defaults
+update-rc.d htp_svc defaults
+mkdir -p /tmp/bcmpon
+echo "0:0,1:0" > /tmp/bcmpon/bcm68650_chip_reset
+
+tar zxf /tmp/release_sda3016ss_openolt_V3.10.0.0-20220425.tar.gz -C / --strip-components=1
+rm -f /tmp/release_sda3016ss_openolt_V3.10.0.0-20220425.tar.gz
+
diff --git a/agent/device/sda3016ss/mkdebian/debian/sda3016ss.postrm b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.postrm
new file mode 100644
index 0000000..a1c3c88
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.postrm
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+#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.
+
+
+rm -rf /opt/bcm68620
+update-rc.d dev_mgmt_svc remove
+update-rc.d openolt remove
+update-rc.d hwmon_svc remove
+update-rc.d htp_svc remove
+rm -f /etc/init.d/dev_mgmt_svc
+rm -f /etc/init.d/openolt
+rm -f /etc/init.d/hwmon_svc
+rm -f /etc/init.d/htp_svc
+
+rm -rf /opt/openolt
+#rm -rf /usr/local/lib/libgrpc.so
diff --git a/agent/device/sda3016ss/mkdebian/debian/sda3016ss.preinst b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.preinst
new file mode 100644
index 0000000..c80ba72
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/debian/sda3016ss.preinst
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+#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.
+
+
+# kill CLI applications
+echo "kill running time application"
+[ -n "`pidof openolt`" ] && killall openolt
+[ -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
+rm -f /tmp/root_dev_mgmt_pid /tmp/root_dev_mgmt_init_done
+sleep 3
+# unload drivers
+echo "unload kernel drivers"
+[ -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/bcmolt_pcie_proxy
+rm -rf /dev/linux-uk-proxy
+rm -rf /dev/linux-user-bde
+rm -rf /dev/linux-kernel-bde
+for i in {0..1}; 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
+
diff --git a/agent/device/sda3016ss/mkdebian/logrotate.d/openolt b/agent/device/sda3016ss/mkdebian/logrotate.d/openolt
new file mode 100755
index 0000000..480b59f
--- /dev/null
+++ b/agent/device/sda3016ss/mkdebian/logrotate.d/openolt
@@ -0,0 +1,10 @@
+/var/log/dev_mgmt_daemon.log
+/var/log/openolt.log
+{
+ rotate 7
+ daily
+ compress
+ missingok
+ delaycompress
+ copytruncate
+}
diff --git a/agent/device/sda3016ss/vendor.cc b/agent/device/sda3016ss/vendor.cc
new file mode 100755
index 0000000..86836ff
--- /dev/null
+++ b/agent/device/sda3016ss/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/sda3016ss/vendor.h b/agent/device/sda3016ss/vendor.h
new file mode 100755
index 0000000..d904e9b
--- /dev/null
+++ b/agent/device/sda3016ss/vendor.h
@@ -0,0 +1,48 @@
+/*
+ * 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 "Zyxel"
+#define SDA3016SS
+#define MODEL_ID "sda3016ss"
+#define MAX_SUPPORTED_PON 32
+#define MAX_SUPPORTED_SWITCH_PORT 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 8
+#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
+
+#define MAC_DEVICE_ACTIVATION_DELAY 200000 // in microseconds
+
+#endif
diff --git a/agent/src/core_api_handler.cc b/agent/src/core_api_handler.cc
index 15ed1ae..a833077 100644
--- a/agent/src/core_api_handler.cc
+++ b/agent/src/core_api_handler.cc
@@ -444,6 +444,14 @@
In future device mode can be configured to XGSPON || GPON by reading
device mode configuration from a static configuration file*/
BCMOLT_MSG_FIELD_SET (&oper, system_mode, BCMOLT_SYSTEM_MODE_GPON__16_X);
+ } else if (MODEL_ID == "sda3016ss") {
+ BCMOLT_MSG_FIELD_SET(&oper, inni_config.mode, BCMOLT_INNI_MODE_ALL_12_P_5_G);
+ BCMOLT_MSG_FIELD_SET(&oper, inni_config.mux, BCMOLT_INNI_MUX_TWO_TO_ONE);
+ BCMOLT_MSG_FIELD_SET (&oper, ras_ddr_mode, BCMOLT_RAS_DDR_USAGE_MODE_TWO_DDRS);
+ BCMOLT_MSG_FIELD_SET (&oper, system_mode, BCMOLT_SYSTEM_MODE_XGS__8_X_GPON__8_X_WDMA);
+ /* By default setting device mode to XGSPON/GPON combo for sda3016ss.
+ And it can also be configured to Any-PON (XGSPON || GPON) */
+
}
err = bcmolt_oper_submit(dev_id, &oper.hdr);
if (err) {
@@ -928,7 +936,8 @@
// On GPON, power level mode is not set to its default value (i.e. 0) as documented in Broadcom documentation.
// Instead, it is set to 2 which means -6 dbM attenuation. Therefore, we explicitly set it to the default value below.
- if (board_technology == "GPON") {
+ std::string intf_technology = intf_technologies[intf_id];
+ if (intf_technology == "GPON") {
BCMOLT_MSG_FIELD_SET(&interface_obj, itu.gpon.power_level.pls_maximum_allocation_size, BCMOLT_PON_POWER_LEVEL_PLS_MAXIMUM_ALLOCATION_SIZE_DEFAULT);
BCMOLT_MSG_FIELD_SET(&interface_obj, itu.gpon.power_level.mode, BCMOLT_PON_POWER_LEVEL_MODE_DEFAULT);
}
@@ -1036,6 +1045,11 @@
case 18: board_technology = "XGS-PON"; FILL_ARRAY(intf_technologies,devid*2,(devid+1)*2,"XGS-PON"); break;
case 19: board_technology = "XGS-PON"; FILL_ARRAY(intf_technologies,devid*16,(devid+1)*16,"XGS-PON"); break;
case 20: board_technology = MIXED_TECH; FILL_ARRAY(intf_technologies,devid*2,(devid+1)*2,MIXED_TECH); break;
+ case 38:
+ board_technology = "XGS-PON";
+ FILL_ARRAY2(intf_technologies,devid*16,(devid+1)*16,"XGS-PON");
+ FILL_ARRAY2(intf_technologies,devid*16+1,(devid+1)*16+1,"GPON");
+ break;
}
switch(dev_cfg.data.chip_family) {
@@ -1217,10 +1231,11 @@
BCMOLT_MSG_FIELD_SET(&onu_cfg, itu.serial_number, serial_number);
BCMOLT_MSG_FIELD_SET(&onu_cfg, itu.auto_learning, BCMOS_TRUE);
/*set burst and data profiles to fec disabled*/
- if (board_technology == "XGS-PON") {
+ std::string intf_technology = intf_technologies[intf_id];
+ if (intf_technology == "XGS-PON") {
BCMOLT_MSG_FIELD_SET(&onu_cfg, itu.xgpon.ranging_burst_profile, 2);
BCMOLT_MSG_FIELD_SET(&onu_cfg, itu.xgpon.data_burst_profile, 1);
- } else if (board_technology == "GPON") {
+ } else if (intf_technology == "GPON") {
BCMOLT_MSG_FIELD_SET(&onu_cfg, itu.gpon.ds_ber_reporting_interval, 1000000);
BCMOLT_MSG_FIELD_SET(&onu_cfg, itu.gpon.omci_port_id, onu_id);
}
@@ -2439,11 +2454,12 @@
uni_id %d, port_no %u\n", tm_sched_key.id, intf_id, onu_id, uni_id, port_no);
} else { //upstream
+ std::string intf_technology = intf_technologies[intf_id];
bcmolt_itupon_alloc_cfg cfg;
bcmolt_itupon_alloc_key key = { };
key.pon_ni = intf_id;
key.alloc_id = alloc_id;
- int bw_granularity = (board_technology == "XGS-PON")?XGS_BANDWIDTH_GRANULARITY:GPON_BANDWIDTH_GRANULARITY;
+ int bw_granularity = (intf_technology == "XGS-PON")?XGS_BANDWIDTH_GRANULARITY:GPON_BANDWIDTH_GRANULARITY;
/*
PIR: Maximum Bandwidth
CIR: Assured Bandwidth