Skip to content

About

OOPT PSE Repo

Resources

Stars

2 stars

Watchers

14 watching

Forks

Latest commit

 

History

28 Commits

Folders and files

Repository files navigation

GNPy API

Install via pip Python versions Gerrit

FastAPI service

This repository extends GNPy with a FastAPI-based HTTP service, allowing more flexible control and interaction with its simulation engine. The service can be used to integrate GNPy into software-defined networking (SDN) architectures or other external applications.

GNPy is an open-source Python-based library that models and evaluates the performance of optical networks. It is widely used for path computation, QoT (Quality of Transmission) estimation, and network planning.

🚀 Installation

Build from Source - Option 1

Clone the repository and install the package:

python3 setup.py install

or if you want to install it in a docker container:

docker build ./ -t gnpy-api

PyPI - Option 2

pip install gnpy-api

Quick Start

🧪 Usage - CLI

Start the FastAPI server:

python ./samples/rest_example.py

OpenAPI docs are available at http://localhost:8080/docs.

Send example data to the API:

curl --location 'http://localhost:8080/api/v1.0/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json

The example server runs over HTTP. Use a reverse proxy or uvicorn TLS settings for HTTPS.

🧪 Usage - Docker

docker run --rm -p 8080:8080 gnpy-api

🔄 Compatibility

Different versions of this interface extension are compatible with specific versions of GNPy. Please refer to the table below to ensure that you are using a supported version combination.

Interface Version Compatible GNPy Version Notes
v1.0.x 2.14 FastAPI service, OpenAPI support
v0.2.x 2.14 YANG model validation
v0.1.x >=2.12.1 Initial release

⚠️ If you use an incompatible combination, some features may not work correctly or may produce unexpected errors.

To check your GNPy version, run:

pip show gnpy

📚 Documentation

Refer to the official GNPy documentation for information about network modeling and simulation capabilities.

API documentation is available in the docs folder.

About

OOPT PSE Repo

Resources

Stars

2 stars

Watchers

14 watching

Forks

Releases

Packages

Used by

Contributors

Languages