VOL-455: Instructions for deployment of asfvolt16-driver on OLT
Added asfvolt-bal-prepare.sh and asfvolt-bal-buildall.sh scripts
Moved asfvolt- scripts to top level scripts directory
Moved grpc patches used by scripts to patches directory
Reverted device_simulator/README.md back to original bal_server instructions
Improved src/README.md for detailed build instructions for ASFvOLT16 ONL, SDK and voltha_bal_driver
Change-Id: Ic747853debf54fb06a9455aaeadc2c6f24aff09d
diff --git a/device_simulator/README.md b/device_simulator/README.md
index f2bb862..cbc648f 100644
--- a/device_simulator/README.md
+++ b/device_simulator/README.md
@@ -1,6 +1,6 @@
GRPC_C DEVICE SIMULATOR
- This is an executable (voltha_bal_driver), which will receive asfvolt16 adapter grpc-c messages and call respective device stub.
+ This is a executable(bal_server), which will receive asfvolt16 adapter grpc-c messages and call respective device stub.
It will send received responses/asynchronous indications from Device stub to Adapter.
GETTING STARTED
@@ -43,7 +43,7 @@
Patch 2:
Apply patch in service.c.patch and client.c.patch
- cp Makefile.am grpc-c/examples/
- - cp voltha_bal_driver.c grpc-c/examples/
+ - cp bal_server.c grpc-c/examples/
- cp bal_stub.c grpc-c/examples/
- cp bal_stub.h grpc-c/examples/
- Note: Update voltha adaptor IP in bal_stub.c
@@ -54,28 +54,19 @@
- sudo make install
To obtain proto files - Have a repo sync of opencord code base:
-
- cp opencord/incubator/voltha/voltha/adapters/asfvolt16_olt/protos/* examples/
To autogenerate code from proto files:
-
- make autogen
-Build voltha_bal_driver:
-
+Build bal_server:
- Note: Remove "-O2" from Makefile
- make clean_all;make
-The ultimate executable voltha_bal_driver can be found under ~/grpc-c/build/examples/.libs/
+The ultimate executable bal_server can be found under ~/grpc-c/build/examples/.libs/
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.
- A bash helper script 'asfvolt-driver-build.sh' is available to automate most of the build steps
+ ./bal_server "serverIP:port"
CONTRIBUTING
<TBD>
diff --git a/device_simulator/grpc-c_asfvolt16.patch b/patches/grpc-c_asfvolt16.patch
similarity index 100%
rename from device_simulator/grpc-c_asfvolt16.patch
rename to patches/grpc-c_asfvolt16.patch
diff --git a/device_simulator/grpc-c_compile-error.patch b/patches/grpc-c_compile-error.patch
similarity index 100%
rename from device_simulator/grpc-c_compile-error.patch
rename to patches/grpc-c_compile-error.patch
diff --git a/scripts/asfvolt-bal-buildall.sh b/scripts/asfvolt-bal-buildall.sh
new file mode 100755
index 0000000..29bcbcf
--- /dev/null
+++ b/scripts/asfvolt-bal-buildall.sh
@@ -0,0 +1,48 @@
+#
+# 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.
+#
+#
+# Run from OpenNetworkLinux top directory INSIDE of onlbuilder docker workspace
+#
+#cd /aux/OpenNetworkLinux
+set -e
+
+# override shell variables to match custom local build environment
+: ${ONL_TOPDIR:=`pwd`}
+: ${MAKE_JOBS:=1}
+: ${BALSRC_RELEASE:=bal_src_release}
+: ${SWISDK_TARNAME:=sdk-all-6.5.7}
+
+echo ONL_TOPDIR=${ONL_TOPDIR}
+echo MAKE_JOBS=${MAKE_JOBS}
+echo BALSRC_RELEASE=${BALSRC_RELEASE}
+
+cd ${BALSRC_RELEASE}/bal_release
+make BOARD=asfvolt16 maple_sdk_dir
+make BOARD=asfvolt16 maple_sdk
+make BOARD=asfvolt16 switch_sdk_dir
+make BOARD=asfvolt16 switch_sdk
+
+pushd 3rdparty/bcm-sdk/build-asfvolt16/${SWISDK_TARNAME}/systems/linux/user/x86-generic_64-2_6
+KERNDIR=$ONL_TOPDIR/packages/base/amd64/kernels/kernel-3.7-x86-64-all/builds/linux-3.7.10 BOARD=asfvolt16 ARCH=x86_64 SDKBUILD=build_bcm_user make
+popd
+
+make BOARD=asfvolt16 bal
+make BOARD=asfvolt16 release_board
+
+ls -l 3rdparty/maple/cur/asfvolt16/release
+
+date
+echo "ASFvOLT16 build finished!"
diff --git a/scripts/asfvolt-bal-prepare.sh b/scripts/asfvolt-bal-prepare.sh
new file mode 100755
index 0000000..d3ed825
--- /dev/null
+++ b/scripts/asfvolt-bal-prepare.sh
@@ -0,0 +1,57 @@
+#
+# 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.
+#
+#
+# Run from OpenNetworkLinux top directory
+#
+#cd /aux/OpenNetworkLinux
+set -e
+
+# override shell variables to match custom local build environment
+: ${ONL_TOPDIR:=`pwd`}
+: ${BALSRC_RELEASE:=bal_src_release}
+: ${BALSRC_ZIPNAME:=SW-BCM68620_2_4_3_6.zip}
+: ${SWISDK_TARNAME:=sdk-all-6.5.7}
+
+: ${BROADCOM_DOWNLOAD_DIR:=${HOME}/broadcom/download} # directory containing SW-BCM68620_2_4_x.zip
+: ${EDGECORE_DOWNLOAD_DIR:=${HOME}/edgecore/download} # directory containing ASFvOLT16 patch file for BAL
+
+: ${PATCH_FILENAME:=BAL_2.4.3.6-V201709291146.patch} # use latest know ASFvOLT16 patch file as default
+
+echo ONL_TOPDIR=${ONL_TOPDIR}
+echo BALSRC_RELEASE=${BALSRC_RELEASE}
+echo BALSRC_ZIPNAME=${BALSRC_ZIPNAME}
+echo SWISDK_TARNAME=${SWISDK_TARNAME}
+echo PATCH_FILENAME=${PATCH_FILENAME}
+echo BROADCOM_DOWNLOAD_DIR=${BROADCOM_DOWNLOAD_DIR}
+echo EDGECORE_DOWNLOAD_DIR=${EDGECORE_DOWNLOAD_DIR}
+
+mkdir -p $ONL_TOPDIR/${BALSRC_RELEASE}
+cd $ONL_TOPDIR/${BALSRC_RELEASE}
+
+unzip ${BROADCOM_DOWNLOAD_DIR}/${BALSRC_ZIPNAME}
+cp $BROADCOM_DOWNLOAD_DIR/${SWISDK_TARNAME}.tar.gz bal_release/3rdparty/bcm-sdk/
+
+cp $EDGECORE_DOWNLOAD_DIR/${PATCH_FILENAME} .
+chmod -R 744 .
+patch -p1 < ${PATCH_FILENAME}
+
+mkdir -p bcm68620_release/asfvolt16/kernels
+cd bcm68620_release/asfvolt16/kernels
+ln -s ../../../../packages/base/amd64/kernels/kernel-3.7-x86-64-all/builds/linux-3.7.10 linux-3.7.10
+ln -s ../../../../packages/base/any/kernels/archives/linux-3.7.10.tar.xz linux-3.7.10.tar.xz
+ln -s ../../../../packages/base/any/kernels/3.7/configs/x86_64-all/x86_64-all.config x86_64-all.config
+
+echo "BAL build area prepared"
diff --git a/device_simulator/asfvolt-driver-build.sh b/scripts/asfvolt-driver-build.sh
similarity index 96%
rename from device_simulator/asfvolt-driver-build.sh
rename to scripts/asfvolt-driver-build.sh
index 86bb360..7995fd6 100755
--- a/device_simulator/asfvolt-driver-build.sh
+++ b/scripts/asfvolt-driver-build.sh
@@ -18,8 +18,8 @@
#
#cd /aux/OpenNetworkLinux
set -e
-MAKE_JOBS=4
ASFVOLT_REPO_NAME=asfvolt16-driver
+: ${MAKE_JOBS:=4}
# override shell variables to match custom local build environment
: ${ONL_TOPDIR:=`pwd`}
@@ -28,9 +28,10 @@
: ${BALSRC_TOPDIR:=${ONL_TOPDIR}/${BALSRC_RELEASE}/bal_release}
: ${ASFSRC_TOPDIR:=${ONL_TOPDIR}/${ASFVOLT_REPO_NAME}/src}
: ${DEVSIM_TOPDIR:=${ONL_TOPDIR}/${ASFVOLT_REPO_NAME}/device_simulator}
-: ${PATCHF_TOPDIR:=${DEVSIM_TOPDIR}}
+: ${PATCHF_TOPDIR:=${ONL_TOPDIR}/${ASFVOLT_REPO_NAME}/patches}
echo ONL_TOPDIR=${ONL_TOPDIR}
+echo MAKE_JOBS=${MAKE_JOBS}
echo BALSRC_RELEASE=${BALSRC_RELEASE}
echo VOLTHA_TOPDIR=${VOLTHA_TOPDIR}
echo BALSRC_TOPDIR=${BALSRC_TOPDIR}
@@ -44,15 +45,14 @@
PROTOBUF_ARCH=703cd8e11c8d34283d4c8bf869c61866e8211c9d
PROTOBUF_C_ARCH=6a4f9a9a67c06769aaa9f65e8f89a56483271f5a
-# Note: removes existing directories: asfvolt16-driver, grpc, protobuf
-rm -rf ${ASFVOLT_REPO_NAME}
+# Note: removes existing directories: grpc, protobuf
rm -rf grpc protobuf grpc-* protobuf-*
#Clone asfvolt16-driver
# - The guide assumes that the asfvolt16-driver gerrit repo is cloned under the ONL toplevel directory:
# - git clone ssh://user@gerrit.opencord.org:29418/asfvolt16-driver ${HOME}/OpenNetworkLinux/asfvolt16-driver
-git clone https://gerrit.opencord.org/${ASFVOLT_REPO_NAME} ${ONL_TOPDIR}/${ASFVOLT_REPO_NAME}
+#git clone https://gerrit.opencord.org/${ASFVOLT_REPO_NAME} ${ONL_TOPDIR}/${ASFVOLT_REPO_NAME}
#steps to install grpc
# - Download as zip "grpc", "grpc-c", "protobuf" and "protobuf-c" from "https://github.com/opennetworkinglab/asfvolt16-driver/tree/master/third_party"
diff --git a/device_simulator/asfvolt-driver-package.sh b/scripts/asfvolt-driver-package.sh
similarity index 90%
rename from device_simulator/asfvolt-driver-package.sh
rename to scripts/asfvolt-driver-package.sh
index 928a8ef..b71ed01 100755
--- a/device_simulator/asfvolt-driver-package.sh
+++ b/scripts/asfvolt-driver-package.sh
@@ -28,6 +28,8 @@
: ${BALSRC_TOPDIR:=${ONL_TOPDIR}/${BALSRC_RELEASE}/bal_release}
: ${ASFDRVR_PKGDIR:=${ONL_TOPDIR}/asfdrvr-package-dir}
: ${ASFDVR_TARBALL_NAME:=asfvolt16-voltha-bal}
+: ${BUILD_FILENAME_TAG:=`date +%Y%m%d%H%M`}
+: ${ASFDVR_TARBALL_FNAME:=${ASFDVR_TARBALL_NAME}-${BUILD_FILENAME_TAG}.tgz}
echo ONL_TOPDIR=${ONL_TOPDIR}
echo BALSRC_RELEASE=${BALSRC_RELEASE}
@@ -35,8 +37,8 @@
echo BALSRC_TOPDIR=${BALSRC_TOPDIR}
echo ASFDRVR_PKGDIR=${ASFDRVR_PKGDIR}
echo ASFDVR_TARBALL_NAME=${ASFDVR_TARBALL_NAME}
-
-ASFDVR_TARBALL_FNAME=${ASFDVR_TARBALL_NAME}.tgz
+echo BUILD_FILENAME_TAG=${BUILD_FILENAME_TAG}
+echo ASFDVR_TARBALL_FNAME=${ASFDVR_TARBALL_FNAME}
# Note: removes existing directories: asfvolt16-driver, grpc, protobuf
rm -rf ${ASFDRVR_PKGDIR}
@@ -45,7 +47,7 @@
mkdir -p ${ASFDRVR_PKGDIR}
cd ${ASFDRVR_PKGDIR}
-#extrace ASFvOLT16 BAL/Maple built release tarball
+#extract ASFvOLT16 BAL/Maple built release tarball
tar zxf ${BALREL_TOPDIR}/bcm68620_release/asfvolt16/release/release_asfvolt16_V*.tar.gz
# voltha_bal_driver and grpc/protobufs live in /broadcom dir on ASFvOLT16 target
diff --git a/src/README.md b/src/README.md
index 1992538..eee1d4d 100644
--- a/src/README.md
+++ b/src/README.md
@@ -1,102 +1,116 @@
-GRPC_C DEVICE SIMULATOR
+# ASFvOLT16 vOLTHA BAL DRIVER
-This is a executable(voltha_bal_driver), which will received asfvolt16 adapter grpc-c messages and call respective device stub.
-It will send recevied responses/asynchronous indications from Device stub to Adapter.
-
-GETTING STARTED
-
-prerequisites to install grpc
- - sudo apt-get install build-essential libxml2-dev libgeos++-dev libpq-dev libbz2-dev libtool automake openssl libssl-dev golang-goprotobuf-dev
+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.
-INSTALLATION
+## GETTING STARTED
-Open Network Linux
-This guide assumes that Open Network Linux (ONL) is available at ${HOME}/OpenNetworkLinux. All the below steps need to be executed in the ONL build docker context. Refer to ONL build instructions (https://wiki.opencord.org/download/attachments/2556712/ONL_Build_Environment_Installation_Guide.pdf?api=v2).
+The following **proprietary** components are required to build the voltha_bal_driver.
- - Download ONL source code with Kernel 3.7.10.
+| Component/Package | Version | Filename | From | Contact|
+| ------------- |--------- | ----- | ---------| ----|
+| BAL/Maple SDK | 2.4.3.6 | SW-BCM68620_2_4_3_6.zip | Broadcom | TBD
+| Qumran SDK | 6.5.7 | sdk-all-6.5.7.tar.gz | Broadcom | TBD
+| ASFvOLT16 BAL patch| 2017.09.29.1146| BAL_2.4.3.6-V201709291146.patch | Edgecore | TBD
+
+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
+
```
- > git clone https://github.com/Lewis-Kang/OpenNetworkLinux.git -b kernel_3.7.10
+cd OpenNetworkLinux
+git clone https://gerrit.opencord.org/asfvolt16-driver
```
- - Start ONL build docker workspace
+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.
+
```
- > cd OpenNetworkLinux
+ONL_TOPDIR=/aux/OpenNetworkLinux
+BALSRC_RELEASE=bal_src_release
+BALSRC_ZIPNAME=SW-BCM68620_2_4_3_6.zip
+SWISDK_TARNAME=sdk-all-6.5.7
+PATCH_FILENAME=BAL_2.4.3.6-V201709291146.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
```
-Clone asfvolt16-driver
- - The guide assumes that the asfvolt16-driver gerrit repo is cloned under the ONL toplevel directory:
- - git clone ssh://user@gerrit.opencord.org:29418/asfvolt16-driver ${HOME}/OpenNetworkLinux/asfvolt16-driver
+### Build `voltha_bal_driver`
-steps to install grpc
- - Download as zip "grpc", "grpc-c", "protobuf" and "protobuf-c" from "https://github.com/opennetworkinglab/asfvolt16-driver/tree/master/third_party"
- - extract grpc at ${HOME}/OpenNetworkLinux/grpc
- - extract grpc-c at ${HOME}/OpenNetworkLinux/grpc-c
- - extract protobuf at ${HOME}/OpenNetworkLinux/grpc/thirdparty/protobuf
- - extract protobuf-c folder at ${HOME}/OpenNetworkLinux/grpc-c/third_party/protobuf-c
- - cd ${HOME}/OpenNetworkLinux/grpc/thirdparty/protobuf
- - ./autogen.sh
- - ./configure
- - make
- - sudo make install
- - cd ${HOME}/OpenNetworkLinux/grpc
- - export LD_LIBRARY_PATH=/usr/local/lib
- - make
- - sudo make install
+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.
-steps to install grpc-c
- - cd ${HOME}/OpenNetworkLinux/grpc-c/third_party/protobuf-c
- - ./autogen.sh
- - ./configure
- - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/protobuf
- - make
- - sudo make install
-
-Apply grpc-c patch
- - cd ${HOME}/OpenNetworkLinux/grpc-c/
- Patch 1:
- Apply patch in following link for grpc-c/lib - "https://github.com/Juniper/grpc-c/commit/353b40cd920cd749ed6cf71f8df17f1d5cf2c89d"
- Note:
- (This patch is having very few changes in two files(grpc-c/lib/client.c, grpc-c/lib/service.c.
- Download these two files from above link and replace at grpc-c/lib or merge these changes manually.)
- Patch 2:
- Apply patch in service.c.patch and client.c.patch
-
- - cd ${HOME}/OpenNetworkLinux
- - cp asfvolt16-driver/device_simulator/Makefile.am grpc-c/examples/
- - cp asfvolt16-driver/device_simulator/voltha_bal_driver.c grpc-c/examples/
- - cp asfvolt16-driver/device_simulator/bal_stub.c grpc-c/examples/
- - cp asfvolt16-driver/device_simulator/bal_stub.h grpc-c/examples/
- - Note: Update voltha adaptor IP in bal_stub.c (Is this required? Not clear which variable needs to be updated).
-
- - cd ${HOME}/OpenNetworkLinux/grpc-c
- - autoreconf --install
- - mkdir build && cd build
- - ../configure
- - make
- - sudo make install
-
-To obtain proto files - Have a repo sync of opencord voltha code base:
- - git clone https://github.com/opencord/voltha.git ${HOME}/voltha
- - cd ${HOME}/OpenNetworkLinux/grpc-c/
- - cp ${HOME}/voltha/voltha/adapters/asfvolt16_olt/protos/* examples/
-
-To autogenerate code from proto files:
- - cd ${HOME}/OpenNetworkLinux/grpc-c/build/examples
- - make autogen
-
-Build voltha_bal_driver:
- - cd ${HOME}/OpenNetworkLinux/grpc-c/build/examples
- - Note: Remove "-O2" from Makefile
- - Note: Set EDGECORE and BRCM_PATH in Makefile
```
- EDGECORE = ${HOME}/OpenNetworkLinux/asfvolt16-driver/src/
- BRCM_PATH = ${HOME}/OpenNetworkLinux/bal_src_release/bal_release
+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
```
- - make clean_all;make
+From the ONL build docker workspace:
-The ultimate executable voltha_bal_driver can be found under ~/grpc-c/build/examples/.libs/
+```
+ > 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-201710051908.tgz broadcom opt
+```
USAGE:
./voltha_bal_driver "serverIP:port1" -C "serverIP:port2" -A "serverIP:port3"