isbetmf is a TM Forum (TMF) Open API server written in Go. It is designed to be highly flexible and compliant with TMF standards.
- Dual Operation Modes:
- Standalone Server: Implements TMF Open API specifications using a local SQLite database.
- Proxy Server: Acts as a gateway in front of a remote TMF API server.
- Policy Enforcement: Acts as a Policy Enforcement Point (PEP) and Policy Decision Point (PDP), enforcing authentication and fine-grained authorization using Starlark scripts.
- Reporting & Validation: Includes a dedicated tool (
tmf-reporting) for validating TMF API implementations and generating compliance reports. - Replication: Supports data replication capabilities (see
replicatedirectory). - Conformance: Passes the official TMF Conformance Test Kit for TMF V4 and V5 APIs.
- Zero-Downtime Updates: Uses
tableflipfor graceful restarts and upgrades.
- Go 1.21 or higher
- Docker (optional, for containerized deployment)
- Make (optional, for build automation)
To run the server locally for development:
-
Clone the repository:
git clone https://github.com/hesusruiz/isbetmf.git cd isbetmf -
Run with default configuration:
go run main.go -run mycredential
Or using Make:
make run
This starts the server using the
mycredentialprofile (configured inconfig/config_data.go), which typically uses a local SQLite database. -
Build the binaries:
make build # Builds the server (bin/isbetmf) make build-reporting # Builds the reporting tool (bin/tmf-reporting)
-
Run Tests:
make test
The application is designed to be containerized.
-
Build the container:
docker build -t isbetmf . -
Run the container: The container requires the
ISBETMF_RUN_ENVIRONMENTenvironment variable to select the configuration profile.docker run -e ISBETMF_RUN_ENVIRONMENT=isbedev -p 9991:9991 isbetmf
Possible values for
ISBETMF_RUN_ENVIRONMENT:isbedev,isbepre,isbepro,domedev,domepre,domepro.
Configuration is managed via profiles defined in config/config_data.go. This approach reduces configuration errors by grouping settings into well-defined environments.
To add or modify a profile, edit config/config_data.go. You can specify the profile to use at runtime with the -run flag:
./bin/isbetmf -run <profile_name>Authorization rules are defined in Starlark scripts (e.g., auth_policies.star). This allows for dynamic and complex permission logic without recompiling the server. The PDP evaluates these rules for every request to determine access.
The project follows a clean, layered architecture:
- Entrypoint (
main.go): Handles initialization, config loading, and graceful restarts. - Handler Layer (
tmfserver/handler/fiber): Manages HTTP requests using Fiber, translating them into transport-agnostic service requests. Handles generic TMF routing. - Service Layer (
tmfserver/service): Contains the core business logic, decoupled from HTTP. Handles authentication, authorization (via PDP), and orchestration. - Repository Layer (
tmfserver/repository): Abstracts database interactions (SQLite). - Policy Engine (
pdp): Executes Starlark rules for authorization.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
Please ensure you run tests (make test) and lint your code (make lint) before submitting.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.