Skip to main content

Smart TMForum Open API mock server with domain-aware seed data, cross-API referential integrity, and lifecycle state machine enforcement

Project description

tmf-mock

Smart TMForum Open API mock server with domain-aware seed data and cross-API referential integrity.

Part of the TMF DevKit project — https://github.com/manojchavan23/tmf-devkit


Generic OpenAPI mock tools (Prism, WireMock) return random strings where you need DSLAM port IDs, random numbers where you need VDSL2 SNR margins, and have zero awareness that a ServiceOrder must reference a valid Service which must reference a valid Resource. tmf-mock fixes that.

Supported APIs (v0.1)

API Name Base Path
TMF638 Service Inventory Management /tmf-api/serviceInventoryManagement/v4/service
TMF639 Resource Inventory Management /tmf-api/resourceInventoryManagement/v4/resource
TMF641 Service Ordering Management /tmf-api/serviceOrdering/v4/serviceOrder

Quickstart

pip install -e ".[dev]"
tmf-mock start

Open http://localhost:8000/docs

CLI

tmf-mock start                          # all 3 APIs, port 8000, with seed data
tmf-mock start --apis 638,639           # only Resource + Service Inventory
tmf-mock start --port 9000              # custom port
tmf-mock start --no-seed                # empty store
tmf-mock start --reload                 # dev mode with auto-reload

Key Endpoints

GET/POST        /tmf-api/resourceInventoryManagement/v4/resource
GET/PATCH/DELETE /tmf-api/resourceInventoryManagement/v4/resource/{id}

GET/POST        /tmf-api/serviceInventoryManagement/v4/service
GET/PATCH/DELETE /tmf-api/serviceInventoryManagement/v4/service/{id}

GET/POST        /tmf-api/serviceOrdering/v4/serviceOrder
GET/PATCH/DELETE /tmf-api/serviceOrdering/v4/serviceOrder/{id}

GET  /health
POST /admin/reset
GET  /docs

Query Parameters (TMForum standard)

All list endpoints support: ?offset=0&limit=20&fields=id,name&resourceStatus=available&category=Physical

Response headers: X-Total-Count, X-Result-Count

Referential Integrity

ServiceOrder (TMF641)
    └── orderItem[].service → Service (TMF638)
                                  └── supportingResource[] → Resource (TMF639)
  • DELETE /resource/{id} → 409 if any Service references it
  • POST /service with unknown supportingResource → 422
  • POST /serviceOrder with action=modify/delete on unknown service → 422

Running Tests

pytest -v

Docker

docker build -t tmf-mock .
docker run -p 8000:8000 tmf-mock

# or
docker compose up

Author

Manoj Chavan — https://linkedin.com/in/manojchavan23

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tmf_mock-0.1.1.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmf_mock-0.1.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file tmf_mock-0.1.1.tar.gz.

File metadata

  • Download URL: tmf_mock-0.1.1.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for tmf_mock-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d7e5572b8064fb28bdeb98f35da74b4ac890f413c93820910513c4d726326085
MD5 c96ac7a07890ca0e81e502ba4eb6c8b6
BLAKE2b-256 22d4240dbed5708e2375affff1cebcab7fd6fbbb27278f62d57e4519063461f7

See more details on using hashes here.

File details

Details for the file tmf_mock-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tmf_mock-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for tmf_mock-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e6aa4a4c515f6e3dead1620f0042dcebb796013e6b0263c3ad4665e1fa60d20
MD5 52c4845d666f894ab85c3801e7e73529
BLAKE2b-256 398cbf81e13f1356d8aec96ba87e5b9324dad8263863f8772a980fd0ea412798

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page