Skip to content

Commit

Permalink
rename ExportProfileData.py to ExportData.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Voigt committed Nov 27, 2024
1 parent e32edc1 commit 5654dc4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
File renamed without changes.
22 changes: 11 additions & 11 deletions simulators/extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:\
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions test/export_import_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5654dc4

Please sign in to comment.