VOL-306 :driver changes to fetch PON statistics
Change-Id: I3130e4ee035b9ff7a520b6506a0424da83f0a60d
diff --git a/device_simulator/voltha_bal_driver.c b/device_simulator/voltha_bal_driver.c
index ad530a3..796c755 100755
--- a/device_simulator/voltha_bal_driver.c
+++ b/device_simulator/voltha_bal_driver.c
@@ -181,16 +181,21 @@
memset(&stat_data, 0, sizeof(BalInterfaceStatData));
bal_interface_stat_data__init(&stat_data);
+ BalInterfaceKey stat_key;
+ memset(&stat_key, 0, sizeof(BalInterfaceKey));
+ bal_interface_key__init(&stat_key);
+
#ifndef BAL_STUB
/* Interface Type, Interface ID
stat_data - Statistics Data */
- asfvolt16_bal_stats_get(read_stats->intf_type, read_stats->intf_id, &stat_data);
+ asfvolt16_bal_stats_get(read_stats->intf_type, read_stats->intf_id, &stat_data, &stat_key);
#else
stub_bal_stats_get(&stat_data);
ASFVOLT_LOG(ASFVOLT_DEBUG, "Bal Server - Get Stats In BalStubs : Got all the statistics\n");
#endif
get_stats.data = &stat_data;
+ get_stats.key = &stat_key;
ret_val = context->gcc_stream->write(context, &get_stats, 0);
is_grpc_write_pending(ret_val);
diff --git a/src/asfvolt16_driver.h b/src/asfvolt16_driver.h
index 6f5a884..6871e2b 100755
--- a/src/asfvolt16_driver.h
+++ b/src/asfvolt16_driver.h
@@ -71,7 +71,8 @@
extern uint32_t asfvolt16_bal_cfg_clear(BalKey *key);
extern uint32_t asfvolt16_bal_cfg_get(BalKey *key, BalCfg *cfg);
extern void asfvolt16_send_omci_msg(uint16_t olt_no, uint32_t onu_nu, char* packet_to_send);
-extern uint32_t asfvolt16_bal_stats_get(BalIntfType intf_type, uint32_t intf_id, BalInterfaceStatData *statData);
+extern uint32_t asfvolt16_bal_stats_get(BalIntfType intf_type, uint32_t intf_id, BalInterfaceStatData *statData,
+ BalInterfaceKey *statKey);
grpc_c_client_t *client;
#endif /* DRIVERAPP_ASFVOLT16_DRIVER */
diff --git a/src/bal_stats_hdlr.c b/src/bal_stats_hdlr.c
index 0c0de39..6c20e44 100755
--- a/src/bal_stats_hdlr.c
+++ b/src/bal_stats_hdlr.c
@@ -24,7 +24,8 @@
* interface type(NNI/PON/EPON 1G/EPON 10G) *
* port number *
********************************************************************/
-uint32_t asfvolt16_bal_stats_get(BalIntfType intf_type, uint32_t intf_id, BalInterfaceStatData *statData)
+uint32_t asfvolt16_bal_stats_get(BalIntfType intf_type, uint32_t intf_id, BalInterfaceStatData *statData,
+ BalInterfaceKey *statKey)
{
bcmbal_interface_stat interface_stats;
@@ -56,6 +57,13 @@
if(err == BCM_ERR_OK)
{
+ /*interface key*/
+ statKey->has_intf_id = BAL_STAT_PRES;
+ statKey->intf_id = interface_stats.key.intf_id;
+ statKey->has_intf_type = BAL_STAT_PRES;
+ statKey->intf_type = interface_stats.key.intf_type;
+
+ /*interface stat data*/
statData->has_rx_bytes = BAL_STAT_PRES;
statData->rx_bytes = interface_stats.data.rx_bytes;
statData->has_rx_packets = BAL_STAT_PRES;