VOL-1194 Get device info (vendor, versions, technology, resource manager parameters)

Change-Id: Ie6b4b8c298696321e34444ac3d3b4a965c449bba
diff --git a/common/core.h b/common/core.h
index 470bce0..1bf84d2 100644
--- a/common/core.h
+++ b/common/core.h
@@ -53,6 +53,7 @@
 Status FlowRemove_(uint32_t flow_id, const std::string flow_type);
 Status Disable_();
 Status Reenable_();
+Status GetDeviceInfo_(openolt::DeviceInfo* device_info);
 
 void stats_collection();
 #endif
diff --git a/common/server.cc b/common/server.cc
index 65a9d96..433ecd5 100644
--- a/common/server.cc
+++ b/common/server.cc
@@ -246,6 +246,18 @@
 
     }
 
+    Status GetDeviceInfo(
+            ServerContext* context,
+            const openolt::Empty* request,
+            openolt::DeviceInfo* response) override {
+
+        GetDeviceInfo_(response);
+
+        return Status::OK;
+
+    }
+
+
 
 };
 
diff --git a/protos/openolt.proto b/protos/openolt.proto
index 2ee2346..4178f38 100644
--- a/protos/openolt.proto
+++ b/protos/openolt.proto
@@ -115,7 +115,14 @@
             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"
@@ -232,6 +239,21 @@
     bytes pkt = 2;
 }
 
+message DeviceInfo {
+    string vendor = 1;
+    string model = 2;
+    string hardware_version = 3;
+    string firmware_version = 4;
+    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 pon_ports = 12;
+}
+
 message Classifier {
     fixed32 o_tpid = 1;
     fixed32 o_vid = 2;
diff --git a/sim/core.cc b/sim/core.cc
index 763871d..7781ef9 100644
--- a/sim/core.cc
+++ b/sim/core.cc
@@ -128,3 +128,7 @@
 
 void stats_collection() {
 }
+
+Status GetDeviceInfo_(openolt::DeviceInfo* deviceInfo) {
+    return Status::OK;
+}
diff --git a/src/core.cc b/src/core.cc
index d756297..7f4e6da 100644
--- a/src/core.cc
+++ b/src/core.cc
@@ -38,6 +38,10 @@
 #include <bal_api_end.h>
 }
 
+#define NUM_OF_PON_PORTS 16
+const std::string technology = "xgspon";
+const std::string firmware_version = "BAL.2.6.0.1__Openolt.2018.09.05";
+
 State state;
 
 static Status SchedAdd_(int intf_id, int onu_id, int agg_port_id, int sched_id, int pir);
@@ -51,6 +55,25 @@
     return 1023 + intf_id * 112 + onu_id;
 }
 
+
+Status GetDeviceInfo_(openolt::DeviceInfo* device_info) {
+
+    device_info->set_vendor("EdgeCore");
+    device_info->set_model("asfvolt16");
+    device_info->set_hardware_version("");
+    device_info->set_firmware_version(firmware_version);
+    device_info->set_technology(technology);
+    device_info->set_onu_id_start(1);
+    device_info->set_onu_id_end(XGPON_NUM_OF_ONUS - 1);
+    device_info->set_alloc_id_start(1024);
+    device_info->set_alloc_id_end(XGPON_NUM_OF_ALLOC_IDS * NUM_OF_PON_PORTS - 1);
+    device_info->set_gemport_id_start(RSC_MGR_XGPON_MIN_BASE_SERVICE_PORT_ID);
+    device_info->set_gemport_id_end(XGPON_NUM_OF_GEM_PORT_IDS_PER_PON * NUM_OF_PON_PORTS - 1);
+    device_info->set_pon_ports(NUM_OF_PON_PORTS);
+
+    return Status::OK;
+}
+
 Status Enable_(int argc, char *argv[]) {
     bcmbal_access_terminal_cfg acc_term_obj;
     bcmbal_access_terminal_key key = { };