RIC-710: Updating E2T counters to Vespa-Manager

Change-Id: I2039dd5a2e982f5e894ce44a0eee5c66d973ffa8
Signed-off-by: dhiraj <dhiraj.verma@nokia.com>
diff --git a/cmd/vespamgr/config_test.go b/cmd/vespamgr/config_test.go
index d65baa2..9c32de7 100755
--- a/cmd/vespamgr/config_test.go
+++ b/cmd/vespamgr/config_test.go
@@ -210,3 +210,23 @@
 	appMetrics = vespaMgr.ParseMetricsFromDescriptor(metricsBytes, appMetrics)
 	assert.Empty(t, appMetrics)
 }
+
+func TestYamlGenerationWithPlatformConfig(t *testing.T) {
+	buffer := new(bytes.Buffer)
+	bytes, err := ioutil.ReadFile("../../config/plt-counter.json")
+	assert.Nil(t, err)
+	vespaMgr.CreateConfig(buffer, bytes)
+	var vesconf VESAgentConfiguration
+	err = yaml.Unmarshal(buffer.Bytes(), &vesconf)
+	assert.Nil(t, err)
+	testBaseConf(t, vesconf)
+	assert.Len(t, vesconf.Measurement.Prometheus.Rules.Metrics, 40)
+}
+
+func TestParsePlatformConfigWithNoMetrices(t *testing.T) {
+	metricsBytes,err := ioutil.ReadFile("../../test/plt-counter_no_metrices.json")
+	assert.Nil(t, err)
+	appMetrics := make(AppMetrics)
+	appMetrics = vespaMgr.ParseMetricsFromDescriptor(metricsBytes, appMetrics)
+	assert.Empty(t, appMetrics)
+}
\ No newline at end of file
diff --git a/config/plt-counter.json b/config/plt-counter.json
index 339cdce..deeed12 100644
--- a/config/plt-counter.json
+++ b/config/plt-counter.json
@@ -17,36 +17,372 @@
                     "measInterval": "60",
                     "metrics": [
                         {
-                            "name": "exposer_transferred_bytes_total",
-                            "objectName": "exposer_transferred_bytes_total",
-                            "objectInstance": "exposer_transferred_bytes_total",
+                            "name": "E2T{POD_NAME='e2term',RICserviceUpdateFailure='Bytes'}",
+                            "objectName": "E2T_RICserviceUpdateFailure_Bytes",
+                            "objectInstance": "E2T_RICserviceUpdateFailure_Bytes",
+                            "counterId": "0010",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICserviceUpdateFailure_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceUpdateFailure='Messages'}",
+                            "objectName": "E2T_RICserviceUpdateFailure_Messages",
+                            "objectInstance": "E2T_RICserviceUpdateFailure_Messages",
                             "counterId": "0011",
                             "type": "counter",
-                            "description": "exposer_transferred_bytes_total"
+                            "description": "E2T counter RICserviceUpdateFailure_Messages"
                         },
                         {
-                            "name": "exposer_scrapes_total",
-                            "objectName": "exposer_scrapes_total",
-                            "objectInstance": "exposer_scrapes_total",
+                            "name": "E2T{POD_NAME='e2term',SetupRequestFailure='Bytes'}",
+                            "objectName": "E2T_SetupRequestFailure_Bytes",
+                            "objectInstance": "E2T_SetupRequestFailure_Bytes",
                             "counterId": "0012",
                             "type": "counter",
-                            "description": "exposer_scrapes_total"
+                            "description": "E2T counter E2T_SetupRequestFailure_Bytes"
                         },
                         {
-                            "name": "exposer_request_latencies_count",
-                            "objectName": "exposer_request_latencies_count",
-                            "objectInstance": "exposer_request_latencies_count",
+                            "name": "E2T{POD_NAME='e2term',SetupRequestFailure='Messages'}",
+                            "objectName": "E2T_SetupRequestFailure_Messages",
+                            "objectInstance": "E2T_SetupRequestFailure_Messages",
                             "counterId": "0013",
                             "type": "counter",
-                            "description": "exposer_request_latencies_count"
+                            "description": "E2T counter SetupRequestFailure_Messages"
                         },
                         {
-                            "name": "exposer_request_latencies_sum",
-                            "objectName": "exposer_request_latencies_sum",
-                            "objectInstance": "exposer_request_latencies_sum",
+                            "name": "E2T{POD_NAME='e2term',ResetACK='Bytes'}",
+                            "objectName": "E2T_ResetACK_Bytes",
+                            "objectInstance": "E2T_ResetACK_Bytes",
                             "counterId": "0014",
                             "type": "counter",
-                            "description": "exposer_request_latencies_sum"
+                            "description": "E2T counter E2T_ResetACK_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',SetupResponse='Bytes'}",
+                            "objectName": "E2T_SetupResponse_Bytes",
+                            "objectInstance": "E2T_SetupResponse_Bytes",
+                            "counterId": "0015",
+                            "type": "counter",
+                            "description": "E2T counter E2T_SetupResponse_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICcontrolACK='Bytes'}",
+                            "objectName": "E2T_RICcontrolACK_Bytes",
+                            "objectInstance": "E2T_RICcontrolACK_Bytes",
+                            "counterId": "0016",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICcontrolACK_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ErrorIndication='Messages'}",
+                            "objectName": "E2T_ErrorIndication_Messages",
+                            "objectInstance": "E2T_ErrorIndication_Messages",
+                            "counterId": "0017",
+                            "type": "counter",
+                            "description": "E2T counter ErrorIndication    _Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetACK='Messages'}",
+                            "objectName": "E2T_ResetACK_Messages",
+                            "objectInstance": "E2T_ResetACK_Messages",
+                            "counterId": "0018",
+                            "type": "counter",
+                            "description": "E2T counter ResetACK_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionACK='Messages'}",
+                            "objectName": "E2T_RICsubscriptionACK_Messages",
+                            "objectInstance": "E2T_RICsubscriptionACK_Messages",
+                            "counterId": "0019",
+                            "type": "counter",
+                            "description": "E2T counter RICsubscriptionACK_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceUpdate='Messages'}",
+                            "objectName": "E2T_RICserviceUpdate_Messages",
+                            "objectInstance": "E2T_RICserviceUpdate_Messages",
+                            "counterId": "0020",
+                            "type": "counter",
+                            "description": "E2T counter RICserviceUpdate_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICindication='Messages'}",
+                            "objectName": "E2T_RICindication_Messages",
+                            "objectInstance": "E2T_RICindication_Messages",
+                            "counterId": "0021",
+                            "type": "counter",
+                            "description": "E2T counter RICindication_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICcontrolACK='Messages'}",
+                            "objectName": "E2T_RICcontrolACK_Messages",
+                            "objectInstance": "E2T_RICcontrolACK_Messages",
+                            "counterId": "0022",
+                            "type": "counter",
+                            "description": "E2T counter RICcontrolACK_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionDelete='Messages'}",
+                            "objectName": "E2T_RICsubscriptionDelete_Messages",
+                            "objectInstance": "E2T_RICsubscriptionDelete_Messages",
+                            "counterId": "0023",
+                            "type": "counter",
+                            "description": "E2T counter RICsubscriptionDelete_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetACK='Bytes'}",
+                            "objectName": "E2T_ResetACK_Bytes",
+                            "objectInstance": "E2T_ResetACK_Bytes",
+                            "counterId": "0024",
+                            "type": "counter",
+                            "description": "E2T counter E2T_ResetACK_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceUpdateResponse='Messages'}",
+                            "objectName": "E2T_RICserviceUpdateResponse_Messages",
+                            "objectInstance": "E2T_RICserviceUpdateResponse_Messages",
+                            "counterId": "0025",
+                            "type": "counter",
+                            "description": "E2T counter RICserviceUpdateResponse_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',SetupRequest='Messages'}",
+                            "objectName": "E2T_SetupRequest_Messages",
+                            "objectInstance": "E2T_SetupRequest_Messages",
+                            "counterId": "0026",
+                            "type": "counter",
+                            "description": "E2T counter SetupRequest_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetACK='Messages'}",
+                            "objectName": "E2T_ResetACK_Messages",
+                            "objectInstance": "E2T_ResetACK_Messages",
+                            "counterId": "0027",
+                            "type": "counter",
+                            "description": "E2T counter ResetACK_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetRequest='Bytes'}",
+                            "objectName": "E2T_ResetRequest_Bytes",
+                            "objectInstance": "E2T_ResetRequest_Bytes",
+                            "counterId": "0028",
+                            "type": "counter",
+                            "description": "E2T counter E2T_ResetRequest_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ErrorIndication='Bytes'}",
+                            "objectName": "E2T_ErrorIndication_Bytes",
+                            "objectInstance": "E2T_ErrorIndication_Bytes",
+                            "counterId": "0029",
+                            "type": "counter",
+                            "description": "E2T counter E2T_ErrorIndication_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICcontrolFailure='Bytes'}",
+                            "objectName": "E2T_RICcontrolFailure_Bytes",
+                            "objectInstance": "E2T_RICcontrolFailure_Bytes",
+                            "counterId": "0030",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICcontrolFailure_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionACK='Bytes'}",
+                            "objectName": "E2T_RICsubscriptionACK_Bytes",
+                            "objectInstance": "E2T_RICsubscriptionACK_Bytes",
+                            "counterId": "0031",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICsubscriptionACK_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',SetupRequest='Bytes'}",
+                            "objectName": "E2T_SetupRequest_Bytes",
+                            "objectInstance": "E2T_SetupRequest_Bytes",
+                            "counterId": "0032",
+                            "type": "counter",
+                            "description": "E2T counter E2T_SetupRequest_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICindication='Bytes'}",
+                            "objectName": "E2T_RICindication_Bytes",
+                            "objectInstance": "E2T_RICindication_Bytes",
+                            "counterId": "0033",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICindicationBytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionDeleteACK='Messages'}",
+                            "objectName": "E2T_RICsubscriptionDeleteACK_Messages",
+                            "objectInstance": "E2T_RICsubscriptionDeleteACK_Messages",
+                            "counterId": "0034",
+                            "type": "counter",
+                            "description": "E2T counter RICsubscriptionDeleteACK_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionDeleteFailure='Messages'}",
+                            "objectName": "E2T_RICsubscriptionDeleteFailure_Messages",
+                            "objectInstance": "E2T_RICsubscriptionDeleteFailure_Messages",
+                            "counterId": "0035",
+                            "type": "counter",
+                            "description": "E2T counter RICsubscriptionDeleteFailure_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceQuery='Bytes'}",
+                            "objectName": "E2T_RICserviceQuery_Bytes",
+                            "objectInstance": "E2T_RICserviceQuery_Bytes",
+                            "counterId": "0036",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICserviceQuery_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICcontrolFailure='Messages'}",
+                            "objectName": "E2T_RICcontrolFailure_Messages",
+                            "objectInstance": "E2T_RICcontrolFailure_Messages",
+                            "counterId": "0037",
+                            "type": "counter",
+                            "description": "E2T counter RICcontrolFailure_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionFailure='Messages'}",
+                            "objectName": "E2T_RICsubscriptionFailure_Messages",
+                            "objectInstance": "E2T_RICsubscriptionFailure_Messages",
+                            "counterId": "0038",
+                            "type": "counter",
+                            "description": "E2T counter RICsubscriptionFailure_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetRequest='Messages'}",
+                            "objectName": "E2T_ResetRequest_Messages",
+                            "objectInstance": "E2T_ResetRequest_Messages",
+                            "counterId": "0039",
+                            "type": "counter",
+                            "description": "E2T counter ResetRequest_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionDeleteFailure='Bytes'}",
+                            "objectName": "E2T_RICsubscriptionDeleteFailure_Bytes",
+                            "objectInstance": "E2T_RICsubscriptionDeleteFailure_Bytes",
+                            "counterId": "0040",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICsubscriptionDeleteFailure_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceUpdate='Bytes'}",
+                            "objectName": "E2T_RICserviceUpdate_Bytes",
+                            "objectInstance": "E2T_RICserviceUpdate_Bytes",
+                            "counterId": "0041",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICserviceUpdate_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ErrorIndication='Messages'}",
+                            "objectName": "E2T_ErrorIndication_Messages",
+                            "objectInstance": "E2T_ErrorIndication_Messages",
+                            "counterId": "0042",
+                            "type": "counter",
+                            "description": "E2T counter ErrorIndication_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscription='Messages'}",
+                            "objectName": "E2T_RICsubscription_Messages",
+                            "objectInstance": "E2T_RICsubscription_Messages",
+                            "counterId": "0043",
+                            "type": "counter",
+                            "description": "E2T counter RICsubscription_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ErrorIndication='Bytes'}",
+                            "objectName": "E2T_ErrorIndication_Bytes",
+                            "objectInstance": "E2T_ErrorIndication_Bytes",
+                            "counterId": "0044",
+                            "type": "counter",
+                            "description": "E2T counter E2T_ErrorIndication_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionDelete='Bytes'}",
+                            "objectName": "E2T_RICsubscriptionDelete_Bytes",
+                            "objectInstance": "E2T_RICsubscriptionDelete_Bytes",
+                            "counterId": "0045",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICsubscriptionDelete_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetRequest='Messages'}",
+                            "objectName": "E2T_ResetRequest_Messages",
+                            "objectInstance": "E2T_ResetRequest_Messages",
+                            "counterId": "0046",
+                            "type": "counter",
+                            "description": "E2T counter ResetRequest_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionDeleteACK='Bytes'}",
+                            "objectName": "E2T_RICsubscriptionDeleteACK_Bytes",
+                            "objectInstance": "E2T_RICsubscriptionDeleteACK_Bytes",
+                            "counterId": "0047",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICsubscriptionDeleteACK_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICcontrol='Bytes'}",
+                            "objectName": "E2T_RICcontrol_Bytes",
+                            "objectInstance": "E2T_RICcontrol_Bytes",
+                            "counterId": "0048",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICcontrol_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',SetupResponse='Messages'}",
+                            "objectName": "E2T_SetupResponse_Messages",
+                            "objectInstance": "E2T_SetupResponse_Messages",
+                            "counterId": "0049",
+                            "type": "counter",
+                            "description": "E2T counter SetupResponse_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',ResetRequest='Bytes'}",
+                            "objectName": "E2T_ResetRequest_Bytes",
+                            "objectInstance": "E2T_ResetRequest_Bytes",
+                            "counterId": "0050",
+                            "type": "counter",
+                            "description": "E2T counter E2T_ResetRequest_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscriptionFailure='Bytes'}",
+                            "objectName": "E2T_RICsubscriptionFailure_Bytes",
+                            "objectInstance": "E2T_RICsubscriptionFailure_Bytes",
+                            "counterId": "0051",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICsubscriptionFailure_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICcontrol='Messages'}",
+                            "objectName": "E2T_RICcontrol_Messages",
+                            "objectInstance": "E2T_RICcontrol_Messages",
+                            "counterId": "0052",
+                            "type": "counter",
+                            "description": "E2T counter RICcontrol_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceUpdateResponse='Bytes'}",
+                            "objectName": "E2T_RICserviceUpdateResponse_Bytes",
+                            "objectInstance": "E2T_RICserviceUpdateResponse_Bytes",
+                            "counterId": "0053",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICserviceUpdateResponse_Bytes"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICserviceQuery='Messages'}",
+                            "objectName": "E2T_RICserviceQuery_Messages",
+                            "objectInstance": "E2T_RICserviceQuery_Messages",
+                            "counterId": "0054",
+                            "type": "counter",
+                            "description": "E2T counter RICserviceQuery_Messages"
+                        },
+                        {
+                            "name": "E2T{POD_NAME='e2term',RICsubscription='Bytes'}",
+                            "objectName": "E2T_RICsubscription_Bytes",
+                            "objectInstance": "E2T_RICsubscription_Bytes",
+                            "counterId": "0055",
+                            "type": "counter",
+                            "description": "E2T counter E2T_RICsubscription_Bytes"
                         }
                     ]
                 }
@@ -55,4 +391,3 @@
     }
     
 ]
-
diff --git a/container-tag.yaml b/container-tag.yaml
index e8956e3..aa54621 100755
--- a/container-tag.yaml
+++ b/container-tag.yaml
@@ -1,4 +1,4 @@
 # The Jenkins job uses this string for the tag in the image name
 # for example nexus3.o-ran-sc.org:10004/my-image-name:0.0.1
 ---
-tag: 0.7.3
+tag: 0.7.4
diff --git a/test/plt-counter_no_metrices.json b/test/plt-counter_no_metrices.json
new file mode 100644
index 0000000..727306c
--- /dev/null
+++ b/test/plt-counter_no_metrices.json
@@ -0,0 +1,15 @@
+[
+    {
+        "metadata": { },
+        "descriptor": { },
+        "config": {
+            "local": {
+                "host": ":8080"
+            },
+            "logger": {
+                "level": 5
+            } 
+        }
+    }
+
+]