tmforum 0.1.0__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.
- tmforum-0.1.0/.gitignore +229 -0
- tmforum-0.1.0/LICENSE +21 -0
- tmforum-0.1.0/PKG-INFO +130 -0
- tmforum-0.1.0/README.md +101 -0
- tmforum-0.1.0/pyproject.toml +44 -0
- tmforum-0.1.0/src/tmforum/__init__.py +4702 -0
- tmforum-0.1.0/src/tmforum/_helpers.py +29 -0
- tmforum-0.1.0/tests/test_product.py +1539 -0
tmforum-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
# OS generated files #
|
|
221
|
+
.DS_Store
|
|
222
|
+
.DS_Store?
|
|
223
|
+
._*
|
|
224
|
+
.Spotlight-V100
|
|
225
|
+
.Trashes
|
|
226
|
+
ehthumbs.db
|
|
227
|
+
Thumbs.db
|
|
228
|
+
# Claude Code local settings
|
|
229
|
+
.claude/
|
tmforum-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alex Chadyuk
|
|
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.
|
tmforum-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tmforum
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial Python SDK for TM Forum Open APIs: dataclass entity models with @type-aware serialization and REST CRUD helpers
|
|
5
|
+
Project-URL: Homepage, https://github.com/alex-chadyuk/tmforum
|
|
6
|
+
Project-URL: Issues, https://github.com/alex-chadyuk/tmforum/issues
|
|
7
|
+
Author-email: Alex Chadyuk <alex@chady.uk>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: bss,oda,open-api,product-catalog,product-ordering,telecom,tmf,tmforum
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Telecommunications Industry
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: requests>=2.25
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: build; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
27
|
+
Requires-Dist: twine; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# tmforum
|
|
31
|
+
|
|
32
|
+
Unofficial Python SDK for [TM Forum Open APIs](https://www.tmforum.org/oda/open-apis/) — plain-dataclass entity models, `@type`-aware (de)serialization, and thin REST CRUD helpers.
|
|
33
|
+
|
|
34
|
+
- **No heavy dependencies** — just `requests`. Entities are standard-library `dataclasses`, not pydantic models.
|
|
35
|
+
- **Polymorphism-aware serialization** — `from_dict` resolves `@type` / `@referredType` discriminators to the right Python class; `to_dict` emits them back, so round-tripping TMF payloads preserves their type structure.
|
|
36
|
+
- **Thin CRUD layer** — `create` / `read` / `update` / `delete` / `query_get` methods that map 1:1 onto the TMF REST conventions. No hidden state, no client object: a small `Context` carries the base URL, auth, and headers.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install tmforum
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Python 3.9+.
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from tmforum import Context, Individual, ProductOffering
|
|
50
|
+
|
|
51
|
+
context = Context(
|
|
52
|
+
api_base_url="https://api.example.com/tmf-api",
|
|
53
|
+
access_token="...",
|
|
54
|
+
currency_code="USD",
|
|
55
|
+
)
|
|
56
|
+
context.headers = {
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
"Accept": "application/json",
|
|
59
|
+
"Authorization": f"Bearer {context.access_token}",
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Create, read, query, delete — TMF632 Party Management
|
|
63
|
+
person = Individual(givenName="Jane", familyName="Doe")
|
|
64
|
+
person = person.create(context) # POST /partyManagement/v5/individual
|
|
65
|
+
person = person.read(context) # GET /partyManagement/v5/individual/{id}
|
|
66
|
+
|
|
67
|
+
# TMF620 Product Catalog
|
|
68
|
+
offers = ProductOffering.query_get("lifecycleStatus=Active", context)
|
|
69
|
+
|
|
70
|
+
person.delete(context) # DELETE /partyManagement/v5/individual/{id}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Serialization works without a server:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from tmforum import Product
|
|
77
|
+
|
|
78
|
+
product = Product.from_dict({
|
|
79
|
+
"@type": "Product",
|
|
80
|
+
"id": "42",
|
|
81
|
+
"name": "Fibre 500",
|
|
82
|
+
"status": "active",
|
|
83
|
+
"billingAccount": {"@type": "BillingAccountRef", "id": "ba-1"},
|
|
84
|
+
"isBundle": False,
|
|
85
|
+
"quantity": 1,
|
|
86
|
+
"productPrice": [],
|
|
87
|
+
})
|
|
88
|
+
assert product.billingAccount.id == "ba-1"
|
|
89
|
+
payload = product.to_dict() # emits @type discriminators back
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Supported TM Forum APIs
|
|
93
|
+
|
|
94
|
+
The SDK targets the **v5** payload shapes of the Open APIs.
|
|
95
|
+
|
|
96
|
+
| TMF API | Resource path | Main SDK classes |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| TMF620 Product Catalog | `productCatalogManagement/v5` | `ProductCatalog`, `Category`, `ProductOffering`, `ProductSpecification` |
|
|
99
|
+
| TMF622 Product Ordering | `productOrdering/v5` | `ProductOrder` |
|
|
100
|
+
| TMF637 Product Inventory | `productInventory/v5` | `Product` |
|
|
101
|
+
| TMF632 Party Management | `partyManagement/v5` | `Individual`, `Organization` |
|
|
102
|
+
| TMF669 Party Role | `partyRoleManagement/v5` | `PartyRole` |
|
|
103
|
+
| TMF666 Account Management | `accountManagement/v5` | `BillingAccount`, `FinancialAccount`, `BillingCycleSpecification` |
|
|
104
|
+
| TMF678 Customer Bill | `customerBill/v5` | `AppliedCustomerBillingRate` |
|
|
105
|
+
| TMF648 Quote | `quoteManagement/v5` | `Quote` |
|
|
106
|
+
| TMF679 Product Offering Qualification | `productOfferingQualification/v5` | `CheckProductOfferingQualification`, `QueryProductOfferingQualification` |
|
|
107
|
+
| TMF699 Sales Management | `salesManagement/v4` | `SalesLead` |
|
|
108
|
+
| TMF723 Policy Management | `policyManagement/v5` | `PolicyDomain`, `ManagedPolicy`, `ManagedPolicyVariable`, `PolicyCatalog` |
|
|
109
|
+
| TMF638 Service Inventory | `serviceInventory/v5` | `Service` |
|
|
110
|
+
| TMF639 Resource Inventory | `resourceInventory/v5` | `Resource` |
|
|
111
|
+
| TMF634 Resource Catalog | `resourceCatalog/v5` | `ResourceSpecification` |
|
|
112
|
+
| TMF685 Resource Pool | `resourcePool/v5` | `ResourcePool`, `ResourcePoolSpecification`, `CapacitySpecification` |
|
|
113
|
+
| TMF676 Payment | `payment/v4` | `PaymentPlan` |
|
|
114
|
+
| TMF760 Product Configuration | *(entity models only)* | `CheckProductConfiguration.from_order()` |
|
|
115
|
+
|
|
116
|
+
## How it works
|
|
117
|
+
|
|
118
|
+
Every entity is a `@dataclass` inheriting from `Entity`, which provides recursive `from_dict` / `to_dict` / `to_json`. Type resolution uses each field's type hints plus the payload's `@type` discriminator, so nested and polymorphic structures (e.g. `RelatedPartyRefOrPartyRoleRef`, price alterations, characteristic subtypes) deserialize into the correct classes.
|
|
119
|
+
|
|
120
|
+
Entities that map to REST resources also inherit `BaseCRUDMixin`, which implements `from_id`, `create`, `read`, `update` (JSON PATCH semantics), `query_get`, and `delete` against `{context.api_base_url}/{resource_path}`. A `Context` dataclass carries `api_base_url`, `access_token`, `headers`, an optional logger, and OAuth-related fields — pass it to every call; there is no global state.
|
|
121
|
+
|
|
122
|
+
## Status
|
|
123
|
+
|
|
124
|
+
Alpha. The entity models and serialization are exercised by a pure-offline test suite; the CRUD layer follows the TMF REST conventions, but server implementations vary in the extensions and versions they accept. Issues and PRs welcome.
|
|
125
|
+
|
|
126
|
+
## License & trademark notice
|
|
127
|
+
|
|
128
|
+
MIT — see [LICENSE](LICENSE).
|
|
129
|
+
|
|
130
|
+
This is an **unofficial, community project**. TM Forum® and the TMF API names are trademarks of TM Forum. This project is not affiliated with, endorsed, or sponsored by TM Forum. The Open API specifications referenced are © TM Forum.
|
tmforum-0.1.0/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# tmforum
|
|
2
|
+
|
|
3
|
+
Unofficial Python SDK for [TM Forum Open APIs](https://www.tmforum.org/oda/open-apis/) — plain-dataclass entity models, `@type`-aware (de)serialization, and thin REST CRUD helpers.
|
|
4
|
+
|
|
5
|
+
- **No heavy dependencies** — just `requests`. Entities are standard-library `dataclasses`, not pydantic models.
|
|
6
|
+
- **Polymorphism-aware serialization** — `from_dict` resolves `@type` / `@referredType` discriminators to the right Python class; `to_dict` emits them back, so round-tripping TMF payloads preserves their type structure.
|
|
7
|
+
- **Thin CRUD layer** — `create` / `read` / `update` / `delete` / `query_get` methods that map 1:1 onto the TMF REST conventions. No hidden state, no client object: a small `Context` carries the base URL, auth, and headers.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install tmforum
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Python 3.9+.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from tmforum import Context, Individual, ProductOffering
|
|
21
|
+
|
|
22
|
+
context = Context(
|
|
23
|
+
api_base_url="https://api.example.com/tmf-api",
|
|
24
|
+
access_token="...",
|
|
25
|
+
currency_code="USD",
|
|
26
|
+
)
|
|
27
|
+
context.headers = {
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
"Accept": "application/json",
|
|
30
|
+
"Authorization": f"Bearer {context.access_token}",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Create, read, query, delete — TMF632 Party Management
|
|
34
|
+
person = Individual(givenName="Jane", familyName="Doe")
|
|
35
|
+
person = person.create(context) # POST /partyManagement/v5/individual
|
|
36
|
+
person = person.read(context) # GET /partyManagement/v5/individual/{id}
|
|
37
|
+
|
|
38
|
+
# TMF620 Product Catalog
|
|
39
|
+
offers = ProductOffering.query_get("lifecycleStatus=Active", context)
|
|
40
|
+
|
|
41
|
+
person.delete(context) # DELETE /partyManagement/v5/individual/{id}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Serialization works without a server:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from tmforum import Product
|
|
48
|
+
|
|
49
|
+
product = Product.from_dict({
|
|
50
|
+
"@type": "Product",
|
|
51
|
+
"id": "42",
|
|
52
|
+
"name": "Fibre 500",
|
|
53
|
+
"status": "active",
|
|
54
|
+
"billingAccount": {"@type": "BillingAccountRef", "id": "ba-1"},
|
|
55
|
+
"isBundle": False,
|
|
56
|
+
"quantity": 1,
|
|
57
|
+
"productPrice": [],
|
|
58
|
+
})
|
|
59
|
+
assert product.billingAccount.id == "ba-1"
|
|
60
|
+
payload = product.to_dict() # emits @type discriminators back
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Supported TM Forum APIs
|
|
64
|
+
|
|
65
|
+
The SDK targets the **v5** payload shapes of the Open APIs.
|
|
66
|
+
|
|
67
|
+
| TMF API | Resource path | Main SDK classes |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| TMF620 Product Catalog | `productCatalogManagement/v5` | `ProductCatalog`, `Category`, `ProductOffering`, `ProductSpecification` |
|
|
70
|
+
| TMF622 Product Ordering | `productOrdering/v5` | `ProductOrder` |
|
|
71
|
+
| TMF637 Product Inventory | `productInventory/v5` | `Product` |
|
|
72
|
+
| TMF632 Party Management | `partyManagement/v5` | `Individual`, `Organization` |
|
|
73
|
+
| TMF669 Party Role | `partyRoleManagement/v5` | `PartyRole` |
|
|
74
|
+
| TMF666 Account Management | `accountManagement/v5` | `BillingAccount`, `FinancialAccount`, `BillingCycleSpecification` |
|
|
75
|
+
| TMF678 Customer Bill | `customerBill/v5` | `AppliedCustomerBillingRate` |
|
|
76
|
+
| TMF648 Quote | `quoteManagement/v5` | `Quote` |
|
|
77
|
+
| TMF679 Product Offering Qualification | `productOfferingQualification/v5` | `CheckProductOfferingQualification`, `QueryProductOfferingQualification` |
|
|
78
|
+
| TMF699 Sales Management | `salesManagement/v4` | `SalesLead` |
|
|
79
|
+
| TMF723 Policy Management | `policyManagement/v5` | `PolicyDomain`, `ManagedPolicy`, `ManagedPolicyVariable`, `PolicyCatalog` |
|
|
80
|
+
| TMF638 Service Inventory | `serviceInventory/v5` | `Service` |
|
|
81
|
+
| TMF639 Resource Inventory | `resourceInventory/v5` | `Resource` |
|
|
82
|
+
| TMF634 Resource Catalog | `resourceCatalog/v5` | `ResourceSpecification` |
|
|
83
|
+
| TMF685 Resource Pool | `resourcePool/v5` | `ResourcePool`, `ResourcePoolSpecification`, `CapacitySpecification` |
|
|
84
|
+
| TMF676 Payment | `payment/v4` | `PaymentPlan` |
|
|
85
|
+
| TMF760 Product Configuration | *(entity models only)* | `CheckProductConfiguration.from_order()` |
|
|
86
|
+
|
|
87
|
+
## How it works
|
|
88
|
+
|
|
89
|
+
Every entity is a `@dataclass` inheriting from `Entity`, which provides recursive `from_dict` / `to_dict` / `to_json`. Type resolution uses each field's type hints plus the payload's `@type` discriminator, so nested and polymorphic structures (e.g. `RelatedPartyRefOrPartyRoleRef`, price alterations, characteristic subtypes) deserialize into the correct classes.
|
|
90
|
+
|
|
91
|
+
Entities that map to REST resources also inherit `BaseCRUDMixin`, which implements `from_id`, `create`, `read`, `update` (JSON PATCH semantics), `query_get`, and `delete` against `{context.api_base_url}/{resource_path}`. A `Context` dataclass carries `api_base_url`, `access_token`, `headers`, an optional logger, and OAuth-related fields — pass it to every call; there is no global state.
|
|
92
|
+
|
|
93
|
+
## Status
|
|
94
|
+
|
|
95
|
+
Alpha. The entity models and serialization are exercised by a pure-offline test suite; the CRUD layer follows the TMF REST conventions, but server implementations vary in the extensions and versions they accept. Issues and PRs welcome.
|
|
96
|
+
|
|
97
|
+
## License & trademark notice
|
|
98
|
+
|
|
99
|
+
MIT — see [LICENSE](LICENSE).
|
|
100
|
+
|
|
101
|
+
This is an **unofficial, community project**. TM Forum® and the TMF API names are trademarks of TM Forum. This project is not affiliated with, endorsed, or sponsored by TM Forum. The Open API specifications referenced are © TM Forum.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tmforum"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Unofficial Python SDK for TM Forum Open APIs: dataclass entity models with @type-aware serialization and REST CRUD helpers"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Alex Chadyuk", email = "alex@chady.uk" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"tmforum",
|
|
16
|
+
"tmf",
|
|
17
|
+
"oda",
|
|
18
|
+
"open-api",
|
|
19
|
+
"bss",
|
|
20
|
+
"telecom",
|
|
21
|
+
"product-catalog",
|
|
22
|
+
"product-ordering",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"Intended Audience :: Telecommunications Industry",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.9",
|
|
31
|
+
"Programming Language :: Python :: 3.10",
|
|
32
|
+
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
34
|
+
"Programming Language :: Python :: 3.13",
|
|
35
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
36
|
+
]
|
|
37
|
+
dependencies = ["requests>=2.25"]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/alex-chadyuk/tmforum"
|
|
41
|
+
Issues = "https://github.com/alex-chadyuk/tmforum/issues"
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
dev = ["pytest>=7", "build", "twine"]
|