VOL-4077: Improve storage usage on etcd
- the onu adapter will now receive the tp instance on the
  inter-container kafka message and need not reach the etcd store
  to fetch it.
- on reconcile, the onu adapter need to go to the kv store to
  fetch the tp instance, but request the tp instance via a new
  API towards openolt adapter which in-turn will fetch from the
  cache.
- re-org the code in onu-metrics-manager to restore pm-data
  on reconcile to avoid panics by accessing uninitialzed data
  if ani-fsm were to try adding gem port for monitoring
  before pm-data is initialized properly.

Change-Id: I82a6de2772155f6e08390b671fe26d692dd02c99
diff --git a/internal/pkg/onuadaptercore/onu_metrics_manager.go b/internal/pkg/onuadaptercore/onu_metrics_manager.go
index c9685de..3276882 100644
--- a/internal/pkg/onuadaptercore/onu_metrics_manager.go
+++ b/internal/pkg/onuadaptercore/onu_metrics_manager.go
@@ -28,9 +28,9 @@
 	"github.com/looplab/fsm"
 	"github.com/opencord/omci-lib-go"
 	me "github.com/opencord/omci-lib-go/generated"
-	"github.com/opencord/voltha-lib-go/v4/pkg/db"
-	"github.com/opencord/voltha-lib-go/v4/pkg/db/kvstore"
-	"github.com/opencord/voltha-lib-go/v4/pkg/log"
+	"github.com/opencord/voltha-lib-go/v5/pkg/db"
+	"github.com/opencord/voltha-lib-go/v5/pkg/db/kvstore"
+	"github.com/opencord/voltha-lib-go/v5/pkg/log"
 	"github.com/opencord/voltha-protos/v4/go/voltha"
 )
 
@@ -330,6 +330,13 @@
 			log.Fields{"device-id": dh.deviceID, "service": baseKvStorePath})
 		return nil
 	}
+	// restore data from KV store
+	if err := metricsManager.restorePmData(ctx); err != nil {
+		logger.Errorw(ctx, "error restoring pm data", log.Fields{"err": err})
+		// we continue given that it does not effect the actual services for the ONU,
+		// but there may be some negative effect on PM collection (there may be some mismatch in
+		// the actual PM config and what is present on the device).
+	}
 
 	logger.Info(ctx, "init-onuMetricsManager completed", log.Fields{"device-id": dh.deviceID})
 	return &metricsManager
@@ -1116,13 +1123,6 @@
 // ** L2 PM FSM Handlers start **
 
 func (mm *onuMetricsManager) l2PMFsmStarting(ctx context.Context, e *fsm.Event) {
-	// restore data from KV store
-	if err := mm.restorePmData(ctx); err != nil {
-		logger.Errorw(ctx, "error restoring pm data", log.Fields{"err": err})
-		// we continue given that it does not effect the actual services for the ONU,
-		// but there may be some negative effect on PM collection (there may be some mismatch in
-		// the actual PM config and what is present on the device).
-	}
 
 	// Loop through all the group metrics
 	// If it is a L2 PM Interval metric and it is enabled, then if it is not in the