mirror of
				https://github.com/Telecominfraproject/oopt-gnpy-api.git
				synced 2025-11-03 19:38:02 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ce320e73d6 | ||
| 
						 | 
					b6041db35d | ||
| 
						 | 
					256341f937 | 
							
								
								
									
										9
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							@@ -109,17 +109,20 @@ jobs:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - os: windows-2019
 | 
			
		||||
            python_version: "3.10"
 | 
			
		||||
          - os: windows-2022
 | 
			
		||||
            python_version: "3.11"
 | 
			
		||||
          - os: windows-2022
 | 
			
		||||
            python_version: "3.12"
 | 
			
		||||
          - os: windows-2025
 | 
			
		||||
            python_version: "3.11"
 | 
			
		||||
          - os: windows-2025
 | 
			
		||||
            python_version: "3.12"
 | 
			
		||||
          - os: macos-13
 | 
			
		||||
            python_version: "3.12"
 | 
			
		||||
          - os: macos-14
 | 
			
		||||
            python_version: "3.12"
 | 
			
		||||
 | 
			
		||||
          - os: macos-15
 | 
			
		||||
            python_version: "3.12"
 | 
			
		||||
  paywalled-platforms:
 | 
			
		||||
    name: Tests on paywalled platforms
 | 
			
		||||
    if: github.repository_owner == 'Telecominfraproject'
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										72
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										72
									
								
								README.md
									
									
									
									
									
								
							@@ -1,17 +1,71 @@
 | 
			
		||||
# GNPy API
 | 
			
		||||
[](https://pypi.org/project/gnpy/)
 | 
			
		||||
[](https://pypi.org/project/gnpy-api/)
 | 
			
		||||
[](https://pypi.org/project/gnpy-api/)
 | 
			
		||||
[](https://review.gerrithub.io/q/project:Telecominfraproject/oopt-gnpy-api)
 | 
			
		||||
 | 
			
		||||
REST API (experimental)
 | 
			
		||||
-----------------------
 | 
			
		||||
``gnpyapi`` provides an experimental api for requesting several paths at once. It is based on Flask server.
 | 
			
		||||
You can run it through command line or Docker.
 | 
			
		||||
This repository extends GNPy with additional interfaces, allowing for more flexible control and interaction with its simulation engine. These interfaces 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 docker build ./ -t gnpy-api
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### PiPy - Option 2
 | 
			
		||||
```bash
 | 
			
		||||
pip install gnpy-api
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    $ curl --location 'http://localhost:8080/api/v1/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json 
 | 
			
		||||
 | 
			
		||||
TODO: api documentation, unit tests, real WSGI server with trusted certificates
 | 
			
		||||
 | 
			
		||||
### DockerHub - Option 3
 | 
			
		||||
Coming.... 
 | 
			
		||||
## Quick Start
 | 
			
		||||
 | 
			
		||||
tbd
 | 
			
		||||
## 🧪 Usage - CLI
 | 
			
		||||
Start the REST API server:
 | 
			
		||||
```bash
 | 
			
		||||
python ./samples/rest_example.py
 | 
			
		||||
```
 | 
			
		||||
See the help for the REST API:
 | 
			
		||||
```bash
 | 
			
		||||
python ./samples/rest_example.py -h
 | 
			
		||||
```
 | 
			
		||||
Send example data to the REST API:
 | 
			
		||||
```bash
 | 
			
		||||
curl --location 'https://localhost:8080/api/v0.1/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json -k
 | 
			
		||||
```
 | 
			
		||||
## 🧪 Usage - Docker
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 🔄 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                          |
 | 
			
		||||
|-------------------|-----------------|--------------------------------|
 | 
			
		||||
| `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.
 | 
			
		||||
@@ -12,7 +12,6 @@ PATH_REQUEST_BASE_PATH = '/path-request'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route(API_VERSION + PATH_REQUEST_BASE_PATH, methods=['POST'])
 | 
			
		||||
@app.route(PATH_REQUEST_BASE_PATH, methods=['POST'])
 | 
			
		||||
def path_request(path_request_service: PathRequestService):
 | 
			
		||||
    data = request.json
 | 
			
		||||
    service = data['gnpy-api:service']
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user