[VOL-5527] Enhance the performance  metrics by adding the additional needed attributes

Change-Id: I78e3a674b8527bb329617b110e84efc2c12d1f14
Signed-off-by: pnalmas <praneeth.nalmas@radisys.com>
diff --git a/protos/voltha_protos/common.proto b/protos/voltha_protos/common.proto
index 936cd30..2f84c23 100755
--- a/protos/voltha_protos/common.proto
+++ b/protos/voltha_protos/common.proto
@@ -124,11 +124,16 @@
 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;
+    // Deprecated: OLT being a Layer 2 device, use rx_frames (field 17) instead
+    fixed64 rx_packets = 3 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use rx_ucast_frames (field 63) instead
+    fixed64 rx_ucast_packets = 4 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use rx_mcast_frames (field 64) instead
+    fixed64 rx_mcast_packets = 5 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use rx_bcast_frames (field 65) instead
+    fixed64 rx_bcast_packets = 6 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use rx_error_frames (field 66) instead
+    fixed64 rx_error_packets = 7 [deprecated = true];
     fixed64 rx_frames = 17;
     fixed64 rx_frames_64 = 18;
     fixed64 rx_frames_65_127 = 19;
@@ -157,11 +162,16 @@
     fixed64 rxFcsErrorPackets = 62;
 
     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;
+    // Deprecated: OLT being a Layer 2 device, use tx_frames (field 28) instead
+    fixed64 tx_packets = 9 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use tx_ucast_frames (field 68) instead
+    fixed64 tx_ucast_packets = 10 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use tx_mcast_frames (field 69) instead
+    fixed64 tx_mcast_packets = 11 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use tx_bcast_frames (field 70) instead
+    fixed64 tx_bcast_packets = 12 [deprecated = true];
+    // Deprecated: OLT being a Layer 2 device, use tx_error_frames (field 71) instead
+    fixed64 tx_error_packets = 13 [deprecated = true];
     fixed64 tx_frames = 28;
     fixed64 tx_frames_64 = 29;
     fixed64 tx_frames_65_127 = 30;
@@ -186,4 +196,16 @@
     fixed64 bip_errors = 15;
     fixed64 bip_units = 61;
     fixed32 timestamp = 16;
+
+    fixed64 rx_ucast_frames = 63;
+    fixed64 rx_mcast_frames = 64;
+    fixed64 rx_bcast_frames = 65;
+    fixed64 rx_error_frames = 66;
+    fixed64 rx_right_frames = 67;
+    fixed64 tx_ucast_frames = 68;
+    fixed64 tx_mcast_frames = 69;
+    fixed64 tx_bcast_frames = 70;
+    fixed64 tx_error_frames = 71;
+    fixed64 rx_discarded_frames = 72;
+
 }
diff --git a/protos/voltha_protos/events.proto b/protos/voltha_protos/events.proto
index 9376805..6f180c5 100755
--- a/protos/voltha_protos/events.proto
+++ b/protos/voltha_protos/events.proto
@@ -107,6 +107,16 @@
 }
 
 /*
+ * Struct to group metadata for a metric (or group of metrics) with the key-value
+ * pairs of collected metrics using 64-bit unsigned integers.
+ * This is used for counters that can exceed the precision of float (e.g., FEC, GEM counters).
+ */
+message MetricInformation64 {
+    MetricMetaData metadata = 1;
+    map<string, uint64> metrics = 2;
+}
+
+/*
  * Legacy KPI Event structured.  In mid-August, the KPI event format was updated
  *                               to a more easily parsable format. See VOL-1140
  *                               for more information.
@@ -135,6 +145,21 @@
 }
 
 /*
+ * KpiEvent3 with support for 64-bit unsigned integer counters.
+ * Use this for metrics that require full 64-bit precision (e.g., FEC counters, GEM counters).
+ */
+message KpiEvent3 {
+    // Type of KPI Event
+    KpiEventType.Types type = 1;
+
+    // Fields used when for slice:
+    double ts = 2; // UTC time-stamp of data in slice mode (seconds since epoch)
+    // of the time this entire KpiEvent was published to the kafka bus
+
+    repeated MetricInformation64 slice_data = 3;
+}
+
+/*
  * Describes the events specific to device
  */
 message DeviceEvent {
@@ -220,6 +245,7 @@
         KPI_EVENT2 = 2;
         DEVICE_EVENT = 3;
         RPC_EVENT = 4;
+        KPI_EVENT3 = 5;
     }
 }
 
@@ -284,7 +310,8 @@
         // Refers to an RPC Event
         RPCEvent rpc_event = 6;
 
-        // Add other event types here.
+        // Refers to KpiEvent3 (64-bit counter support)
+        KpiEvent3 kpi_event3 = 7;
 
     }
 }
diff --git a/protos/voltha_protos/extensions.proto b/protos/voltha_protos/extensions.proto
index 9ac58cf..36cb000 100755
--- a/protos/voltha_protos/extensions.proto
+++ b/protos/voltha_protos/extensions.proto
@@ -43,16 +43,16 @@
 }
 
 message ReturnValues {
-    uint32  Set = 1;       // Specifies what values are
+    uint32  Set = 1; // Specifies what values are
                            // set/valid in return
 
     uint32 Unsupported = 2; // Specifies requested values not
                             // supported by the device
 
-    uint32 Error  = 3;      // Specifies requested values not
+    uint32 Error  = 3; // Specifies requested values not
                             // fetched because of error
 
-    uint32 Distance = 4;    // Value of distance Set includes
+    uint32 Distance = 4; // Value of distance Set includes
                             // DISTANCE
 
 }
@@ -104,7 +104,7 @@
         Port_ETHERNET_NNI = 1;
         Port_PON_OLT = 2;
     }
-    uint32 portNo = 1;  // Device-unique port number
+    uint32 portNo = 1; // Device-unique port number
     PortType portType = 2;
 }
 
@@ -172,9 +172,18 @@
     uint32 gemId = 1;
     uint32 transmittedGEMFrames= 2;
     uint32 receivedGEMFrames = 3;
-    uint32 receivedPayloadBytes= 4;
-    uint32 transmittedPayloadBytes = 5;
+    
+    // Deprecated: uint32 cannot handle large byte counters and will overflow after ~4GB.
+    // Use received_payload_bytes_64 instead for full 64-bit precision.
+    uint32 receivedPayloadBytes= 4 [deprecated = true];
+    
+    // Deprecated: uint32 cannot handle large byte counters and will overflow after ~4GB.
+    // Use transmitted_payload_bytes_64 instead for full 64-bit precision.
+    uint32 transmittedPayloadBytes = 5 [deprecated = true];
+    
     uint32 encryptionKeyErrors = 6;
+    fixed64 received_payload_bytes_64 = 7;
+    fixed64 transmitted_payload_bytes_64 = 8; 
 }
 
 message OnuAllocHistoryData {
@@ -196,11 +205,28 @@
 }
 
 message GetOnuFecHistoryResponse {
-    uint32 correctedBytes = 1;
-    uint32 correctedCodeWords = 2;
+    // Deprecated: uint32 cannot handle large counter values and will overflow.
+    // Use fec_corrected_bytes_64 instead for full 64-bit precision.
+    uint32 correctedBytes = 1 [deprecated = true];
+    
+    // Deprecated: uint32 cannot handle large counter values and will overflow.
+    // Use fec_corrected_code_words_64 instead for full 64-bit precision.
+    uint32 correctedCodeWords = 2 [deprecated = true];
+    
     uint32 fecSeconds = 3;
-    uint32 totalCodeWords = 4;
-    uint32 uncorrectableCodeWords = 5;
+    
+    // Deprecated: uint32 cannot handle large counter values and will overflow.
+    // Use total_code_words_64 instead for full 64-bit precision.
+    uint32 totalCodeWords = 4 [deprecated = true];
+    
+    // Deprecated: uint32 cannot handle large counter values and will overflow.
+    // Use uncorrectable_code_words_64 instead for full 64-bit precision.
+    uint32 uncorrectableCodeWords = 5 [deprecated = true];
+    
+    fixed64 fec_corrected_bytes_64 = 6;
+    fixed64 fec_corrected_code_words_64 = 7;
+    fixed64 total_code_words_64 = 8;
+    fixed64 uncorrectable_code_words_64 = 9;
 }
 
 message GetOnuCountersRequest {
@@ -366,6 +392,9 @@
         // reported timestamp in seconds since epoch
         fixed32 timestamp = 27;
     }
+    oneof is_hec_errors {
+        fixed64 hec_errors = 28;
+    }
 }
 
 message OmciEthernetFrameExtendedPm {