From dea555173f442d497dcfa7280f8590d61e81739f Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta Date: Wed, 27 Nov 2024 12:21:15 +0000 Subject: [PATCH] tools: Fix datatypes in generated json --- tools/bbf_common.py | 13 ++-- tools/convert_dm_xml_to_json.py | 7 +- tools/datamodel.json | 132 ++++++++++++++++---------------- tools/tools_input.json | 1 - 4 files changed, 78 insertions(+), 75 deletions(-) diff --git a/tools/bbf_common.py b/tools/bbf_common.py index b868a78b..ecad58b7 100755 --- a/tools/bbf_common.py +++ b/tools/bbf_common.py @@ -360,8 +360,8 @@ def download_and_build_plugins(plugins, vendor_prefix): name=os.path.basename(repo).replace('.git','') if repo is None or proto is None or dm_files is None or not isinstance(dm_files, list): - print("Necessary input missing") BBF_ERROR_CODE += 1 + print(f"# Necessary input missing {BBF_ERROR_CODE}") continue print(f' - Processing plugin: MS({is_microservice}) {plugin}') @@ -372,8 +372,8 @@ def download_and_build_plugins(plugins, vendor_prefix): if not clone_git_repository(repo, version): - print(f"Failed to clone {repo}") BBF_ERROR_CODE += 1 + print(f"# Failed to clone {repo} {BBF_ERROR_CODE}") continue print(f' Processing {get_repo_version_info(repo, version)}') @@ -382,8 +382,8 @@ def download_and_build_plugins(plugins, vendor_prefix): print(f' Processing {get_repo_version_info(repo, proto)}') if repo_path is None: - print("Repository path not defined!!!") BBF_ERROR_CODE += 1 + print(f"# Repository path not defined {BBF_ERROR_CODE}!!!") continue create_folder("/tmp/repo/dm_info") @@ -404,20 +404,21 @@ def download_and_build_plugins(plugins, vendor_prefix): elif filename.endswith('.json'): move_file(filename, "/usr/share/bbfdm/plugins") else: - print(f"Unknown file format {filename}") BBF_ERROR_CODE += 1 + print(f"# Unknown file format {filename} {BBF_ERROR_CODE}") else: - print(f"Error: File not accessible {filename} !!!!!!") BBF_ERROR_CODE += 1 + print(f"# Error: File not accessible {filename} {BBF_ERROR_CODE}!!!!!!") if len(LIST_FILES) > 0: if not generate_shared_library(f"{plugin_index}_{name}.so", LIST_FILES, vendor_prefix, extra_dependencies, is_microservice): BBF_ERROR_CODE += 1 + print(f"# Error: Failed to generate shared library for {plugin_index}_{name}, error {BBF_ERROR_CODE}") clear_list(LIST_FILES) cd_dir(CURRENT_PATH) - print('Generating plugins completed.') + print(f'Generating plugins completed, error {BBF_ERROR_CODE}') def generate_supported_dm(vendor_prefix=None, plugins=None): diff --git a/tools/convert_dm_xml_to_json.py b/tools/convert_dm_xml_to_json.py index 3ef173c5..32886adf 100755 --- a/tools/convert_dm_xml_to_json.py +++ b/tools/convert_dm_xml_to_json.py @@ -69,7 +69,7 @@ def getparamtype(dmparam): break if c.tag == "dataType": reftype = c.get("ref") - if reftype == "StatsCounter32" or reftype == "PSDBreakPointIndexAndLevel" or reftype == "PSMBreakPointIndexAndLevel" or reftype == "SELTPAttenuationCharacteristicsIndexAndTFlog": + if reftype == "StatsCounter32" or reftype == "PSDBreakPointIndexAndLevel" or reftype == "PSMBreakPointIndexAndLevel" or reftype == "SELTPAttenuationCharacteristicsIndexAndTFlog" or reftype == "Order": ptype = "unsignedInt" break elif reftype == "StatsCounter64": @@ -453,7 +453,10 @@ def add_param_to_list(main_obj, dmobject, dmparam, proto): def add_command_to_list(main_obj, dmparam, proto): - is_async = dmparam.get('async') is not None + is_async = False + + if dmparam.get('async') == "true": + is_async = True entry_command = { "name": main_obj + dmparam.get('name'), diff --git a/tools/datamodel.json b/tools/datamodel.json index a27c6757..10ce8c81 100644 --- a/tools/datamodel.json +++ b/tools/datamodel.json @@ -60,7 +60,7 @@ }, "Reboot()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -158,7 +158,7 @@ }, "FactoryReset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -24340,7 +24340,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -28632,7 +28632,7 @@ }, "PasswordReset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -28672,7 +28672,7 @@ "datatype": "_AliasCWMP" }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -28931,7 +28931,7 @@ }, "CreateWebSession()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -29089,7 +29089,7 @@ }, "Delete()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -37202,7 +37202,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -38436,7 +38436,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -41751,7 +41751,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -42135,7 +42135,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -42474,7 +42474,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -42788,7 +42788,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -43151,7 +43151,7 @@ }, "SendMagicPacket()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -43814,7 +43814,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -53965,7 +53965,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -70045,7 +70045,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -74774,7 +74774,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -75908,7 +75908,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -76679,7 +76679,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -76986,7 +76986,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -84908,7 +84908,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -86897,7 +86897,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -87656,7 +87656,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -88349,7 +88349,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -90339,7 +90339,7 @@ }, "StatsReset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -91176,7 +91176,7 @@ }, "MACTest()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -92713,7 +92713,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -96664,7 +96664,7 @@ }, "FlushCache()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -99865,7 +99865,7 @@ }, "Renew()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -99967,7 +99967,7 @@ "datatype": "boolean" }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -100216,7 +100216,7 @@ "datatype": "_AliasCWMP" }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -101037,7 +101037,7 @@ "datatype": "_AliasCWMP" }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -101505,7 +101505,7 @@ }, "Renew()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -102143,7 +102143,7 @@ "datatype": "_AliasCWMP" }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -102984,14 +102984,14 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] }, "Disconnect()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -103190,7 +103190,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -103378,7 +103378,7 @@ }, "CheckCredentialsDiagnostics()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -104002,7 +104002,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -105713,7 +105713,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -106081,7 +106081,7 @@ ] }, "Order": { - "type": "string", + "type": "unsignedInt", "read": true, "write": true, "protocols": [ @@ -108215,14 +108215,14 @@ }, "ForceSample()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] }, "ForceCollection()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -109646,7 +109646,7 @@ }, "GPSReset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -111709,7 +111709,7 @@ }, "ForceCollection()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -112720,7 +112720,7 @@ }, "AddExecEnv()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -113401,7 +113401,7 @@ }, "SetRunLevel()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -113793,7 +113793,7 @@ }, "Remove()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -114762,7 +114762,7 @@ }, "SetRequestedState()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -114786,7 +114786,7 @@ }, "Restart()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -118479,7 +118479,7 @@ }, "ForceReconnect()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -119224,7 +119224,7 @@ }, "ForceReconnect()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -126763,7 +126763,7 @@ }, "Delete()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -131509,7 +131509,7 @@ }, "AddCertificate()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -132254,7 +132254,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -132471,7 +132471,7 @@ }, "ScheduleTimer()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -132525,7 +132525,7 @@ }, "AddMyCertificate()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -132565,7 +132565,7 @@ }, "SendOnBoardRequest()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -132910,7 +132910,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -133285,7 +133285,7 @@ }, "Reset()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] @@ -133357,14 +133357,14 @@ }, "Delete()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] }, "GetFingerprint()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -133475,7 +133475,7 @@ }, "RequestChallenge()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -133583,7 +133583,7 @@ }, "ChallengeResponse()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ], @@ -134264,7 +134264,7 @@ }, "Cancel()": { "type": "command", - "async": true, + "async": false, "protocols": [ "usp" ] diff --git a/tools/tools_input.json b/tools/tools_input.json index 160780f6..35ca34ca 100644 --- a/tools/tools_input.json +++ b/tools/tools_input.json @@ -103,7 +103,6 @@ "proto": "git", "version": "devel", "dm_files": [ - "urlfilter/files/etc/urlfilter/X_IOPSYS_EU_ParentalControl.json", "icwmp/files/etc/bbfdm/json/CWMPManagementServer.json", "ponmngr/files/etc/ponmngr/xpon.json" ]