diff --git a/simulators/extras/ExportProfileData.py b/simulators/extras/ExportData.py similarity index 100% rename from simulators/extras/ExportProfileData.py rename to simulators/extras/ExportData.py diff --git a/simulators/extras/README.md b/simulators/extras/README.md index 321b0c54..5d45e3a0 100644 --- a/simulators/extras/README.md +++ b/simulators/extras/README.md @@ -35,18 +35,18 @@ pip install c8y_api ## Run the export script If the environment **optional** parameters were not setup, they can be input as arguments when running the script. ```shell -ExportProfileData.py [-h] [--device-ids DEVICE_ID] - [--create-from CREATE_FROM] - [--create-to CREATE_TO] - [--data-type {measurements,alarms,all}] - [--log {DEBUG,INFO,WARNING,ERROR,CRITICAL}] - [--username USERNAME] [--password PASSWORD] - [--baseurl BASEURL] [--tenant-id TENANT-ID] +ExportData.py [-h] [--device-ids DEVICE_ID] + [--create-from CREATE_FROM] + [--create-to CREATE_TO] + [--data-type {measurements,alarms,all}] + [--log {DEBUG,INFO,WARNING,ERROR,CRITICAL}] + [--username USERNAME] [--password PASSWORD] + [--baseurl BASEURL] [--tenant-id TENANT-ID] ``` Example: ```shell -python ExportProfileData.py --device-ids 123456 254676 --create-from 2022-11-16T07:39:35.780Z --create-to 2022-11-16T07:49:35.780Z +python ExportData.py --device-ids 123456 254676 --create-from 2022-11-16T07:39:35.780Z --create-to 2022-11-16T07:49:35.780Z ``` optional arguments:\ @@ -81,14 +81,14 @@ ImportData.py [-h] [--ifiles INPUTFILES] ``` Example: ```shell -python ImportData.py --ifiles sim_001_profile sim_002_profile --log DEBUG --username admin --password abcxzy123 +python ImportData.py --ifiles sim_001 sim_002 --log DEBUG --username admin --password abcxzy123 ``` ### INPUTFILE -Filename (without extension "json") of one or multiple input file can be input. For example: ```sim_001_profile sim_002_profile```.\ +Filename (without extension "json") of one or multiple input file can be input. For example: ```sim_001 sim_002```.\ If the inputfile is not defined, all the json data files in export_data folder will be imported. ### Credentials Arguments -Credentials for the C8Y instance can be handed to the script using cli arguments as shown in the example above. The script will try to extract the crendentials from the [Environment File](./Environment.py) if no credentials are presented as arguments. +Credentials for the C8Y instance can be handed to the script using cli arguments as shown in the example above. The script will try to extract the credentials from the [Environment File](./Environment.py) if no credentials are presented as arguments. ### Logging Log-level: five log levels can be set using the --log argument {DEBUG, INFO, WARNING, ERROR, CRITICAL}. From left to right is the decreasing order of log info amount can be seen: DEBUG>INFO>WARNING>ERROR>CRITICAL. For example, if INFO level is set, DEBUG level messages can not be seen. diff --git a/test/export_import_test.py b/test/export_import_test.py index 2687f357..c60543fb 100644 --- a/test/export_import_test.py +++ b/test/export_import_test.py @@ -79,8 +79,8 @@ def test_export_import_profile_data(self, mock_error): # Change work dir to extras Utilities.change_working_dir_between_extras_and_test() - # Run the ExportProfileData.py script - call(["python", "ExportProfileData.py", "--device-ids", f"{device_id}", "--username", f"{C8Y_USER}", "--password", f"{C8Y_PASSWORD}", "--tenant-id", f"{C8Y_TENANT}", "--baseurl", f"{C8Y_BASEURL}", "--test"]) + # Run the ExportData.py script + call(["python", "ExportData.py", "--device-ids", f"{device_id}", "--username", f"{C8Y_USER}", "--password", f"{C8Y_PASSWORD}", "--tenant-id", f"{C8Y_TENANT}", "--baseurl", f"{C8Y_BASEURL}", "--test"]) # Change work dir to test dir Utilities.change_working_dir_between_extras_and_test()