VOL-3419: Replicate voltha flows in openolt agent
- Use the flow_id, symmetric_flow_id, replication_flag and pbit_to_gemport_map
  coming in Flow proto messge to replicate the flow as needed
- Use the CreateQueues and RemoveQueues messages to setup and remove gem_ports
- Use latest gRPC version 1.31.1 which allows fine tuning of gRPC threadpools
  which allows for greating performance.
- Performance numbers when tested with openolt-scale-tester has been better with
  using latest gRPC and threadpool tuning when compared to earlier. It is to be
  noted that the performance is better even with openolt-agent replicating the flow
  now.
- Scale tests with 512 subscribers have been successfull with BAL3.4.7.5 version
- Use openolt proto version 4.0.0
- Use openolt-test (for unit test) image version 2.0.1 (which bundles latest gRPC version 1.31.1)
- These changes are NOT backward compatible and openolt-agent will have a major
  version bump to 3.0.0

Change-Id: I715c804bdf342e60d08cab6c59e1c21b8c5ac1f4
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
index 845ecf6..f9fb329 100644
--- a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postinst
@@ -31,8 +31,7 @@
 update-rc.d dev_mgmt_daemon defaults
 update-rc.d openolt defaults
 mv /tmp/openolt /broadcom
-mv /tmp/libgrpc++.so.1 /usr/local/lib
-mv /tmp/libgrpc.so.6 /usr/local/lib
+mv /tmp/libz.so.1 /usr/local/lib
 mv /tmp/libstdc++.so.6 /usr/local/lib
 mv /tmp/libbal_host_api.so /usr/local/lib
 /opt/bcm68620/svk_init.sh
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
index f799e09..96c91af 100644
--- a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.postrm
@@ -20,7 +20,6 @@
 rm -rf /broadcom
 sed -i '\/opt\/bcm68620\/svk_init.sh/d' /etc/rc.local
 rm -rf /run/bcm68620
-rm -rf /usr/local/lib/libgrpc++.so.1
-rm -rf /usr/local/lib/libgrpc.so.6
+rm -rf /usr/local/lib/libz.so.1
 rm -rf /usr/local/lib/libbal_host_api.so
 rm -rf /usr/local/lib/libstdc++.so.6
diff --git a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
index 333bcd5..c2e0343 100644
--- a/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
+++ b/agent/device/asfvolt16/mkdebian/debian/asfvolt16.preinst
@@ -54,8 +54,7 @@
 
 rm -rf  /broadcom
 
-rm -rf /usr/local/lib/libgrpc++.so.1
-rm -rf /usr/local/lib/libgrpc.so.6
+rm -rf /usr/local/lib/libz.so.1
 rm -rf /usr/local/lib/libbal_host_api.so
 rm -rf /usr/local/lib/libstdc++.so.6
 
diff --git a/agent/device/asfvolt16/mkdebian/debian/rules b/agent/device/asfvolt16/mkdebian/debian/rules
index 199bdb4..9ede076 100755
--- a/agent/device/asfvolt16/mkdebian/debian/rules
+++ b/agent/device/asfvolt16/mkdebian/debian/rules
@@ -27,8 +27,7 @@
 override_dh_auto_install: 
 	mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/release_asfvolt16_V3.4.7.5.202008030101.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/libz.so.1 $(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
diff --git a/agent/device/asfvolt16/vendor.h b/agent/device/asfvolt16/vendor.h
index 2c2c733..ffbaec4 100644
--- a/agent/device/asfvolt16/vendor.h
+++ b/agent/device/asfvolt16/vendor.h
@@ -22,4 +22,22 @@
 #define MAX_SUPPORTED_PON 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 32
+
+#define ALLOC_ID_START 1024
+#define ALLOC_ID_END 16383
+
+#define GEM_PORT_ID_START 1024
+#define GEM_PORT_ID_END 65535
+
+#define FLOW_ID_START 1
+#define FLOW_ID_END 65535
+#define MAX_FLOW_ID 65535
+#define INVALID_FLOW_ID 0
+
 #endif
diff --git a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst
index 558251a..b4309df 100644
--- a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst
+++ b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postinst
@@ -31,8 +31,7 @@
 update-rc.d dev_mgmt_daemon defaults
 update-rc.d openolt defaults
 mv /tmp/openolt /broadcom
-mv /tmp/libgrpc++.so.1 /usr/local/lib
-mv /tmp/libgrpc.so.6 /usr/local/lib
+mv /tmp/libz.so.1 /usr/local/lib
 mv /tmp/libstdc++.so.6 /usr/local/lib
 mv /tmp/libbal_host_api.so /usr/local/lib
 /opt/bcm68620/svk_init.sh
diff --git a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm
index f799e09..96c91af 100644
--- a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm
+++ b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.postrm
@@ -20,7 +20,6 @@
 rm -rf /broadcom
 sed -i '\/opt\/bcm68620\/svk_init.sh/d' /etc/rc.local
 rm -rf /run/bcm68620
-rm -rf /usr/local/lib/libgrpc++.so.1
-rm -rf /usr/local/lib/libgrpc.so.6
+rm -rf /usr/local/lib/libz.so.1
 rm -rf /usr/local/lib/libbal_host_api.so
 rm -rf /usr/local/lib/libstdc++.so.6
diff --git a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst
index 333bcd5..c2e0343 100644
--- a/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst
+++ b/agent/device/asgvolt64/mkdebian/debian/asgvolt64.preinst
@@ -54,8 +54,7 @@
 
 rm -rf  /broadcom
 
-rm -rf /usr/local/lib/libgrpc++.so.1
-rm -rf /usr/local/lib/libgrpc.so.6
+rm -rf /usr/local/lib/libz.so.1
 rm -rf /usr/local/lib/libbal_host_api.so
 rm -rf /usr/local/lib/libstdc++.so.6
 
diff --git a/agent/device/asgvolt64/mkdebian/debian/rules b/agent/device/asgvolt64/mkdebian/debian/rules
index ad85e4b..2a7d1d8 100755
--- a/agent/device/asgvolt64/mkdebian/debian/rules
+++ b/agent/device/asgvolt64/mkdebian/debian/rules
@@ -27,8 +27,7 @@
 override_dh_auto_install: 
 	mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/release_asgvolt64_V3.4.7.5.202008030101.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/libz.so.1 $(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
diff --git a/agent/device/asgvolt64/vendor.h b/agent/device/asgvolt64/vendor.h
index 3ea790c..44dc9a2 100644
--- a/agent/device/asgvolt64/vendor.h
+++ b/agent/device/asgvolt64/vendor.h
@@ -22,4 +22,22 @@
 #define MAX_SUPPORTED_PON 64
 #define ONU_BIT_TRANSMISSION_DELAY 0.8038585/1000 /* unit: ns to us */
 #define MINIMUM_ONU_RESPONSE_RANGING_TIME 198075 /* 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
+
+#define ALLOC_ID_START 256
+#define ALLOC_ID_END 767
+
+#define GEM_PORT_ID_START 256
+#define GEM_PORT_ID_END 4095
+
+#define FLOW_ID_START 1
+#define FLOW_ID_END 65535
+#define MAX_FLOW_ID FLOW_ID_END
+#define INVALID_FLOW_ID 0
+
 #endif
diff --git a/agent/device/generic/vendor.h b/agent/device/generic/vendor.h
index 25cc813..4a94df1 100644
--- a/agent/device/generic/vendor.h
+++ b/agent/device/generic/vendor.h
@@ -18,4 +18,22 @@
 #define __VENDOR_H__
 #define VENDOR_ID "generic"
 #define MODEL_ID  "generic"
+
+// DeviceInfo definitions
+
+#define ONU_ID_START 1
+#define ONU_ID_END 32
+#define MAX_ONUS_PER_PON 32
+
+#define ALLOC_ID_START 1024
+#define ALLOC_ID_END 16383
+
+#define GEM_PORT_ID_START 1024
+#define GEM_PORT_ID_END 65535
+
+#define FLOW_ID_START 1
+#define FLOW_ID_END 65535
+#define MAX_FLOW_ID 65535
+#define INVALID_FLOW_ID 0
+
 #endif