VOL-2014: Rebase bal30-dev branch with master and re-verify sanity with SEBA2.0 and VOLTHA2.x before merge to master
          Squashed all commits from bal30-dev branch to master branch as a single commit.
          Bumped version to 2.0.0-dev .
          Update README.md with the required ONL version for BAL3.1 .

VOL-2130: Wrong queue id assigned for downstream queue on tm_sched
          for the subscriber when using single gem port.
          Use queue_id as 0 when using single gem port.

          Issues need to be taken care:
          VOL-1580: Support reporting ONU Registration ID as part of ONU Activation Indication
          - commented the code developed for VOL-1580 to fetch ONU registration ID as it uses BAL2.6 specific API's.
          - Need to check how the same can be achieved using BAL3.x API's to fetch ONU registration ID

Set .gitreview defaultbranch to bal30-dev
Rebase change - Removed .gitreview defaultbranch so that by default it will point to master

Change-Id: Ib57e52e98cf09f4fa3dbaa9156a4375b7dc6ee43

Rebase: [VOL-1635] [BAL3.0 Bridade] OLT Activation [VOL-1636] [BAL3.0 Bridade] ONU Discovery,
        This OpenOLT agent supports the BAL V3.0.3.3 SDK. OLT/ONU activation from voltha-1.7 is successful

Change-Id: I860b31317172139cd4c4244a93e79e0c3ce4fdf8

Rebase: [VOL-1685][BAL3.0 Bridade] generate OpenOLT debian package file

Change-Id: Ib0332d948602bf7892b6aae91a4147356237f7e2

Rebase: [VOL-1685][BAL3.0 Brigade] generate OpenOLT debian package file
missing copy shell files (dev_mgmt_daemon and openolt).

Change-Id: Id29dc24be4d1d5fc12a26884e5b5a69de91fbd69

Rebase: [VOL-1685][BAL3.0 Brigade] generate OpenOLT debian package file

Change-Id: Ic5453616c0dbdbc1fb1eb241feba1cbfca5e8e85

Rebase: [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

Rebase: [VOL-1787] : This commit sets up a unit-test framework for openolt
                     agent based on gtest, gmock and c-mock utilities.
                     A sample unit-test case to test EnableOlt success case is also
                     added. More test cases will be added in future commit.

Change-Id: If020be489a04d97df5fcbc15e9207deeee2fcfac

Rebase: [VOL-2040]: Patch the macro required by core.cc into bcmos_system.h file

Change-Id: Ic841785b2ce451b1acaf007074b8c458687bc753

Rebase: [VOL-2043] : OLT Enable Test Case

        - Added more test cases for OLT Enable. Now covers all scenarios.
        - Fixed typos in unit test README.md

Change-Id: Ib931d89cedee78fe40ca67761a028365a047ebc3

Rebase: 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/agent/test/Makefile.in b/agent/test/Makefile.in
new file mode 100644
index 0000000..2122266
--- /dev/null
+++ b/agent/test/Makefile.in
@@ -0,0 +1,169 @@
+# Copyright (C) 2018 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/>.
+
+########################################################################
+##
+##
+##        Config
+##
+##
+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
+GRPC_DST = /tmp/grpc
+GRPC_VER = v1.10.x
+
+USER := $(shell echo $(USER))
+#
+########################################################################
+##
+##
+##        Install prerequisites
+##
+##
+
+CXX = g++-4.9
+CXXFLAGS += -g -O2
+CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++)
+CPPFLAGS += `pkg-config --cflags protobuf grpc`
+CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix
+CXXFLAGS += -DTEST_MODE -DENABLE_LOG
+LDFLAGS +=
+LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr
+CXXFLAGSDEVICE = -I../device -I../device/$(OPENOLTDEVICE) -I../device/generic
+
+export CXX CXXFLAGS OPENOLT_PROTO_VER
+
+BAL_API_DIR=bal-api-3.1.0
+BALLIBNAME=bcm_host_api_stubs
+BALLIBDIR=$(BAL_API_DIR)/stubs
+BAL_INC = -I$(BAL_API_DIR)/include \
+          -I$(BAL_API_DIR)/include/object_model
+CXXFLAGS += $(BAL_INC)
+
+
+
+prereq:
+	sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io
+	sudo apt-get install -y build-essential autoconf libssl-dev gawk debhelper dh-systemd init-system-helpers curl cmake ccache g++-4.9
+
+	# Install GRPC, libprotobuf and protoc
+	rm -rf $(GRPC_DST)
+	git clone -b $(GRPC_VER) $(GRPC_ADDR) $(GRPC_DST)
+	cd $(GRPC_DST) && git submodule update --init
+	cd $(GRPC_DST)/third_party/protobuf && ./autogen.sh && ./configure
+	make -C $(GRPC_DST)/third_party/protobuf
+	sudo make -C $(GRPC_DST)/third_party/protobuf install
+	sudo ldconfig
+	make -C $(GRPC_DST)
+	sudo make -C $(GRPC_DST) install
+	sudo ldconfig
+
+prereq-mock-lib: gtest cmock
+
+gtest:
+	# Install gtest and gmock
+	rm -rf /tmp/googletest && cd /tmp && git clone https://github.com/google/googletest.git
+	cd /tmp/googletest && git checkout release-1.8.0
+	cd /tmp/googletest && cmake CMakeLists.txt
+	make -C /tmp/googletest
+	sudo make -C /tmp/googletest install
+
+cmock:
+	# Install c-mock
+	rm -rf /tmp/C-Mock && cd /tmp && git clone https://github.com/hjagodzinski/C-Mock.git
+	cd /tmp/C-Mock && git checkout 0207b3026f04bbdf0bd9d9f8dfd00945a4318251
+	make -C /tmp/C-Mock
+	sudo make -C /tmp/C-Mock install
+
+########################################################################
+##
+##
+##        build
+##
+##
+
+.DEFAULT_GOAL := all
+
+.PHONY = bcm_host_api_stubs libopenoltapi.a libopenolt.a build clean
+
+all: bcm_host_api_stubs libopenoltapi.a libopenolt.a build
+
+# test
+TEST_OPENOLT_LIB_DIR=./lib
+TEST_BIN=test_openolt
+# The below way of getting source files is not working
+#TEST_SRCS = $($(filter-out src/bal_stub.cc, $(wildcard src/*.cc)))
+TEST_SRCS = src/main_test.cc src/bal_mocker.cc src/test_enable_olt.cc
+TEST_OBJS = $(TEST_SRCS:.cc=.o)
+build: $(TEST_OBJS)
+	$(CXX) $(shell cmock-config --libs) -L$(TEST_OPENOLT_LIB_DIR) -L/usr/lib/ -I/usr/include -I./inc -o $(TEST_BIN) $(TEST_OBJS) -lgmock -lgtest -lopenolt -lopenoltapi  $(LDFLAGS)
+src/%.o: src/%.cc
+	$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I./inc -I../common -I/usr/include -c $< -o $@
+
+
+# bcm_host_api_stubs
+BAL_API_DIR=bal-api-3.1.0
+bcm_host_api_stubs: 
+	# TODO: There is temporary hack below to introduce the definition of bcmos_mutex.
+	# This should ideally come as part of bal-api-3.1.0
+	if [ -d $(BAL_API_DIR) ]; then \
+		echo "$(BAL_API_DIR) exists"; \
+	else \
+		git clone https://github.com/balapi/bal-api-3.1.0.git ;\
+        sed -i "\$$i #define BCMOLT_TM_QUEUE_KEY_TM_Q_SET_ID_DEFAULT 0" ./bal-api-3.1.0/include/bcmos_system.h; \
+        sed -i "\$$i struct bcmos_mutex \{ pthread_mutex_t m; };" ./bal-api-3.1.0/include/bcmos_system.h; \
+	fi
+
+# openoltapi
+OPENOLT_PROTOS_DIR = ../../protos
+OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a
+CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens
+libopenoltapi.a:
+	make -C $(OPENOLT_PROTOS_DIR) all
+	mkdir -p lib
+	cp $(OPENOLT_PROTOS_DIR)/$@ lib/
+libproto-clean:
+	make -C $(OPENOLT_PROTOS_DIR) clean
+
+# openolt
+OPENOLT_SRCS = $(wildcard ../src/*.cc) ../common/server.cc $(wildcard ../device/$(OPENOLTDEVICE)/*.cc) src/bal_stub.cc
+OPENOLT_OBJS = $(OPENOLT_SRCS:.cc=.o)
+libopenolt.a: $(OPENOLT_OBJS)
+	mkdir -p lib
+	ar cr lib/$@ $^
+	ranlib lib/$@
+../common/%.o: ../common/%.cc
+	$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I../common -I./inc -I./device/$(OPENOLTDEVICE) -c $< -o $@
+../src/%.o: ../src/%.cc
+	$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I../common -I./inc -I./device/$(OPENOLTDEVICE) -c $< -o $@
+src/%.o: src/%.cc
+	$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I../common -I./inc -I./device/$(OPENOLTDEVICE) -c $< -o $@
+../device/$(OPENOLTDEVICE)/%.o: ../device/$(OPENOLTDEVICE)/%.cc
+	$(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I../common -I./inc -I./device/$(OPENOLTDEVICE) -c $< -o $@
+
+test: all
+	./test_openolt --gtest_output="xml:./test_openolt_report.xml"
+
+clean:
+	rm -f src/*.o lib/*.a ../src/*.o ../common/*.o ./test_openolt  ./test_openolt_report.xml