Metadata-Version: 2.4
Name: gnpy-api
Version: 1.0.0
Home-page: https://github.com/Telecominfraproject/oopt-gnpy-api
Author: Telecom Infra Project
Author-email: adamico@nec-labs.com
License: BSD-3-Clause
Project-URL: Bug Tracker, https://github.com/Telecominfraproject/oopt-gnpy-api/issues
Project-URL: Documentation, https://gnpyapi.readthedocs.io/
Keywords: optics,network,fiber,communication,route,planning,optimization,api
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Telecommunications Industry
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: System :: Networking
Requires-Python: >=3.8
Description-Content-Type: text/markdown; variant=GFM
License-File: LICENSE
Requires-Dist: setuptools
Requires-Dist: gnpy==2.14.1
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: uvicorn<1,>=0.30
Provides-Extra: tests
Requires-Dist: build<2,>=1.0.3; extra == "tests"
Requires-Dist: httpx<1,>=0.27; extra == "tests"
Requires-Dist: pytest<8,>=7.4.3; extra == "tests"
Requires-Dist: pyang<3,>=2.6.1; extra == "tests"
Provides-Extra: docs
Requires-Dist: alabaster<1,>=0.7.12; extra == "docs"
Requires-Dist: docutils<1,>=0.17.1; extra == "docs"
Requires-Dist: myst-parser<1,>=0.16.1; extra == "docs"
Requires-Dist: Pygments<3,>=2.11.2; extra == "docs"
Requires-Dist: rstcheck; extra == "docs"
Requires-Dist: Sphinx<6,>=5.3.0; extra == "docs"
Requires-Dist: sphinxcontrib-bibtex<3,>=2.4.1; extra == "docs"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-python

# GNPy API
[![Install via pip](https://img.shields.io/pypi/v/gnpy-api)](https://pypi.org/project/gnpy-api/)
[![Python versions](https://img.shields.io/pypi/pyversions/gnpy-api)](https://pypi.org/project/gnpy-api/)
[![Gerrit](https://img.shields.io/badge/patches-via%20Gerrit-blue)](https://review.gerrithub.io/q/project:Telecominfraproject/oopt-gnpy-api)

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](https://github.com/Telecominfraproject/oopt-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:
```bash
python3 setup.py install
```
or if you want to install it in a docker container:
```bash
docker build ./ -t gnpy-api
```

### PyPI - Option 2
```bash
pip install gnpy-api
```

## Quick Start

## 🧪 Usage - CLI
Start the FastAPI server:
```bash
python ./samples/rest_example.py
```
OpenAPI docs are available at `http://localhost:8080/docs`.

Send example data to the API:
```bash
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
```bash
docker run --rm -p 8080:8080 gnpy-api
```

## 🔄 Compatibility

Different versions of this interface extension are compatible with specific versions of [GNPy](https://github.com/Telecominfraproject/oopt-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:

```bash
pip show gnpy
```

## 📚 Documentation
Refer to the official [GNPy documentation](https://github.com/Telecominfraproject/oopt-gnpy/tree/master/docs) for information about network modeling and simulation capabilities.

API documentation is available in the docs folder.

