dtiot-d2c 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dtiot_d2c-0.9.2/LICENSE +21 -0
- dtiot_d2c-0.9.2/PKG-INFO +62 -0
- dtiot_d2c-0.9.2/README.md +47 -0
- dtiot_d2c-0.9.2/pyproject.toml +27 -0
- dtiot_d2c-0.9.2/setup.cfg +4 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/__init__.py +0 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/CFG.py +409 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/__init__.py +2 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/cli_command.py +292 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/config.py +164 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/configCLI.py +45 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/main.py +243 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/api_impl/api_utils.py +36 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/api_impl/datamodel.py +8 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/api_impl/device_report_post.py +42 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/api_impl/healthz_get.py +18 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/api_impl/job_get_report_file.py +31 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/api_impl/profile_get.py +32 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/config.py +103 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/configs/DEFAULT.py +24 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/main.py +155 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmanapi/utils.py +162 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmangui/ProfileEditor.py +255 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmangui/ProfileManagerGui.py +165 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmangui/ProfileSelector.py +173 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/prfmangui/__init__.py +0 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/profile.py +165 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/profileCLI.py +327 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/profile_webapp.py +126 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/cli/utils.py +283 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/__init__.py +21 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/application/__init__.py +3 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/application/application.py +341 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/application/cli.py +151 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/application/consts.py +20 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/commands/__init__.py +0 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/commands/version.py +32 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/consts.py +280 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device/__init__.py +2 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device/cli.py +484 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device/consts.py +30 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device/device.py +1027 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device/message.py +92 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device_group/__init__.py +3 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device_group/cli.py +217 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device_group/consts.py +7 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/device_group/device_group.py +409 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/get_response.py +100 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/onem2m_base.py +178 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/__init__.py +0 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/application.py +224 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/device.py +490 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/device_group.py +853 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/perftest_get_resource.py +60 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/print_sample_test_configuration.py +47 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/sample_test_configuration.py +122 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/testcli_base.py +212 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/utils.py +56 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/verify_d2c_model.py +163 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/test/verify_device_group_consistency.py +86 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/utils.py +801 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/d2c/version_info.py +2 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/__init__.py +16 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/api_client.py +198 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/consts.py +142 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/device_provisioning.py +141 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/dmo.py +715 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/dmoCLI.py +529 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/html_utils.py +37 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/onem2m_utils.py +132 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c/dmo/utils.py +429 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c.egg-info/PKG-INFO +62 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c.egg-info/SOURCES.txt +74 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c.egg-info/dependency_links.txt +1 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c.egg-info/entry_points.txt +2 -0
- dtiot_d2c-0.9.2/src/dtiot_d2c.egg-info/top_level.txt +1 -0
dtiot_d2c-0.9.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dtiot_d2c-0.9.2/PKG-INFO
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dtiot_d2c
|
|
3
|
+
Version: 0.9.2
|
|
4
|
+
Summary: Device to Cloud (D2C) command line interface
|
|
5
|
+
Author-email: Roland Baldin <roland.baldin@telekom.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, http://localhost:1313/docs/device-to-cloud/command-line-interface/about/
|
|
8
|
+
Project-URL: Issues, http://localhost:1313/docs/device-to-cloud/command-line-interface/about/
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# Introduction
|
|
17
|
+
To support system administrators and to help command line based automation we provide the tool **Device to Cloud Command Line Interface** (**d2ccli**). **d2ccli** provides the shell command ```d2c``` with a wide range of sub-commands to access the Device to Cloud system via the **DMO** API (Device Management Orchestrator).
|
|
18
|
+
</br>
|
|
19
|
+
**d2ccli** has been implemented with **python3** and can be installed using **pip3** or **python3 -m pip** (see [getting started](https://myiot-d.com/docs/device-to-cloud/command-line-interface/getting-started/)).
|
|
20
|
+
</br>
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> **d2ccli** has been tested only on **MacOS** and **Linux** with **python 3.10** and **python 3.12**.
|
|
24
|
+
|
|
25
|
+
> [!NOTE]
|
|
26
|
+
> Currently the **d2ccli** is not available in the public pypi site. To install the python packages please see "Installation of d2ccli from DT GitLab" below.
|
|
27
|
+
|
|
28
|
+
> [!WARNING]
|
|
29
|
+
> **d2ccli** has **NOT** been tested on Windows yet.
|
|
30
|
+
|
|
31
|
+
- [Getting started with d2ccli](https://myiot-d.com/docs/device-to-cloud/command-line-interface/getting-started/)</br>
|
|
32
|
+
Learn how to install and test the **d2c** command.
|
|
33
|
+
- [d2ccli Basics](https://myiot-d.com/docs/device-to-cloud/command-line-interface/basics/)</br>
|
|
34
|
+
Learn how to use the **d2c** command and get an overview about all the sub-commands.
|
|
35
|
+
- [DMO access profile management](https://myiot-d.com/docs/device-to-cloud/command-line-interface/dmo-access-profiles-management/)</br>
|
|
36
|
+
Learn what DMO access profiles are and how to manage them with **d2c** command.
|
|
37
|
+
- [DMO commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/dmo-commands/)</br>
|
|
38
|
+
Reference documentation for DMO sub-commands of **d2c**.
|
|
39
|
+
- [D2C client domain model](https://myiot-d.com/docs/device-to-cloud/command-line-interface/d2c-client-domain-model/)</br>
|
|
40
|
+
Learn about the client sided D2C domain model and the different command domains.
|
|
41
|
+
- [D2C device management commands](.https://myiot-d.com/docs/device-to-cloud/command-line-interface/device-commands/)</br>
|
|
42
|
+
Reference documentation for D2C device management sub-commands of **d2c**.
|
|
43
|
+
- [D2C application management commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/application-commands/)</br>
|
|
44
|
+
Reference documentation for D2C application management sub-commands of **d2c**.
|
|
45
|
+
- [D2C device group management commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/device-group-commands/)</br>
|
|
46
|
+
Reference documentation for D2C device group management sub-commands of **d2c**.
|
|
47
|
+
- [D2C administration commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/administration-commands/)</br>
|
|
48
|
+
Reference documentation for D2C administration sub-commands of **d2c**.
|
|
49
|
+
- [d2c command environment and configuration variables](https://myiot-d.com/docs/device-to-cloud/command-line-interface/tips/)</br>
|
|
50
|
+
Reference documentation for environment and configuration variables of **d2c**.
|
|
51
|
+
|
|
52
|
+
## Installation of d2ccli from DT GitLab
|
|
53
|
+
The python package of d2ccli is called **dtiot-d2c**. To install it with pip perform the following commands on a e.g. *bash*.
|
|
54
|
+
```bash
|
|
55
|
+
python3 -m pip install -U dtiot-d2c
|
|
56
|
+
```
|
|
57
|
+
Those commands should install the package *dtiot_d2c* in your local python site-packages. Further more the shell command **d2c** should have been installed in your local *bin* directory.
|
|
58
|
+
On my MacBook the *dtiot_d2c** directory and the **d2c** executable endet up here:
|
|
59
|
+
```bash
|
|
60
|
+
/home/ubuntu/.local/lib/python3.10/site-packages/dtiot_d2c
|
|
61
|
+
/home/ubuntu/.local/bin/d2c
|
|
62
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
To support system administrators and to help command line based automation we provide the tool **Device to Cloud Command Line Interface** (**d2ccli**). **d2ccli** provides the shell command ```d2c``` with a wide range of sub-commands to access the Device to Cloud system via the **DMO** API (Device Management Orchestrator).
|
|
3
|
+
</br>
|
|
4
|
+
**d2ccli** has been implemented with **python3** and can be installed using **pip3** or **python3 -m pip** (see [getting started](https://myiot-d.com/docs/device-to-cloud/command-line-interface/getting-started/)).
|
|
5
|
+
</br>
|
|
6
|
+
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> **d2ccli** has been tested only on **MacOS** and **Linux** with **python 3.10** and **python 3.12**.
|
|
9
|
+
|
|
10
|
+
> [!NOTE]
|
|
11
|
+
> Currently the **d2ccli** is not available in the public pypi site. To install the python packages please see "Installation of d2ccli from DT GitLab" below.
|
|
12
|
+
|
|
13
|
+
> [!WARNING]
|
|
14
|
+
> **d2ccli** has **NOT** been tested on Windows yet.
|
|
15
|
+
|
|
16
|
+
- [Getting started with d2ccli](https://myiot-d.com/docs/device-to-cloud/command-line-interface/getting-started/)</br>
|
|
17
|
+
Learn how to install and test the **d2c** command.
|
|
18
|
+
- [d2ccli Basics](https://myiot-d.com/docs/device-to-cloud/command-line-interface/basics/)</br>
|
|
19
|
+
Learn how to use the **d2c** command and get an overview about all the sub-commands.
|
|
20
|
+
- [DMO access profile management](https://myiot-d.com/docs/device-to-cloud/command-line-interface/dmo-access-profiles-management/)</br>
|
|
21
|
+
Learn what DMO access profiles are and how to manage them with **d2c** command.
|
|
22
|
+
- [DMO commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/dmo-commands/)</br>
|
|
23
|
+
Reference documentation for DMO sub-commands of **d2c**.
|
|
24
|
+
- [D2C client domain model](https://myiot-d.com/docs/device-to-cloud/command-line-interface/d2c-client-domain-model/)</br>
|
|
25
|
+
Learn about the client sided D2C domain model and the different command domains.
|
|
26
|
+
- [D2C device management commands](.https://myiot-d.com/docs/device-to-cloud/command-line-interface/device-commands/)</br>
|
|
27
|
+
Reference documentation for D2C device management sub-commands of **d2c**.
|
|
28
|
+
- [D2C application management commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/application-commands/)</br>
|
|
29
|
+
Reference documentation for D2C application management sub-commands of **d2c**.
|
|
30
|
+
- [D2C device group management commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/device-group-commands/)</br>
|
|
31
|
+
Reference documentation for D2C device group management sub-commands of **d2c**.
|
|
32
|
+
- [D2C administration commands](https://myiot-d.com/docs/device-to-cloud/command-line-interface/administration-commands/)</br>
|
|
33
|
+
Reference documentation for D2C administration sub-commands of **d2c**.
|
|
34
|
+
- [d2c command environment and configuration variables](https://myiot-d.com/docs/device-to-cloud/command-line-interface/tips/)</br>
|
|
35
|
+
Reference documentation for environment and configuration variables of **d2c**.
|
|
36
|
+
|
|
37
|
+
## Installation of d2ccli from DT GitLab
|
|
38
|
+
The python package of d2ccli is called **dtiot-d2c**. To install it with pip perform the following commands on a e.g. *bash*.
|
|
39
|
+
```bash
|
|
40
|
+
python3 -m pip install -U dtiot-d2c
|
|
41
|
+
```
|
|
42
|
+
Those commands should install the package *dtiot_d2c* in your local python site-packages. Further more the shell command **d2c** should have been installed in your local *bin* directory.
|
|
43
|
+
On my MacBook the *dtiot_d2c** directory and the **d2c** executable endet up here:
|
|
44
|
+
```bash
|
|
45
|
+
/home/ubuntu/.local/lib/python3.10/site-packages/dtiot_d2c
|
|
46
|
+
/home/ubuntu/.local/bin/d2c
|
|
47
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dtiot_d2c"
|
|
7
|
+
version = "0.9.2"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Roland Baldin", email="roland.baldin@telekom.de" },
|
|
10
|
+
]
|
|
11
|
+
description = "Device to Cloud (D2C) command line interface"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = ["LICEN[CS]E*"]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "http://localhost:1313/docs/device-to-cloud/command-line-interface/about/"
|
|
23
|
+
Issues = "http://localhost:1313/docs/device-to-cloud/command-line-interface/about/"
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
d2c = "dtiot_d2c.cli.main:main"
|
|
27
|
+
|
|
File without changes
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
###
|
|
4
|
+
# Feature flags of the various CLI command interfaces. Those flags are set by
|
|
5
|
+
# the command implementation to tell the controlling modules what the implemenation
|
|
6
|
+
# requires.
|
|
7
|
+
###
|
|
8
|
+
REQUIRES_CONFIG = 1
|
|
9
|
+
REQUIRES_PROFILE = 2
|
|
10
|
+
REQUIRES_DMOAPICONNECT = 4
|
|
11
|
+
|
|
12
|
+
# Names of environment variables, directories and files
|
|
13
|
+
###
|
|
14
|
+
|
|
15
|
+
# Environment variable of the directory which contains the configuration files
|
|
16
|
+
ENVVARNAME_CFGDIR = "D2CCLI_CONFIGDIR"
|
|
17
|
+
|
|
18
|
+
# File which contains the API access configuration
|
|
19
|
+
ENVVARNAME_CFGFILE = "D2CCLI_CONFIGFILE"
|
|
20
|
+
|
|
21
|
+
# Default name of the directory which contains the configuration files
|
|
22
|
+
DEFAULT_CFGDIR_NAME = ".d2c"
|
|
23
|
+
|
|
24
|
+
# Default name of the configuration file
|
|
25
|
+
DEFAULT_CFGFILE_NAME = "config.json"
|
|
26
|
+
|
|
27
|
+
# Name of the profiles sub directory within the configuration directory
|
|
28
|
+
DEFAULT_PROFILES_DIRNAME = "profiles"
|
|
29
|
+
DEFAULT_PROFILES_DIRPATH = "$HOME/%s/%s" % (DEFAULT_CFGDIR_NAME, DEFAULT_PROFILES_DIRNAME)
|
|
30
|
+
|
|
31
|
+
# Profile file extension
|
|
32
|
+
PROFILE_FILE_EXT = "profile"
|
|
33
|
+
|
|
34
|
+
# Configuration element names
|
|
35
|
+
CEN_ACTIVE_PROFILE_FILE = "activeProfileFile"
|
|
36
|
+
CEN_PROFILE_DIR = "profilesDir"
|
|
37
|
+
|
|
38
|
+
# Init configuration
|
|
39
|
+
DEFAULT_CONFIGURATION = {
|
|
40
|
+
"activeProfileFile": "",
|
|
41
|
+
"profilesDir": DEFAULT_PROFILES_DIRPATH
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Profile configuration
|
|
45
|
+
PROFILE_CONFIG = {
|
|
46
|
+
"elements": [
|
|
47
|
+
{"name":"profileName", "label":"Profile Name", "type":"string", "state":"normal", "default":"My Profile"},
|
|
48
|
+
{"name":"apiUrl", "label":"API URL", "type":"string", "state":"normal", "default":"https://qa.spacegate.telekom.de/bond/t-iot-hub/device-management-orchestrator/v3/TENANT-REQUIRED"},
|
|
49
|
+
{"name":"getTokenUrl", "label":"Get Token URL", "type":"string", "state":"normal", "default":"https://qa.spacegate.telekom.de/auth/realms/bond/protocol/openid-connect/token"},
|
|
50
|
+
{"name":"clientId", "label":"Client Id", "type":"string", "state":"normal", "default":"t-iot-hub--##########--########-####-####-####-################"},
|
|
51
|
+
{"name":"clientSecret", "label":"Client Secret", "type":"string", "state":"normal", "default":"########-####-####-####-########"},
|
|
52
|
+
],
|
|
53
|
+
"filenameElements":["profileName", ".profile"]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
D2CCLI_DEFAULT_ORIGIN="d2ccli"
|
|
57
|
+
|
|
58
|
+
###
|
|
59
|
+
# Factory function to create an APIConnection object from profile
|
|
60
|
+
from dtiot_d2c.cli.profile import Profile
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def createApiConnection(profile:Profile)->any:
|
|
64
|
+
from dtiot_d2c.dmo import ApiClient
|
|
65
|
+
apiClient:ApiClient = ApiClient(api_url=profile.getElement("apiUrl"),
|
|
66
|
+
origin=D2CCLI_DEFAULT_ORIGIN,
|
|
67
|
+
get_token_url=profile.getElement("getTokenUrl"),
|
|
68
|
+
client_id=profile.getElement("clientId"),
|
|
69
|
+
client_secret=profile.getElement("clientSecret"))
|
|
70
|
+
|
|
71
|
+
apiClient.auth()
|
|
72
|
+
|
|
73
|
+
return apiClient
|
|
74
|
+
|
|
75
|
+
###
|
|
76
|
+
# Configuration of the profile manager web application and api
|
|
77
|
+
# Profile management web application
|
|
78
|
+
#PMWEBAPP_PORT=3000
|
|
79
|
+
# PMWEBAPP_PATH="/profile-manager"
|
|
80
|
+
|
|
81
|
+
# Profile management API
|
|
82
|
+
#from .prfmanapi.configs import DEFAULT as PMAPI_CFG
|
|
83
|
+
#PMAPI_PROTOCOL="http"
|
|
84
|
+
#PMAPI_HOST="127.0.0.1"
|
|
85
|
+
#PMAPI_PORT=PMAPI_CFG.ServicePort
|
|
86
|
+
#PMAPI_PATH=PMAPI_CFG.ServiceName
|
|
87
|
+
|
|
88
|
+
###
|
|
89
|
+
# Registration of cli commands ...
|
|
90
|
+
CLICommands = [
|
|
91
|
+
{
|
|
92
|
+
"name": "CONFIGURATION",
|
|
93
|
+
"help": "Confguration commands",
|
|
94
|
+
"commands": [
|
|
95
|
+
{
|
|
96
|
+
"name": ["create-configuration", "cc"],
|
|
97
|
+
"cmdFile": "%s/configCLI.py" % (os.path.dirname(__file__)),
|
|
98
|
+
"cmdClass": "CreateConfigurationCLI"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "PROFILE",
|
|
104
|
+
"help": "Profile commands",
|
|
105
|
+
"commands": [
|
|
106
|
+
{
|
|
107
|
+
"name": ["list-profiles", "lp"],
|
|
108
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
109
|
+
"cmdClass": "ListProfilesCLI"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": ["print-profile", "pp"],
|
|
113
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
114
|
+
"cmdClass": "PrintProfileCLI"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": ["add-profile", "ap"],
|
|
118
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
119
|
+
"cmdClass": "NewProfileCLI"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": ["modify-profile", "mp"],
|
|
123
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
124
|
+
"cmdClass": "EditProfileCLI"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": ["activate-profile", "acp"],
|
|
128
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
129
|
+
"cmdClass": "ActivateProfileCLI"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": ["print-active-profile", "pap"],
|
|
133
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
134
|
+
"cmdClass": "PrintActivatedProfileCLI"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": ["profile-manager", "pm"],
|
|
138
|
+
"cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
139
|
+
"cmdClass": "StartProfileManagerGuiCLI"
|
|
140
|
+
},
|
|
141
|
+
# {
|
|
142
|
+
# "name": ["profile-manager-webapp", "pm2"],
|
|
143
|
+
# "cmdFile": "%s/profileCLI.py" % (os.path.dirname(__file__)),
|
|
144
|
+
# "cmdClass": "StartProfileManagerWebBrowserCLI"
|
|
145
|
+
# }
|
|
146
|
+
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "DMO",
|
|
151
|
+
"help": "DMO functions",
|
|
152
|
+
"commands": [
|
|
153
|
+
{
|
|
154
|
+
"name": ["get-resources", "gr"],
|
|
155
|
+
"cmdFile": "%s/../dmo/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
156
|
+
"cmdClass": "GetResourcesCLI"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": ["add-resource", "ar"],
|
|
160
|
+
"cmdFile": "%s/../dmo/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
161
|
+
"cmdClass": "AddResourceCLI"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": ["update-resource", "ar"],
|
|
165
|
+
"cmdFile": "%s/../dmo/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
166
|
+
"cmdClass": "UpdateResourceCLI"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": ["delete-resource", "dr"],
|
|
170
|
+
"cmdFile": "%s/../dmo/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
171
|
+
"cmdClass": "DeleteResourceCLI"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": ["get-device-provisioning-requests", "gdpreq"],
|
|
175
|
+
"cmdFile": "%s/../dmo/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
176
|
+
"cmdClass": "GetDeviceProvisioningRequestsCLI"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": ["get-device-provisioning-responses", "gdpres"],
|
|
180
|
+
"cmdFile": "%s/../dmo/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
181
|
+
"cmdClass": "GetDeviceProvisioningResponsesCLI"
|
|
182
|
+
},
|
|
183
|
+
# {
|
|
184
|
+
# {
|
|
185
|
+
# "name": ["update-resource", "ur"],
|
|
186
|
+
# "cmdFile": "%s/../iothubcli/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
187
|
+
# "cmdClass": "UpdateResourceCLI"
|
|
188
|
+
# },
|
|
189
|
+
# {
|
|
190
|
+
# "name": ["add-message-container", "amsgc"],
|
|
191
|
+
# "cmdFile": "%s/../iothubcli/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
192
|
+
# "cmdClass": "AddMessageContainerCLI"
|
|
193
|
+
# },
|
|
194
|
+
# {
|
|
195
|
+
# "name": ["add-subscription", "asub"],
|
|
196
|
+
# "cmdFile": "%s/../iothubcli/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
197
|
+
# "cmdClass": "AddSubscriptionCLI"
|
|
198
|
+
# },
|
|
199
|
+
# {
|
|
200
|
+
# "name": ["post-message", "pmsg"],
|
|
201
|
+
# "cmdFile": "%s/../iothubcli/dmoCLI.py" % (os.path.dirname(__file__)),
|
|
202
|
+
# "cmdClass": "PostMessageToContainerCLI"
|
|
203
|
+
# },
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
# Devices
|
|
207
|
+
{
|
|
208
|
+
"name": "D2C Device Management",
|
|
209
|
+
"help": "D2C functions to manage devices",
|
|
210
|
+
"commands": [
|
|
211
|
+
|
|
212
|
+
{
|
|
213
|
+
"name": ["add-device", "ad"],
|
|
214
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
215
|
+
"cmdClass": "AddDeviceCLI"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": ["add-lwm2m-device", "alwm2md"],
|
|
219
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
220
|
+
"cmdClass": "AddLwm2mDeviceCLI"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": ["get-devices", "gd"],
|
|
224
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
225
|
+
"cmdClass": "GetDevicesCLI"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": ["update-device", "ud"],
|
|
229
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
230
|
+
"cmdClass": "UpdateDeviceCLI"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": ["delete-device", "dd"],
|
|
234
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
235
|
+
"cmdClass": "DeleteDeviceCLI"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": ["inject-uplink-message", "ium"],
|
|
239
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
240
|
+
"cmdClass": "InjectUplinkMessageCLI"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": ["inject-downlink-message", "idm"],
|
|
244
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
245
|
+
"cmdClass": "InjectDownlinkMessageCLI"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": ["get-device-messages", "gdms"],
|
|
249
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
250
|
+
"cmdClass": "GetDeviceMessagesCLI"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": ["delete-device-message", "ddm"],
|
|
254
|
+
"cmdFile": "%s/../d2c/device/cli.py" % (os.path.dirname(__file__)),
|
|
255
|
+
"cmdClass": "DeleteDeviceMessageCLI"
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
# Applications
|
|
261
|
+
{
|
|
262
|
+
"name": "D2C Application Management",
|
|
263
|
+
"help": "D2C functions to manage applications",
|
|
264
|
+
"commands": [
|
|
265
|
+
{
|
|
266
|
+
"name": ["add-application", "aa"],
|
|
267
|
+
"cmdFile": "%s/../d2c/application/cli.py" % (os.path.dirname(__file__)),
|
|
268
|
+
"cmdClass": "AddApplicationCLI"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": ["get-applications", "ga"],
|
|
272
|
+
"cmdFile": "%s/../d2c/application/cli.py" % (os.path.dirname(__file__)),
|
|
273
|
+
"cmdClass": "GetApplicationsCLI"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"name": ["update-application", "ua"],
|
|
277
|
+
"cmdFile": "%s/../d2c/application/cli.py" % (os.path.dirname(__file__)),
|
|
278
|
+
"cmdClass": "UpdateApplicationCLI"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": ["delete-application", "da"],
|
|
282
|
+
"cmdFile": "%s/../d2c/application/cli.py" % (os.path.dirname(__file__)),
|
|
283
|
+
"cmdClass": "DeleteApplicationCLI"
|
|
284
|
+
},
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
### Device Groups
|
|
288
|
+
{
|
|
289
|
+
"name": "D2C Device Group Management",
|
|
290
|
+
"help": "D2C functions to manage device groups",
|
|
291
|
+
"commands": [
|
|
292
|
+
{
|
|
293
|
+
"name": ["add-device-group", "adg"],
|
|
294
|
+
"cmdFile": "%s/../d2c/device_group/cli.py" % (os.path.dirname(__file__)),
|
|
295
|
+
"cmdClass": "AddDeviceGroupCLI"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"name": ["get-device-groups", "gdg"],
|
|
299
|
+
"cmdFile": "%s/../d2c/device_group/cli.py" % (os.path.dirname(__file__)),
|
|
300
|
+
"cmdClass": "GetDeviceGroupsCLI"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": ["update-device-group", "udg"],
|
|
304
|
+
"cmdFile": "%s/../d2c/device_group/cli.py" % (os.path.dirname(__file__)),
|
|
305
|
+
"cmdClass": "UpdateDeviceGroupCLI"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": ["delete-device-group", "ddg"],
|
|
309
|
+
"cmdFile": "%s/../d2c/device_group/cli.py" % (os.path.dirname(__file__)),
|
|
310
|
+
"cmdClass": "DeleteDeviceGroupCLI"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": ["device-group-update-devices", "dguds"],
|
|
314
|
+
"cmdFile": "%s/../d2c/device_group/cli.py" % (os.path.dirname(__file__)),
|
|
315
|
+
"cmdClass": "ModifyDevicesCLI"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": ["device-group-update-applications", "dguas"],
|
|
319
|
+
"cmdFile": "%s/../d2c/device_group/cli.py" % (os.path.dirname(__file__)),
|
|
320
|
+
"cmdClass": "ModifyApplicationsCLI"
|
|
321
|
+
},
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
# Admin
|
|
325
|
+
{
|
|
326
|
+
"name": "D2C Admin",
|
|
327
|
+
"help": "D2C admin functions",
|
|
328
|
+
"commands": [
|
|
329
|
+
{
|
|
330
|
+
"name": ["add-d2ccli-application"],
|
|
331
|
+
"cmdFile": "%s/../d2c/application/cli.py" % (os.path.dirname(__file__)),
|
|
332
|
+
"cmdClass": "AddC2cCliApplicationCLI"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": ["version"],
|
|
336
|
+
"cmdFile": "%s/../d2c/commands/version.py" % (os.path.dirname(__file__)),
|
|
337
|
+
"cmdClass": "VersionCLI"
|
|
338
|
+
},
|
|
339
|
+
]
|
|
340
|
+
},
|
|
341
|
+
# Test
|
|
342
|
+
{
|
|
343
|
+
"name": "Tests",
|
|
344
|
+
"help": "Test functions",
|
|
345
|
+
"envVars":["D2CCLI_TEST"],
|
|
346
|
+
"commands": [
|
|
347
|
+
{
|
|
348
|
+
"name": ["verify-d2c-model"],
|
|
349
|
+
"cmdFile": "%s/../d2c/test/verify_d2c_model.py" % (os.path.dirname(__file__)),
|
|
350
|
+
"cmdClass": "VerifyD2CModelCLI"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": ["get-sample-configuration-file"],
|
|
354
|
+
"cmdFile": "%s/../d2c/test/print_sample_test_configuration.py" % (os.path.dirname(__file__)),
|
|
355
|
+
"cmdClass": "PrintSampleTestConfigurationCLI"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"name": ["test-application-00"],
|
|
359
|
+
"cmdFile": "%s/../d2c/test/application.py" % (os.path.dirname(__file__)),
|
|
360
|
+
"cmdClass": "FunctionalTest_Application00CLI"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"name": ["test-application-01"],
|
|
364
|
+
"cmdFile": "%s/../d2c/test/application.py" % (os.path.dirname(__file__)),
|
|
365
|
+
"cmdClass": "FunctionalTest_Application01CLI"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"name": ["test-device-00"],
|
|
369
|
+
"cmdFile": "%s/../d2c/test/device.py" % (os.path.dirname(__file__)),
|
|
370
|
+
"cmdClass": "Tests00_CLI"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"name": ["test-device-01"],
|
|
374
|
+
"cmdFile": "%s/../d2c/test/device.py" % (os.path.dirname(__file__)),
|
|
375
|
+
"cmdClass": "Tests01_CLI"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"name": ["test-device-group-01"],
|
|
379
|
+
"cmdFile": "%s/../d2c/test/device_group.py" % (os.path.dirname(__file__)),
|
|
380
|
+
"cmdClass": "Tests01_CLI"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"name": ["test-device-group-02"],
|
|
384
|
+
"cmdFile": "%s/../d2c/test/device_group.py" % (os.path.dirname(__file__)),
|
|
385
|
+
"cmdClass": "Tests02_CLI"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": ["device-group-test-03"],
|
|
389
|
+
"cmdFile": "%s/../d2c/test/device_group.py" % (os.path.dirname(__file__)),
|
|
390
|
+
"cmdClass": "Tests03_CLI"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": ["test-device-group-04"],
|
|
394
|
+
"cmdFile": "%s/../d2c/test/device_group.py" % (os.path.dirname(__file__)),
|
|
395
|
+
"cmdClass": "Tests04_CLI"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"name": ["verify-device-group-consistency"],
|
|
399
|
+
"cmdFile": "%s/../d2c/test/verify_device_group_consistency.py" % (os.path.dirname(__file__)),
|
|
400
|
+
"cmdClass": "VerifyDeviceGroupConsistencyCLI"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"name": ["get-resource-performance-test"],
|
|
404
|
+
"cmdFile": "%s/../d2c/test/perftest_get_resource.py" % (os.path.dirname(__file__)),
|
|
405
|
+
"cmdClass": "PerformanceTest_GetResourceCLI"
|
|
406
|
+
},
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
]
|