VOL-2596 : Measure optical distance between OLT and ONU

Change-Id: Ib13d85fe47a800348f82a5d76a90d97d98b20e1e
diff --git a/agent/common/core.h b/agent/common/core.h
index c68fdf3..d277904 100644
--- a/agent/common/core.h
+++ b/agent/common/core.h
@@ -192,6 +192,7 @@
        (type == BCMOLT_INTERFACE_TYPE_NNI) ? "NNI" : \
        (type == BCMOLT_INTERFACE_TYPE_HOST) ? "HOST" : "unknown"
 
+#define LOGICAL_DISTANCE(MLD,EQD,TD) (MLD-(EQD*TD)*102) /* Round-trip time of 102 meters is 1us */
 extern State state;
 
 //***************************************//
@@ -232,6 +233,8 @@
 Status DeleteGroup_(uint32_t group_id);
 Status OnuItuPonAlarmSet_(const openolt::OnuItuPonAlarm* request);
 uint32_t GetPortNum_(uint32_t flow_id);
+Status GetLogicalOnuDistanceZero_(uint32_t intf_id, openolt::OnuLogicalDistance* response);
+Status GetLogicalOnuDistance_(uint32_t intf_id, uint32_t onu_id, openolt::OnuLogicalDistance* response);
 int get_status_bcm_cli_quit(void);
 uint16_t get_dev_id(void);
 Status pushOltOperInd(uint32_t intf_id, const char *type, const char *state);
diff --git a/agent/common/server.cc b/agent/common/server.cc
index baeb590..5a30f37 100644
--- a/agent/common/server.cc
+++ b/agent/common/server.cc
@@ -322,6 +322,25 @@
             openolt::Empty* response) override {
         return OnuItuPonAlarmSet_(request);
     };
+
+    Status GetLogicalOnuDistanceZero(
+            ServerContext* context,
+            const openolt::Onu* request,
+            openolt::OnuLogicalDistance* response) override {
+        return GetLogicalOnuDistanceZero_(
+            request->intf_id(),
+            response);
+    };
+
+    Status GetLogicalOnuDistance(
+            ServerContext* context,
+            const openolt::Onu* request,
+            openolt::OnuLogicalDistance* response) override {
+        return GetLogicalOnuDistance_(
+            request->intf_id(),
+            request->onu_id(),
+            response);
+    };
 };
 
 void RunServer(int argc, char** argv) {