VOL-1941: Use protobufs from the voltha-protos repo, not a copy
- Use protobufs from the voltha-protos repo, not a copy
- Provided option to specify the openolt proto version via make option
- Removed duplicate README.md
Change-Id: Id67714c8119521f8358aaa9245268c47b7e843cf
diff --git a/.gitignore b/.gitignore
index da69683..6bf2e45 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,5 +28,8 @@
# Test report
**/test_openolt_report.xml
+# Downloaded voltha-protos file
+voltha_protos
+
# IntelliJ Files
.idea
diff --git a/README.md b/README.md
index 937bed1..ef54f3f 100644
--- a/README.md
+++ b/README.md
@@ -198,6 +198,15 @@
make OPENOLTDEVICE=asfvolt16
```
+If you need to use a specific version of voltha-protos, then specify the git tag/branch corresponding to
+tht specific version as below. For ex:
+
+```shell
+make OPENOLTDEVICE=asfvolt16 OPENOLT_PROTO_VER=master
+```
+
+By default, the OPENOLT_PROTO_VER defaults to git tag *v1.0.3* of https://github.com/opencord/voltha-protos repo.
+
If the build process succeeds, libraries and executables will be created in the
*openolt/agent/build* directory.
diff --git a/agent/Makefile.in b/agent/Makefile.in
index bd4e3da..09338b0 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -38,6 +38,13 @@
#
# Version of Open Network Linux (ONL).
ONL_KERN_VER_MAJOR = 4.14
+
+# 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 ?= v1.0.3
+
#
# Build directory
BUILD_DIR = build
@@ -70,7 +77,7 @@
LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr
CXXFLAGSDEVICE = -I./device -I./device/$(OPENOLTDEVICE) -I./device/generic
-export CXX CXXFLAGS
+export CXX CXXFLAGS OPENOLT_PROTO_VER
prereq:
sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io
diff --git a/agent/README.md b/agent/README.md
deleted file mode 100644
index 1897a7a..0000000
--- a/agent/README.md
+++ /dev/null
@@ -1,373 +0,0 @@
-# OpenOLT agent
-
-The *OpenOLT agent* runs on white box Optical Line Terminals (OLTs) and
-provides a gRPC-based management and control interface to OLTs.
-
-The OpenOLT agent is used by [VOLTHA](https://github.com/opencord/voltha)
-through the [OpenOLT
-adapter](https://github.com/opencord/voltha/tree/master/voltha/adapters/openolt).
-
-OpenOLT agent currently supports Broadcom's Maple/Qumran chipsets.
-
-```text
-
- +---------------------------------+
- | VOLTHA |
- | |
- | +------------------+ |
- | | OpenOLT adapter | |
- +-------+--------+---------+------+
- |
- OpenOLT gRPC API |
- |
-+--------------------- ---------------+
-| | |
-| +------------------+ |
-| | OpenOLT agent | |
-| +--------+---------+ |
-| | |
-| Vendor specific | (e.g. Broadcom |
-| API | BAL API |
-| | |
-| +------------------+ |
-| | Vendor SoC/FPGA | |
-| |(e.g Maple/Qumran)| |
-| +------------------+ |
-| |
-| White box OLT |
-+-------------------------------------+
-
-```
-
-## Hardware requirements
-
-A list of tested devices and optics can be found in the [CORD hardware
-requirements](https://github.com/opencord/docs/blob/master/prereqs/hardware.md#suggested-hardware)
-guide, in the *R-CORD access equipment and optics* section.
-
-## Pre-built debian packages of OpenOLT agent for Accton/Edgecore ASFVOLT16
-
-Accton/Edgecore makes available pre-built debian packages of OpenOLT agent to their customers.
-Contact your Accton/Edgecore representative for more information.
-
-The pre-built debian packages have been tested on [this specific version of
-OpenNetworkingLinux
-(ONL)](https://github.com/opencord/OpenNetworkLinux/releases/download/20180124-olt-kernel-3.7.10/ONL-2.0.0_ONL-OS_2018-01-24.0118-1303f20_AMD64_INSTALLED_INSTALLER).
-
-More info on how to install ONL can be found on the official [ONL
-website](https://opennetlinux.org/docs/deploy).
-
-## Install OpenOLT
-
-Copy the debian package to the OLT. For example:
-
-```shell
-scp openolt.deb root@10.6.0.201:~/.
-```
-
-Install the *openolt.deb* package using *dpkg*:
-
-```shell
-dpkg -i openolt.deb
-```
-
-## Run OpenOLT as a Linux service
-
-Rebooting the OLT (after the installation) will start dev_mgmt_daemon and openolt as init.d services:
-
-Rebooting the OLT will start the dev_mgmt_daemon and openolt services:
-```shell
-reboot
-```
-The services can also be stopped/started manually:
-```shell
-service dev_mgmt_daemon stop
-service openolt stop
-service dev_mgmt_daemon start
-service openolt start
-```
-
-Check the status of the services:
-```shell
-service dev_mgmt_daemon status
-service openolt status
-```
-
-## Run OpenOLT in foreground
-
-Running the dev_mgmt_daemon and/or openolt services in the forground is useful for development and debugging. Make sure to first stop the services if they are running in background.
-
-Open a terminal and run the Broadcom BAL software (*dev_mgmt_daemon*):
-
-```shell
-cd /broadcom
-./dev_mgmt_daemon -d -pcie
-```
-
-While the first executable still runs (even in background), open another
-terminal and run *openolt*:
-
-```shell
-cd /broadcom
-./openolt
-```
-
-> **NOTE**: the two executables will remain open in the terminals, unless they
-> are put in background.
-
-### Connect from VOLTHA
-
-At the VOLTHA CLI, preprovision and enable the OLT:
-
-```shell
-(voltha) preprovision_olt -t openolt -H YOUR_OLT_MGMT_IP:9191
-(voltha) enable
-```
-
-### Additional notes
-
-* *9191* is the TCP port that the *OpenOLT* agent uses for its gRPC channel
-* In the commands above, you can either use the loopback IP address (127.0.0.1)
- or substitute all its occurrences with the management IP of your OLT
-
-## Build OpenOLT
-
-### Supported BAL API versions
-
-Currently, OpenOLT support the Broadcom BAL APIs, version *3.1.1.1*.
-
-### Proprietary software requirements
-
-The following proprietary source code is required to build the OpenOLT agent.
-
-* `SW-BCM68620_<BAL_VER>.zip` - Broadcom BAL source and Maple SDK
-* `sdk-all-<SDK_VER>.tar.gz` - Broadcom Qumran SDK
-* `ACCTON_BAL_<BAL_VER>-<ACCTON_VER>.patch` - Accton/Edgecore's patch
-
-The versions currently supported by the OpenOLT agent are:
-
-* SW-BCM68620_3_1_1_1.tgz
-* sdk-all-6.5.13.tar.gz
-* ACCTON_BAL_3.1.1.1-V201908010203.patch
-
-> NOTE: the repository does not contain the above four source packages. These
-> are needed to build the OpenOLT agent executable. Contact
-> [Broadcom](mailto:dave.baron@broadcom.com) to access the source packages.
-
-### System Requirements
-
-OpenOLT agent builds on *Ubuntu 16.04 LTS*.
-
-### Build procedure
-
-Clone the *openolt* repository either from GitHub or from OpenCORD Gerrit:
-
-```shell
-git clone git@github.com:opencord/openolt.git
-or
-git clone https://gerrit.opencord.org/openolt
-```
-
-Copy the Broadcom source and patch files to the openolt/agent/download directory:
-
-```shell
-cd <dir containing Broadcom source and patch files>
-cp SW-BCM68620_3_1_1_1.tgz sdk-all-6.5.13.tar.gz ACCTON_BAL_3.1.1.1-V201908010203.patch <cloned openolt repo path>/agent/download
-```
-
-Run Autoconfig to generate the appropriate makefile scaffolding for the desired target
-
-```shell
-cd openolt
-./configure
-```
-
-Run *make prereq* to install the package dependencies.
-This is usually a one-time thing, unless there is a change in the dependencies.
-
-```shell
-make OPENOLTDEVICE=asfvolt16 prereq
-```
-
-Run *make*. This can take a while to complete the first time, since it builds
-ONL and the Broadcom SDKs. Following runs will be much faster, as they only
-build the OpenOLT agent source.
-
-```shell
-make OPENOLTDEVICE=asfvolt16
-```
-
-If the build process succeeds, libraries and executables will be created in the
-*openolt/agent/build* directory.
-
-Optionally, build the debian package that will be installed on the OLT.
-
-```shell
-make OPENOLTDEVICE=asfvolt16 deb
-```
-
-If the build process succeeds, the *openolt.deb* package will be created as
-well in the *openolt/agent/build* directory.
-
-### Cleanup
-
-To cleanup the repository and start the build procedure again, run:
-
-```shell
-make OPENOLTDEVICE=asfvolt16 clean-all
-```
-
-## FAQ
-
-### How to change speed of ASFVOLT16 NNI interface?
-
-Auto-negotiation on the NNI (uplink) interfaces is not tested. By default, the OpenOLT agent sets the speed of the NNI interfaces to 100G. To downgrade the network interface speed to 40G, add the following lines at the end of the qax.soc (/broadcom/qax.soc) configuration file. A restart of the dev_mgmt_daemon and openolt executables is required after the change.
-
-```shell
-port ce128 sp=40000
-```
-
-This change can also be made at run-time from the CLI of the dev_mgmt_daemon:
-
-```shell
-d/s/shell
-port ce128 speed=40000
-```
-(It is safe to ignore the error msgs.)
-
-### How do I configure rate limiting?
-
-By default, the full 1G xgs-pon bandwidth is available to an ONU when no rate-limiting is applied. There is experimental support available to change the default bandwith and also rate-limit specific ONUs from the voltha CLI.
-
-
-Configure default rate limit (PIR = 5Mbps):
-
-```shell
-(voltha) xpon
-(voltha-xpon )traffic_descriptor_profile create -n "default" -f 1000 -a 1000 -m 5000
-```
-
-
-Configure ONU BRCM12345678 to be rate-limited to 100Mbps:
-```shell
-(voltha) xpon
-(voltha-xpon )traffic_descriptor_profile create -n "default" -f 50000 -a 70000 -m 100000
-```
-
-### Why does the Broadcom ONU not forward eapol packets?
-
-The firmware on the ONU is likely not setup to forward 802.1x 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
-```
-
-### 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 packt counters:
-```shell
-bs /b/e port/index=wan0
-```
-
-### How do I check packet counters on the OLT's PON interface?
-
-Following is an example of retrieving the interface description for PON intf_id 0 (TODO: document PON interface numbering for Edgecore OLT).
-
-```shell
-BCM.0> a/t clear=no object=pon_interface sub=itu_pon_stats pon_ni=0
-[-- API Start: bcmolt_stat_get --]
-[-- API Message Data --]
-object: pon_interface- PON Network Interface.
-get stat subgroup: itu_pon_stats-ITU PON Statistics. loid: 0 response: OK
-key={pon_ni=0}
-data={
- fec_codewords=0
- bip_units=0
- bip_errors=0
- rx_gem=0
- rx_gem_dropped=0
- rx_gem_idle=0
- rx_gem_corrected=0
- rx_crc_error=0
- rx_fragment_error=0
- rx_packets_dropped=0
- rx_dropped_too_short=0
- rx_dropped_too_long=0
- rx_key_error=0
- rx_cpu_omci_packets_dropped=0
- tx_ploams=157
- rx_ploams_dropped=0
- rx_allocations_valid=0
- rx_allocations_invalid=0
- rx_allocations_disabled=0
- rx_ploams=39
- rx_ploams_non_idle=39
- rx_ploams_error=0
- rx_cpu=0
- rx_omci=0
- rx_omci_packets_crc_error=0
- tx_packets=0
- tx_gem=0
- tx_cpu=0
- tx_omci=0
- tx_dropped_illegal_length=0
- tx_dropped_tpid_miss=0
- tx_dropped_vid_miss=0
- tx_dropped_total=0
- rx_xgtc_headers=39
- rx_xgtc_corrected=0
- rx_xgtc_uncorrected=0
- fec_codewords_uncorrected=0
- rx_fragments_errors=0
-}
-[-- API Complete: 0 (OK) --]
-```
-
-#### How do I check packet counters on the OLT's NNI interface?
-
-Following command retrieves NNI intf_id 0:
-
-```shell
-BCM.0> a/t clear=no object=nni_interface sub=stats id=0
-[-- API Start: bcmolt_stat_get --]
-[-- API Message Data --]
-object: nni_interface- nni_interface.
-get stat subgroup: stats-NNI Interface Statistics. loid: 0 response: OK
-key={id=0}
-data={
- rx_bytes=40023
- rx_packets=283
- rx_ucast_packets=0
- rx_mcast_packets=283
- rx_bcast_packets=0
- rx_error_packets=0
- rx_unknown_protos=0
- tx_bytes=0
- tx_packets=0
- tx_ucast_packets=0
- tx_mcast_packets=0
- tx_bcast_packets=0
- tx_error_packets=0
-}
-[-- API Complete: 0 (OK) --]
-```
-
-### How do I list flows installed in the OLT?
-
-In the dev_mgmt_daemon CLI:
-
-```shell
-> ~, Debug/, Maple/, Board/, Cld/, Transport/, Logger/, Quit
-> Debug
-.../Debug> Rsc_mgr/, Mac_util/, Switch/, sLeep, sHow_config, os/
-> Mac_util
-.../Mac_util> Print_flows, pRint_flows_for_gem, prInt_flows_for_alloc_id, Epon_helper
-> Print_flow
-```
diff --git a/agent/common/core.h b/agent/common/core.h
index 6dee098..ed3ea50 100644
--- a/agent/common/core.h
+++ b/agent/common/core.h
@@ -20,7 +20,7 @@
#include <grpc++/grpc++.h>
using grpc::Status;
-#include <openolt.grpc.pb.h>
+#include <voltha_protos/openolt.grpc.pb.h>
#include "state.h"
@@ -89,7 +89,7 @@
Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, uint32_t gemport_id, const std::string pkt);
Status ProbeDeviceCapabilities_();
Status ProbePonIfTechnology_();
-Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt, uint16_t flow_id);
+Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt);
Status FlowAdd_(int32_t access_intf_id, int32_t onu_id, int32_t uni_id, uint32_t port_no,
uint32_t flow_id, const std::string flow_type,
int32_t alloc_id, int32_t network_intf_id,
diff --git a/agent/common/server.cc b/agent/common/server.cc
index a77f006..cfe483a 100644
--- a/agent/common/server.cc
+++ b/agent/common/server.cc
@@ -30,8 +30,8 @@
#include "state.h"
#include <grpc++/grpc++.h>
-#include <openolt.grpc.pb.h>
-#include <tech_profile.grpc.pb.h>
+#include <voltha_protos/openolt.grpc.pb.h>
+#include <voltha_protos/tech_profile.grpc.pb.h>
using grpc::Server;
using grpc::ServerBuilder;
@@ -121,8 +121,7 @@
openolt::Empty* response) override {
return UplinkPacketOut_(
request->intf_id(),
- request->pkt(),
- request->flow_id());
+ request->pkt());
}
Status FlowAdd(
diff --git a/agent/src/core.cc b/agent/src/core.cc
index 9c27296..c1a381a 100644
--- a/agent/src/core.cc
+++ b/agent/src/core.cc
@@ -1629,11 +1629,14 @@
return Status::OK;
}
-Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt, bcmolt_flow_id flow_id) {
+Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt) {
bcmolt_flow_key key = {}; /* declare key */
bcmolt_bin_str buffer = {};
bcmolt_flow_send_eth_packet oper; /* declare main API struct */
+ // TODO: flow_id is currently not passed in UplinkPacket message from voltha.
+ bcmolt_flow_id flow_id = 0;
+
//validate flow_id and find flow_id/flow type: upstream/ingress type: PON/egress type: NNI
if (get_flow_status(flow_id, BCMOLT_FLOW_TYPE_UPSTREAM, FLOW_TYPE) == BCMOLT_FLOW_TYPE_UPSTREAM && \
get_flow_status(flow_id, BCMOLT_FLOW_TYPE_UPSTREAM, INGRESS_INTF_TYPE) == BCMOLT_FLOW_INTERFACE_TYPE_PON && \
@@ -1651,8 +1654,9 @@
}
}
}
- else
+ else {
return grpc::Status(grpc::StatusCode::NOT_FOUND, "no flow id found");
+ }
}
key.flow_type = BCMOLT_FLOW_TYPE_UPSTREAM; /* send from uplink direction */
@@ -1664,16 +1668,16 @@
buffer.arr = (uint8_t *)malloc((buffer.len)*sizeof(uint8_t));
memcpy(buffer.arr, (uint8_t *)pkt.data(), buffer.len);
if (buffer.arr == NULL) {
- OPENOLT_LOG(ERROR, openolt_log_id, "allocate pakcet buffer failed\n");
- return bcm_to_grpc_err(BCM_ERR_PARM, "allocate pakcet buffer failed");
+ OPENOLT_LOG(ERROR, openolt_log_id, "allocate packet buffer failed\n");
+ return bcm_to_grpc_err(BCM_ERR_PARM, "allocate packet buffer failed");
}
BCMOLT_FIELD_SET(&oper.data, flow_send_eth_packet_data, buffer, buffer);
bcmos_errno err = bcmolt_oper_submit(dev_id, &oper.hdr);
if (err) {
- OPENOLT_LOG(ERROR, openolt_log_id, "Error sending packets to port %d, flow_id %d, err %d\n", intf_id, key.flow_id, err);
+ OPENOLT_LOG(ERROR, openolt_log_id, "Error sending packets via nni port %d, flow_id %d err %d\n", intf_id, key.flow_id, err);
} else {
- OPENOLT_LOG(INFO, openolt_log_id, "sent packets to port %d in upstream direction (flow_id %d)\n", intf_id, key.flow_id);
+ OPENOLT_LOG(INFO, openolt_log_id, "sent packets to port %d in upstream direction, flow_id %d \n", intf_id, key.flow_id);
}
return Status::OK;
diff --git a/agent/src/indications.cc b/agent/src/indications.cc
index dc75317..6852e30 100644
--- a/agent/src/indications.cc
+++ b/agent/src/indications.cc
@@ -718,7 +718,6 @@
activation_fail_ind->set_intf_id(key->pon_ni);
activation_fail_ind->set_onu_id(key->onu_id);
- activation_fail_ind->set_fail_reason(data->fail_reason);
alarm_ind->set_allocated_onu_activation_fail_ind(activation_fail_ind);
ind.set_allocated_alarm_ind(alarm_ind);
diff --git a/agent/src/indications.h b/agent/src/indications.h
index c2f0724..f762e72 100644
--- a/agent/src/indications.h
+++ b/agent/src/indications.h
@@ -19,7 +19,7 @@
#define OPENOLT_INDICATIONS_H_
#include <grpc++/grpc++.h>
-#include <openolt.grpc.pb.h>
+#include <voltha_protos/openolt.grpc.pb.h>
#include "Queue.h"
extern "C" {
diff --git a/agent/src/stats_collection.cc b/agent/src/stats_collection.cc
index 2d535cf..62213c2 100644
--- a/agent/src/stats_collection.cc
+++ b/agent/src/stats_collection.cc
@@ -19,7 +19,6 @@
#include <unistd.h>
-#include <openolt.grpc.pb.h>
#include "indications.h"
#include "core.h"
#include "translation.h"
diff --git a/agent/src/stats_collection.h b/agent/src/stats_collection.h
index ab9f174..8e1c00f 100644
--- a/agent/src/stats_collection.h
+++ b/agent/src/stats_collection.h
@@ -18,7 +18,7 @@
#ifndef OPENOLT_STATS_COLLECTION_H_
#define OPENOLT_STATS_COLLECTION_H_
-#include <openolt.grpc.pb.h>
+#include <voltha_protos/openolt.grpc.pb.h>
extern "C"
{
diff --git a/agent/test/Makefile.in b/agent/test/Makefile.in
index ffe5e3b..2122266 100644
--- a/agent/test/Makefile.in
+++ b/agent/test/Makefile.in
@@ -22,6 +22,11 @@
TOP_DIR=`pwd`
OPENOLTDEVICE ?= asfvolt16
+# 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 ?= v1.0.3
# GRPC installation
GRPC_ADDR = https://github.com/grpc/grpc
@@ -47,7 +52,7 @@
LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr
CXXFLAGSDEVICE = -I../device -I../device/$(OPENOLTDEVICE) -I../device/generic
-export CXX CXXFLAGS
+export CXX CXXFLAGS OPENOLT_PROTO_VER
BAL_API_DIR=bal-api-3.1.0
BALLIBNAME=bcm_host_api_stubs
diff --git a/agent/test/README.md b/agent/test/README.md
index 1840e61..5ec0013 100644
--- a/agent/test/README.md
+++ b/agent/test/README.md
@@ -20,6 +20,16 @@
# This will build and run the unit test cases
$ make test
```
+
+If you need to use a specific version of voltha-protos, then specify the git tag/branch corresponding to
+tht specific version as below. For ex:
+
+```
+make OPENOLT_PROTO_VER=master test
+```
+
+By default, the OPENOLT_PROTO_VER defaults to git tag *v1.0.3* of https://github.com/opencord/voltha-protos repo.
+
Once you have successfully built and run the unit-test, the test report will be available in `test_openolt_report.xml` file in `agent/test`.
To clean all build artifacts and test reports, do `make clean` in `agent/test`.
diff --git a/protos/Makefile b/protos/Makefile
index 6ee661b..7f2c78c 100644
--- a/protos/Makefile
+++ b/protos/Makefile
@@ -14,18 +14,27 @@
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
+
+# 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 ?= v1.0.3
+
CXX ?= g++
#powerpc64-fsl-linux-g++
-CPPFLAGS += `pkg-config --cflags protobuf grpc` -I googleapis/gens
+CPPFLAGS += `pkg-config --cflags protobuf grpc` -I googleapis/gens -I./
CXXFLAGS += -std=c++11
#LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc` -ldl
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
-OBJS = tech_profile.pb.o tech_profile.grpc.pb.o openolt.pb.o 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/tech_profile.pb.o voltha_protos/tech_profile.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
-all: googleapis libopenoltapi.a
+.DEFAULT_GOAL := all
+
+all: googleapis get_openolt_proto libopenoltapi.a
libopenoltapi.a: $(OBJS)
ar cr $@ $^
@@ -40,16 +49,27 @@
make -C googleapis LANGUAGE=cpp GRPCPLUGIN=$(GRPC_CPP_PLUGIN_PATH) all; \
fi;
-.PRECIOUS: %.grpc.pb.cc
-%.grpc.pb.cc: %.proto
+get_openolt_proto:
+ if [ ! -e "voltha_protos" ]; then \
+ mkdir voltha_protos; \
+ fi;\
+ if [ ! -e "voltha_protos/openolt.proto" ]; then \
+ wget -O voltha_protos/openolt.proto https://raw.githubusercontent.com/opencord/voltha-protos/$(OPENOLT_PROTO_VER)/protos/voltha_protos/openolt.proto; \
+ fi; \
+ if [ ! -e "tech_profile.proto" ]; then \
+ wget -O voltha_protos/tech_profile.proto https://raw.githubusercontent.com/opencord/voltha-protos/$(OPENOLT_PROTO_VER)/protos/voltha_protos/tech_profile.proto; \
+ fi;
+
+.PRECIOUS: voltha_protos/%.grpc.pb.cc
+voltha_protos/%.grpc.pb.cc: voltha_protos/%.proto
$(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
-.PRECIOUS: %.pb.cc
-%.pb.cc: %.proto
- $(PROTOC) --proto_path=. -I./googleapis --cpp_out=. $<
+.PRECIOUS: voltha_protos/%.pb.cc
+voltha_protos/%.pb.cc: voltha_protos/%.proto
+ $(PROTOC) --proto_path=. -I./googleapis -I./ --cpp_out=. $<
clean:
- rm -f *.o *.pb.cc *.pb.h *.a
+ rm *.a && cd voltha_protos/ && rm -f *.o *.pb.cc *.pb.h
distclean: clean
rm -rf googleapis
diff --git a/protos/openolt.proto b/protos/openolt.proto
deleted file mode 100644
index f87d8a4..0000000
--- a/protos/openolt.proto
+++ /dev/null
@@ -1,486 +0,0 @@
-// Copyright (c) 2018 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.
-
-syntax = "proto3";
-package openolt;
-import "google/api/annotations.proto";
-import "tech_profile.proto";
-
-service Openolt {
-
- rpc DisableOlt(Empty) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/Disable"
- body: "*"
- };
- }
-
- rpc ReenableOlt(Empty) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/Reenable"
- body: "*"
- };
- }
-
- rpc ActivateOnu(Onu) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/EnableOnu"
- body: "*"
- };
- }
-
- rpc DeactivateOnu(Onu) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/DisableOnu"
- body: "*"
- };
- }
-
- rpc DeleteOnu(Onu) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/DeleteOnu"
- body: "*"
- };
- }
-
- rpc OmciMsgOut(OmciMsg) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/OmciMsgOut"
- body: "*"
- };
- }
-
- rpc OnuPacketOut(OnuPacket) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/OnuPacketOut"
- body: "*"
- };
- }
-
- rpc UplinkPacketOut(UplinkPacket) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/UplinkPacketOut"
- body: "*"
- };
- }
-
- rpc FlowAdd(Flow) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/FlowAdd"
- body: "*"
- };
- }
-
- rpc FlowRemove(Flow) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/FlowRemove"
- body: "*"
- };
- }
-
- rpc HeartbeatCheck(Empty) returns (Heartbeat) {
- option (google.api.http) = {
- post: "/v1/HeartbeatCheck"
- body: "*"
- };
- }
-
- rpc EnablePonIf(Interface) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/EnablePonIf"
- body: "*"
- };
- }
-
- rpc DisablePonIf(Interface) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/DisablePonIf"
- body: "*"
- };
- }
-
- rpc GetDeviceInfo(Empty) returns (DeviceInfo) {
- option (google.api.http) = {
- post: "/v1/GetDeviceInfo"
- body: "*"
- };
- }
-
- rpc Reboot(Empty) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/Reboot"
- body: "*"
- };
- }
-
- rpc CollectStatistics(Empty) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/CollectStatistics"
- body: "*"
- };
- }
-
- rpc CreateTrafficSchedulers(tech_profile.TrafficSchedulers) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/CreateTrafficSchedulers"
- body: "*"
- };
- }
-
- rpc RemoveTrafficSchedulers(tech_profile.TrafficSchedulers) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/RemoveTrafficSchedulers"
- body: "*"
- };
- }
-
- rpc CreateTrafficQueues(tech_profile.TrafficQueues) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/CreateTrafficQueues"
- body: "*"
- };
- }
-
- rpc RemoveTrafficQueues(tech_profile.TrafficQueues) returns (Empty) {
- option (google.api.http) = {
- post: "/v1/RemoveTrafficQueues"
- body: "*"
- };
- }
-
- rpc EnableIndication(Empty) returns (stream Indication) {}
-}
-
-message Indication {
- oneof data {
- OltIndication olt_ind = 1;
- IntfIndication intf_ind = 2;
- IntfOperIndication intf_oper_ind = 3;
- OnuDiscIndication onu_disc_ind = 4;
- OnuIndication onu_ind = 5;
- OmciIndication omci_ind = 6;
- PacketIndication pkt_ind = 7;
- PortStatistics port_stats = 8;
- FlowStatistics flow_stats = 9;
- AlarmIndication alarm_ind= 10;
- }
-}
-
-message AlarmIndication {
- oneof data {
- LosIndication los_ind = 1;
- DyingGaspIndication dying_gasp_ind = 2;
- OnuAlarmIndication onu_alarm_ind = 3;
- OnuStartupFailureIndication onu_startup_fail_ind = 4;
- OnuSignalDegradeIndication onu_signal_degrade_ind = 5;
- OnuDriftOfWindowIndication onu_drift_of_window_ind = 6;
- OnuLossOfOmciChannelIndication onu_loss_omci_ind = 7;
- OnuSignalsFailureIndication onu_signals_fail_ind = 8;
- OnuTransmissionInterferenceWarning onu_tiwi_ind = 9;
- OnuActivationFailureIndication onu_activation_fail_ind = 10;
- OnuProcessingErrorIndication onu_processing_error_ind = 11;
- }
-}
-
-message OltIndication {
- string oper_state = 1; // up, down
-}
-
-message IntfIndication {
- fixed32 intf_id = 1;
- string oper_state = 2; // up, down
-}
-
-message OnuDiscIndication {
- fixed32 intf_id = 1;
- SerialNumber serial_number = 2;
-}
-
-message OnuIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string oper_state = 3; // up, down
- string admin_state = 5; // up, down
- SerialNumber serial_number = 4;
-}
-
-message IntfOperIndication {
- string type = 1; // nni, pon
- fixed32 intf_id = 2;
- string oper_state = 3; // up, down
-}
-
-message OmciIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- bytes pkt = 3;
-}
-
-message PacketIndication {
- string intf_type = 5; // nni, pon, unknown
- fixed32 intf_id = 1;
- fixed32 gemport_id = 2;
- fixed32 flow_id = 3;
- fixed32 port_no = 6;
- fixed64 cookie = 7;
- bytes pkt = 4;
-}
-
-message Interface {
- fixed32 intf_id = 1;
-}
-
-message Heartbeat {
- fixed32 heartbeat_signature = 1;
-}
-
-message Onu {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- SerialNumber serial_number = 3;
- fixed32 pir = 4; // peak information rate assigned to onu
-}
-
-message OmciMsg {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- bytes pkt = 3;
-}
-
-message OnuPacket {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- fixed32 port_no = 4;
- fixed32 gemport_id = 5;
- bytes pkt = 3;
-}
-
-message UplinkPacket {
- fixed32 intf_id = 1;
- bytes pkt = 2;
- fixed32 flow_id = 3;
-}
-
-message DeviceInfo {
- string vendor = 1;
- string model = 2;
- string hardware_version = 3;
- string firmware_version = 4;
- string device_id = 16;
- string device_serial_number = 17;
-
- // Total number of pon intf ports on the device
- fixed32 pon_ports = 12;
-
- // If using global per-device technology profile. To be deprecated
- string technology = 5;
- fixed32 onu_id_start = 6;
- fixed32 onu_id_end = 7;
- fixed32 alloc_id_start = 8;
- fixed32 alloc_id_end = 9;
- fixed32 gemport_id_start = 10;
- fixed32 gemport_id_end = 11;
- fixed32 flow_id_start = 13;
- fixed32 flow_id_end = 14;
-
- message DeviceResourceRanges {
-
- // List of 0 or more intf_ids that use the same technology and pools.
- // If 0 intf_ids supplied, it implies ALL interfaces
- repeated fixed32 intf_ids = 1;
-
- // Technology profile for this pool
- string technology = 2;
-
- message Pool {
- enum PoolType {
- ONU_ID = 0;
- ALLOC_ID = 1;
- GEMPORT_ID = 2;
- FLOW_ID = 3;
- }
-
- enum SharingType {
- DEDICATED_PER_INTF = 0;
- SHARED_BY_ALL_INTF_ALL_TECH = 1; // Shared across all interfaces in all technologies in all ranges
- SHARED_BY_ALL_INTF_SAME_TECH = 2; // Shared across all interfaces of the same technology used in this range
- }
-
- PoolType type = 1;
- SharingType sharing = 2;
- fixed32 start = 3; // lower bound on IDs allocated from this pool
- fixed32 end = 4; // upper bound on IDs allocated from this pool
- }
- repeated Pool pools = 3;
- }
- repeated DeviceResourceRanges ranges = 15;
-}
-
-message Classifier {
- fixed32 o_tpid = 1;
- fixed32 o_vid = 2;
- fixed32 i_tpid = 3;
- fixed32 i_vid = 4;
- fixed32 o_pbits = 5;
- fixed32 i_pbits = 6;
- fixed32 eth_type = 7;
- bytes dst_mac = 8;
- bytes src_mac = 9;
- fixed32 ip_proto = 10;
- fixed32 dst_ip = 11;
- fixed32 src_ip = 12;
- fixed32 src_port = 13;
- fixed32 dst_port = 14;
- string pkt_tag_type = 15; // untagged, single_tag, double_tag
-}
-
-message ActionCmd {
- bool add_outer_tag = 1;
- bool remove_outer_tag = 2;
- bool trap_to_host = 3;
-}
-
-message Action {
- ActionCmd cmd = 1;
- fixed32 o_vid = 2;
- fixed32 o_pbits = 3;
- fixed32 o_tpid = 4;
- fixed32 i_vid = 5;
- fixed32 i_pbits = 6;
- fixed32 i_tpid = 7;
-}
-
-message Flow {
- sfixed32 access_intf_id = 1;
- sfixed32 onu_id = 2;
- sfixed32 uni_id = 11;
- fixed32 flow_id = 3;
- string flow_type = 4; // upstream, downstream, broadcast, multicast
- sfixed32 alloc_id = 10;
- sfixed32 network_intf_id = 5;
- sfixed32 gemport_id = 6;
- Classifier classifier = 7;
- Action action = 8;
- sfixed32 priority = 9;
- fixed64 cookie = 12; // must be provided for any flow with trap_to_host action. Returned in PacketIndication
- fixed32 port_no = 13; // must be provided for any flow with trap_to_host action. Returned in PacketIndication
-}
-
-message SerialNumber {
- bytes vendor_id = 1;
- bytes vendor_specific = 2;
-}
-
-message PortStatistics {
- fixed32 intf_id = 1;
- fixed64 rx_bytes = 2;
- fixed64 rx_packets = 3;
- fixed64 rx_ucast_packets = 4;
- fixed64 rx_mcast_packets = 5;
- fixed64 rx_bcast_packets = 6;
- fixed64 rx_error_packets = 7;
- fixed64 tx_bytes = 8;
- fixed64 tx_packets = 9;
- fixed64 tx_ucast_packets = 10;
- fixed64 tx_mcast_packets = 11;
- fixed64 tx_bcast_packets = 12;
- fixed64 tx_error_packets = 13;
- fixed64 rx_crc_errors = 14;
- fixed64 bip_errors = 15;
- fixed32 timestamp = 16;
-}
-
-message FlowStatistics {
- fixed32 flow_id = 1;
- fixed64 rx_bytes = 2;
- fixed64 rx_packets = 3;
- fixed64 tx_bytes = 8;
- fixed64 tx_packets = 9;
- fixed32 timestamp = 16;
-}
-
-message LosIndication {
- fixed32 intf_id = 1;
- string status = 2;
-}
-
-message DyingGaspIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
-}
-
-message OnuAlarmIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string los_status = 3;
- string lob_status = 4;
- string lopc_miss_status = 5;
- string lopc_mic_error_status = 6;
-}
-
-message OnuStartupFailureIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
-}
-
-message OnuSignalDegradeIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
- fixed32 inverse_bit_error_rate = 4;
-}
-
-message OnuDriftOfWindowIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
- fixed32 drift = 4;
- fixed32 new_eqd = 5;
-}
-
-message OnuLossOfOmciChannelIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
-}
-
-message OnuSignalsFailureIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
- fixed32 inverse_bit_error_rate = 4;
-}
-
-message OnuTransmissionInterferenceWarning {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- string status = 3;
- fixed32 drift = 4;
-}
-
-message OnuActivationFailureIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- fixed32 fail_reason = 3;
-}
-
-message OnuProcessingErrorIndication {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
-}
-
-message Empty {}
-
diff --git a/protos/tech_profile.proto b/protos/tech_profile.proto
deleted file mode 100644
index 1b98e2d..0000000
--- a/protos/tech_profile.proto
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2018 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.
-
-syntax = "proto3";
-package tech_profile;
-import "google/api/annotations.proto";
-
-enum Direction {
- UPSTREAM = 0;
- DOWNSTREAM = 1;
- BIDIRECTIONAL = 2;
-}
-
-enum SchedulingPolicy {
- WRR = 0;
- StrictPriority = 1;
- Hybrid = 2;
-}
-
-enum AdditionalBW {
- AdditionalBW_None = 0;
- AdditionalBW_NA = 1;
- AdditionalBW_BestEffort = 2;
- AdditionalBW_Auto = 3;
-}
-
-enum DiscardPolicy {
- TailDrop = 0;
- WTailDrop = 1;
- Red = 2;
- WRed = 3;
-}
-
-enum InferredAdditionBWIndication {
- InferredAdditionBWIndication_None = 0;
- InferredAdditionBWIndication_Assured = 1;
- InferredAdditionBWIndication_BestEffort = 2;
-}
-
-message SchedulerConfig {
- Direction direction = 1;
- AdditionalBW additional_bw = 2; // Valid on for “direction == Upstream”.
- fixed32 priority = 3;
- fixed32 weight = 4;
- SchedulingPolicy sched_policy = 5;
-}
-
-message TrafficShapingInfo {
- fixed32 cir = 1;
- fixed32 cbs = 2;
- fixed32 pir = 3;
- fixed32 pbs = 4;
- fixed32 gir = 5; // only if “direction == Upstream ”
- InferredAdditionBWIndication add_bw_ind = 6; // only if “direction == Upstream”
-}
-
-message TrafficScheduler {
- Direction direction = 1;
- fixed32 alloc_id = 2; // valid only if “direction == Upstream ”
- SchedulerConfig scheduler = 3;
- TrafficShapingInfo traffic_shaping_info = 4;
-}
-
-message TrafficSchedulers {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- fixed32 uni_id = 4;
- fixed32 port_no = 5;
- repeated TrafficScheduler traffic_scheds = 3;
-}
-
-message TailDropDiscardConfig {
- fixed32 queue_size = 1;
-}
-
-message RedDiscardConfig {
- fixed32 min_threshold = 1;
- fixed32 max_threshold = 2;
- fixed32 max_probability = 3;
-}
-
-message WRedDiscardConfig {
- RedDiscardConfig green = 1;
- RedDiscardConfig yellow = 2;
- RedDiscardConfig red = 3;
-}
-
-message DiscardConfig {
- DiscardPolicy discard_policy = 1;
- oneof discard_config {
- TailDropDiscardConfig tail_drop_discard_config = 2;
- RedDiscardConfig red_discard_config = 3;
- WRedDiscardConfig wred_discard_config = 4;
- }
-}
-
-message TrafficQueue {
- Direction direction = 1;
- fixed32 gemport_id = 2;
- string pbit_map = 3;
- bool aes_encryption = 4;
- SchedulingPolicy sched_policy = 5;
- fixed32 priority = 6;
- fixed32 weight = 7;
- DiscardPolicy discard_policy = 8;
- DiscardConfig discard_config = 9;
-}
-
-message TrafficQueues {
- fixed32 intf_id = 1;
- fixed32 onu_id = 2;
- fixed32 uni_id = 4;
- fixed32 port_no = 5;
- repeated TrafficQueue traffic_queues = 6;
-}