From a20919a020e40a3c1f06c612b713e2872b8d31da Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Wed, 6 Oct 2021 11:24:37 +0000 Subject: [PATCH] Fix DM parameter mapping for json --- dmtree/json/tr181.json | 18 ++++++++---------- dmtree/tr181/wifi.c | 2 +- tools/convert_dm_xml_to_json.py | 10 +++++++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/dmtree/json/tr181.json b/dmtree/json/tr181.json index 7ea0aac6..c2a9006c 100644 --- a/dmtree/json/tr181.json +++ b/dmtree/json/tr181.json @@ -15635,7 +15635,7 @@ "object": "fast.line.1", "method": "status", "args": {}, - "key": "upbokle" + "key": "upbokler" } } ] @@ -17989,7 +17989,7 @@ "datatype": "boolean" }, "OpticalSignalLevel": { - "type": "string", + "type": "int", "read": true, "write": false, "version": "2.4", @@ -18000,7 +18000,7 @@ "datatype": "Dbm1000" }, "LowerOpticalThreshold": { - "type": "string", + "type": "int", "read": true, "write": false, "version": "2.4", @@ -18011,7 +18011,7 @@ "datatype": "Dbm1000" }, "UpperOpticalThreshold": { - "type": "string", + "type": "int", "read": true, "write": false, "version": "2.4", @@ -18022,7 +18022,7 @@ "datatype": "Dbm1000" }, "TransmitOpticalLevel": { - "type": "string", + "type": "int", "read": true, "write": false, "version": "2.4", @@ -18033,7 +18033,7 @@ "datatype": "Dbm1000" }, "LowerTransmitPowerThreshold": { - "type": "string", + "type": "int", "read": true, "write": false, "version": "2.4", @@ -18044,7 +18044,7 @@ "datatype": "Dbm1000" }, "UpperTransmitPowerThreshold": { - "type": "string", + "type": "int", "read": true, "write": false, "version": "2.4", @@ -76185,8 +76185,7 @@ "enumerations": [ "Streaming", "File", - "HTTP", - "USPEventNotif" + "HTTP" ] } }, @@ -80906,7 +80905,6 @@ ], "datatype": "string", "enumerations": [ - "", "AP", "non-AP/non-PCP STA", "Wi-Fi P2P Client", diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index 6d962b4b..f93041b9 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -3123,7 +3123,7 @@ static int set_WiFiDataElementsNetwork_ControllerID(char *refparam, struct dmctx return 0; } -/*#Device.WiFi.DataElements.Network.DeviceNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[@i-1].wfa-dataelements:Network.NumberOfDevices*/ +/*#Device.WiFi.DataElements.Network.DeviceNumberOfEntries!UBUS:wifi.dataelements.collector/dump//data[0].wfa-dataelements:Network.NumberOfDevices*/ static int get_WiFiDataElementsNetwork_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { int i = 0; diff --git a/tools/convert_dm_xml_to_json.py b/tools/convert_dm_xml_to_json.py index 5b860138..35e03dcf 100755 --- a/tools/convert_dm_xml_to_json.py +++ b/tools/convert_dm_xml_to_json.py @@ -78,8 +78,12 @@ def getparamtype(dmparam): if "StatsCounter" in reftype: ptype = "unsignedInt" break - ptype = "string" - break + elif "Dbm1000" in reftype: + ptype = "int" + break + else: + ptype = "string" + break ptype = c.tag break break @@ -383,7 +387,7 @@ def printPARAMMaPPING(mapping): lst = mapping.split("&") print("\"mapping\": [", file=fp) for i in range(len(lst)): - config_type = lst[i].split(":") + config_type = lst[i].split(":", 1) config = config_type[1].split("/") print("{", file=fp)