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 | |
|---|---|---|---|
| 
						 | 
					b0bda64b39 | ||
| 
						 | 
					fbb3d1dc7a | ||
| 
						 | 
					2133ded1a8 | 
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								README.md
									
									
									
									
									
								
							@@ -1,34 +1,14 @@
 | 
				
			|||||||
# GNPy API
 | 
					# GNPy API
 | 
				
			||||||
 | 
					[](https://pypi.org/project/gnpy/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REST API (experimental)
 | 
					REST API (experimental)
 | 
				
			||||||
-----------------------
 | 
					-----------------------
 | 
				
			||||||
``gnpyapi`` provides an experimental api for requesting several paths at once. It is based on Flask server.
 | 
					``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.
 | 
					You can run it through command line or Docker.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: shell-session
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
     $ gnpy-rest
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. code-block:: shell-session
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $ docker run -p 8080:8080 -it emmanuelledelfour/gnpy-experimental:candi-1.1 gnpy-rest
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
When starting the api server will aks for an encryption/decryption key. This key i used to encrypt equipment file when using /api/v1/equipments endpoint.
 | 
					 | 
				
			||||||
This key is a Fernet key and can be generated this way:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. code-block:: python
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
from cryptography.fernet import Fernet
 | 
					 | 
				
			||||||
Fernet.generate_key()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
After typing the key, you can detach the container by typing ^P^Q.
 | 
					    $ curl --location 'http://localhost:8080/api/v1/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json 
 | 
				
			||||||
After starting the api server, you can launch a request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. code-block:: shell-session
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $ curl -v -X POST -H "Content-Type: application/json" -d @<PATH_TO_JSON_REQUEST_FILE> https://localhost:8080/api/v1/path-computation -k
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
TODO: api documentation, unit tests, real WSGI server with trusted certificates
 | 
					TODO: api documentation, unit tests, real WSGI server with trusted certificates
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,3 +5,5 @@
 | 
				
			|||||||
from flask import Flask
 | 
					from flask import Flask
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app = Flask(__name__)
 | 
					app = Flask(__name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import gnpyapi.core.route.path_request_route  # noqa: F401, E402
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user