[VOL-4738] openonuAdapterGo: key change for storing MIB templates in kv-store

Change-Id: I5d3dd740413768330c91c03743d593385829a66d
diff --git a/VERSION b/VERSION
index 139db26..ecf00d9 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.5-dev286
+2.2.5
\ No newline at end of file
diff --git a/internal/pkg/common/interfaces.go b/internal/pkg/common/interfaces.go
index e1cc2ec..ed8cf1e 100755
--- a/internal/pkg/common/interfaces.go
+++ b/internal/pkg/common/interfaces.go
@@ -131,6 +131,7 @@
 	GetOnuDB() *devdb.OnuDeviceDB
 	GetPersSerialNumber() string
 	GetPersVendorID() string
+	GetPersVersion() string
 	GetPersEquipmentID() string
 	GetPersIsExtOmciSupported() bool
 
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index 2ebad75..ff12c1c 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -877,7 +877,8 @@
 func (oo *OnuDeviceEntry) buildMibTemplatePath() string {
 	oo.MutexPersOnuConfig.RLock()
 	defer oo.MutexPersOnuConfig.RUnlock()
-	return fmt.Sprintf(cSuffixMibTemplateKvStore, oo.SOnuPersistentData.PersVendorID, oo.SOnuPersistentData.PersEquipmentID, oo.SOnuPersistentData.PersActiveSwVersion)
+	return fmt.Sprintf(cSuffixMibTemplateKvStore, oo.SOnuPersistentData.PersVendorID, oo.SOnuPersistentData.PersVersion,
+		oo.SOnuPersistentData.PersActiveSwVersion)
 }
 
 // AllocateFreeTcont - TODO: add comment
@@ -954,6 +955,14 @@
 	return value
 }
 
+// GetPersVersion - TODO: add comment
+func (oo *OnuDeviceEntry) GetPersVersion() string {
+	oo.MutexPersOnuConfig.RLock()
+	defer oo.MutexPersOnuConfig.RUnlock()
+	value := oo.SOnuPersistentData.PersVersion
+	return value
+}
+
 // GetPersEquipmentID - TODO: add comment
 func (oo *OnuDeviceEntry) GetPersEquipmentID() string {
 	oo.MutexPersOnuConfig.RLock()
diff --git a/internal/pkg/pmmgr/onu_metrics_manager.go b/internal/pkg/pmmgr/onu_metrics_manager.go
index 0d61c2d..242e38c 100755
--- a/internal/pkg/pmmgr/onu_metrics_manager.go
+++ b/internal/pkg/pmmgr/onu_metrics_manager.go
@@ -3094,7 +3094,7 @@
 	// Check if the data is already available in KV store, if yes, do not send the request for get me.
 	var data me.ClassID
 	key := fmt.Sprintf("%s/%s/%s", mm.pOnuDeviceEntry.GetPersVendorID(),
-		mm.pOnuDeviceEntry.GetPersEquipmentID(),
+		mm.pOnuDeviceEntry.GetPersVersion(),
 		mm.pOnuDeviceEntry.GetPersActiveSwVersion())
 	Value, err := mm.extPmKvStore.Get(ctx, key)
 	if err == nil {
@@ -3199,7 +3199,7 @@
 
 func (mm *OnuMetricsManager) putExtPmMeKvStore(ctx context.Context) {
 	key := fmt.Sprintf("%s/%s/%s", mm.pOnuDeviceEntry.GetPersVendorID(),
-		mm.pOnuDeviceEntry.GetPersEquipmentID(),
+		mm.pOnuDeviceEntry.GetPersVersion(),
 		mm.pOnuDeviceEntry.GetPersActiveSwVersion())
 	// check if we get the supported type me for ethernet frame extended pm class id
 	if mm.supportedEthernetFrameExtendedPMClass == 0 {
diff --git a/templates/BBSM-12345123451234512345-BBSM_IMG_00001-v1-1UNI.json b/templates/BBSM-v0.0.1-BBSM_IMG_00001-v1-1UNI.json
similarity index 99%
rename from templates/BBSM-12345123451234512345-BBSM_IMG_00001-v1-1UNI.json
rename to templates/BBSM-v0.0.1-BBSM_IMG_00001-v1-1UNI.json
index 2b6d348..6f4df81 100644
--- a/templates/BBSM-12345123451234512345-BBSM_IMG_00001-v1-1UNI.json
+++ b/templates/BBSM-v0.0.1-BBSM_IMG_00001-v1-1UNI.json
@@ -1,6 +1,6 @@
 {
   "TemplateCreated": "2022-03-22 16:57:15.463577",
-  "TemplateName": "BBSM/12345123451234512345/BBSM_IMG_00001",
+  "TemplateName": "BBSM/v0.0.1/BBSM_IMG_00001",
   "11": {
     "257": {
       "Attributes": {
diff --git a/templates/BBSM-12345123451234512345-BBSM_IMG_00001-v1.json b/templates/BBSM-v0.0.1-BBSM_IMG_00001-v1.json
similarity index 99%
rename from templates/BBSM-12345123451234512345-BBSM_IMG_00001-v1.json
rename to templates/BBSM-v0.0.1-BBSM_IMG_00001-v1.json
index b3e2eac..3440284 100644
--- a/templates/BBSM-12345123451234512345-BBSM_IMG_00001-v1.json
+++ b/templates/BBSM-v0.0.1-BBSM_IMG_00001-v1.json
@@ -1,6 +1,6 @@
 {

   "TemplateCreated": "2022-03-22 16:57:15.463577",

-  "TemplateName": "BBSM/12345123451234512345/BBSM_IMG_00001",

+  "TemplateName": "BBSM/v0.0.1/BBSM_IMG_00001",

   "11": {

     "257": {

       "Attributes": {

diff --git a/templates/README.md b/templates/README.md
index ecb22df..d5f5b3d 100644
--- a/templates/README.md
+++ b/templates/README.md
@@ -2,7 +2,7 @@
 
 ## Important Note:
 Unlike for the previous Python version of the openonu-adapter, it is no longer absolutely necessary to store a pre-built version of a MIB template in the kv store
-in order to benefit from an accelerated startup of the ONUs, since for the first ONU of a given triplet of VendorID, EquipmentID and ActiveSwVersion
+in order to benefit from an accelerated startup of the ONUs, since for the first ONU of a given triplet of VendorID, Version and ActiveSwVersion
 a corresponding MIB template is generated during its startup and is stored in the kv store.
 However, there is a small risk that the first ONU that registers with the Voltha POD reports a MIB which is syntactically correct but incorrect
 in terms of content during MIB upload. This MIB would than be stored by the openonu-adapter as a MIB template in kv store and used for other ONUs
@@ -11,7 +11,7 @@
 To generate this predefined MIB template an ONU of a certain type can be brought up under controlled laboratory conditions in a Voltha POD
 and the generated MIB template can be extracted from the kv store at:
 
-**service/\<voltha_name>/omci_mibs/go_templates/\<VendorID>/\<EquipmentID>/\<ActiveSwVersion>/**
+**service/\<voltha_name>/omci_mibs/go_templates/\<VendorID>/\<Version>/\<ActiveSwVersion>/**
 
 To use this MIB template in other Voltha PODs, it has to be imported again at exactly the same kv store path as it was extracted from.
 An example for the BBSIM MIB template on how to do this can be found in the script file
diff --git a/templates/load-mib-template.sh b/templates/load-mib-template.sh
index 8c3a1ae..2dfd629 100755
--- a/templates/load-mib-template.sh
+++ b/templates/load-mib-template.sh
@@ -19,4 +19,4 @@
 ETCD_IP=${DOCKER_HOST_IP:=172.17.0.1}
 
 set -x
-cat BBSM-12345123451234512345-BBSM_IMG_00001-v1.json| ETCDCTL_API=3 etcdctl --endpoints=$ETCD_IP:2379 put service/voltha/omci_mibs/go_templates/BBSM/12345123451234512345/BBSM_IMG_00001
+cat BBSM-v0.0.1-BBSM_IMG_00001-v1.json| ETCDCTL_API=3 etcdctl --endpoints=$ETCD_IP:2379 put service/voltha/omci_mibs/go_templates/BBSM/v0.0.1/BBSM_IMG_00001