Skip to content

Commit d83f2cf

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 1a8139e commit d83f2cf

File tree

11 files changed

+849
-79
lines changed

11 files changed

+849
-79
lines changed

schemas/t2_reportProfileSchema.schema.json

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,44 @@
9595
}
9696
}
9797
]
98+
},
99+
"dataModelSimple": {
100+
"title": "\"dataModel\" Parameter (restricted for use in dataModelTable)",
101+
"type": "object",
102+
"properties": {
103+
"type": { "type": "string", "const": "dataModel" },
104+
"reference": { "type": "string" }
105+
},
106+
"required": ["type", "reference"],
107+
"additionalProperties": false
108+
},
109+
"dataModelTable": {
110+
"title": "\"dataModelTable\" Parameter",
111+
"type": "object",
112+
"properties": {
113+
"type": { "type": "string", "const": "dataModelTable" },
114+
"reference": {
115+
"type": "string",
116+
"pattern": ".*\\.$",
117+
"description": "Reference must end with a dot '.'"
118+
},
119+
"index": {
120+
"type": "string",
121+
"pattern": "^(\\d+(-\\d+)?)(,(\\d+(-\\d+)?))*$",
122+
"description": "Comma separated numbers, ranges (e.g. 1-4), or combinations (e.g. 1,2,5-7)."
123+
},
124+
"Parameter": {
125+
"type": "array",
126+
"items": {
127+
"oneOf": [
128+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModelSimple" },
129+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModelTable" }
130+
]
131+
}
132+
}
133+
},
134+
"required": ["type", "reference", "Parameter"],
135+
"additionalProperties": false
98136
}
99137
}
100138
},
@@ -234,7 +272,8 @@
234272
"oneOf": [
235273
{ "$ref": "#/definitions/parmDefinitions/properties/grep", "title": "grep" },
236274
{ "$ref": "#/definitions/parmDefinitions/properties/event", "title": "event" },
237-
{ "$ref": "#/definitions/parmDefinitions/properties/dataModel", "title": "dataModel" }
275+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModel", "title": "dataModel" },
276+
{ "$ref": "#/definitions/parmDefinitions/properties/dataModelTable", "title": "dataModelTable" }
238277
]
239278
},
240279
"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);
@@ -445,7 +450,14 @@ static void* CollectAndReport(void* data)
445450
profileParamVals = getProfileParameterValues(profile->paramList, count);
446451
if(profileParamVals != NULL)
447452
{
448-
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals);
453+
if (Vector_Size(profile->dataModelTableList) > 0)
454+
{
455+
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals, profile->dataModelTableList);
456+
}
457+
else
458+
{
459+
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals, NULL);
460+
}
449461
}
450462
Vector_Destroy(profileParamVals, freeProfileValues);
451463
}

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
@@ -280,7 +280,7 @@ static void* CollectAndReportXconf(void* data)
280280
T2Info("Fetch complete for TR-181 Object/Parameter Values for parameters \n");
281281
if(profileParamVals != NULL)
282282
{
283-
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals);
283+
encodeParamResultInJSON(valArray, profile->paramList, profileParamVals, NULL);
284284
}
285285
Vector_Destroy(profileParamVals, freeProfileValues);
286286
}

0 commit comments

Comments
 (0)