Skip to content

Commit d129169

Browse files
TELEMETRY-2: Dynamic telemetry markers for Dynamic Tables in Telemetry
Description: Introduced marker type DataModelTable for dynamic tables in telemetry. Enhanced T2 agent to resolve and collect data from all instances of multi-instance object tables when dynamic markers are configured. Added logic to parse DataModelTable, filter markers based on telemetry profile configuration, and encode them in telemetry reports after collection, ensuring telemetry reports include per-instance data for configured dynamic markers. Added support for an "index" parameter in configuration to restrict data collection to specific indexes if required. Reason for change: Enable telemetry to capture dynamic, per-instance data from tables (e.g., Host table, Wi-Fi associated devices) where indexes are not fixed, ensuring richer and more flexible telemetry collection. Signed-off-by: onkar.panchare1 <onkar.panchare@telekom-digital.com>
1 parent cc0548e commit d129169

11 files changed

Lines changed: 777 additions & 79 deletions

File tree

schemas/t2_reportProfileSchema.schema.json

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,44 @@
9494
}
9595
}
9696
]
97+
},
98+
"dataModelSimple": {
99+
"title": "\"dataModel\" Parameter (restricted for use in dataModelTable)",
100+
"type": "object",
101+
"properties": {
102+
"type": { "type": "string", "const": "dataModel" },
103+
"reference": { "type": "string" }
104+
},
105+
"required": ["type", "reference"],
106+
"additionalProperties": false
107+
},
108+
"dataModelTable": {
109+
"title": "\"dataModelTable\" Parameter",
110+
"type": "object",
111+
"properties": {
112+
"type": { "type": "string", "const": "dataModelTable" },
113+
"reference": {
114+
"type": "string",
115+
"pattern": ".*\\.$",
116+
"description": "Reference must end with a dot '.'"
117+
},
118+
"index": {
119+
"type": "string",
120+
"pattern": "^(\\d+(-\\d+)?)(,(\\d+(-\\d+)?))*$",
121+
"description": "Comma separated numbers, ranges (e.g. 1-4), or combinations (e.g. 1,2,5-7)."
122+
},
123+
"Parameter": {
124+
"type": "array",
125+
"items": {
126+
"oneOf": [
127+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModelSimple" },
128+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModelTable" }
129+
]
130+
}
131+
}
132+
},
133+
"required": ["type", "reference", "Parameter"],
134+
"additionalProperties": false
97135
}
98136
}
99137
},
@@ -233,7 +271,8 @@
233271
"oneOf": [
234272
{ "$ref": "#/definitions/parmDefinitions/properties/grep", "title": "grep" },
235273
{ "$ref": "#/definitions/parmDefinitions/properties/event", "title": "event" },
236-
{ "$ref": "#/definitions/parmDefinitions/properties/dataModel", "title": "dataModel" }
274+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModel", "title": "dataModel" },
275+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModelTable", "title": "dataModelTable" }
237276
]
238277
},
239278
"description": "An array of objects which defines the data to be included in the generated report. Each object defines the type of data, the source of the data and an optional name to be used as the name (marker) for this data in the generated report. "

source/bulkdata/profile.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "t2markers.h"
3030
#include "t2log_wrapper.h"
3131
#include "busInterface.h"
32+
#include "ccspinterface.h"
3233
#include "curlinterface.h"
3334
#include "rbusmethodinterface.h"
3435
#include "scheduler.h"
@@ -195,6 +196,10 @@ static void freeProfile(void *data)
195196
Vector_Destroy(profile->cachedReportList, free);
196197
profile->cachedReportList = NULL;
197198
}
199+
if(profile->dataModelTableList)
200+
{
201+
Vector_Destroy(profile->dataModelTableList, freeDataModelTable);
202+
}
198203
if(profile->jsonReportObj)
199204
{
200205
cJSON_Delete(profile->jsonReportObj);
@@ -446,7 +451,14 @@ static void* CollectAndReport(void* data)
446451
profileParamVals = getProfileParameterValues(profile->paramList, count);
447452
if(profileParamVals != NULL)
448453
{
449-
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals);
454+
if (Vector_Size(profile->dataModelTableList) > 0)
455+
{
456+
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals, profile->dataModelTableList);
457+
}
458+
else
459+
{
460+
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals, NULL);
461+
}
450462
}
451463
Vector_Destroy(profileParamVals, freeProfileValues);
452464
}

source/bulkdata/profile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ typedef struct _Profile
8080
Vector *gMarkerList;
8181
Vector *topMarkerList;
8282
Vector *cachedReportList;
83+
Vector *dataModelTableList; // List of DataModelTable
8384
cJSON *jsonReportObj;
8485
pthread_t reportThread;
8586
pthread_mutex_t triggerCondMutex;

source/bulkdata/profilexconf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static void* CollectAndReportXconf(void* data)
271271
T2Info("Fetch complete for TR-181 Object/Parameter Values for parameters \n");
272272
if(profileParamVals != NULL)
273273
{
274-
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals);
274+
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals, NULL);
275275
}
276276
Vector_Destroy(profileParamVals, freeProfileValues);
277277
}

0 commit comments

Comments
 (0)