-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: create project skeleton using CANDI POC experimental api
Signed-off-by: EstherLerouzic <[email protected]>
- Loading branch information
1 parent
a1b2f89
commit c5aabe0
Showing
27 changed files
with
15,047 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
name: GNPY-API-CI | ||
|
||
jobs: | ||
linters: | ||
name: Lint Code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
pip install tox | ||
- name: Run linters | ||
run: | | ||
tox -e linters | ||
build: | ||
name: Tox test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: fedora-python/[email protected] | ||
with: | ||
tox_env: ${{ matrix.tox_env }} | ||
dnf_install: ${{ matrix.dnf_install }} | ||
- uses: codecov/[email protected] | ||
if: ${{ endswith(matrix.tox_env, '-cover') }} | ||
with: | ||
files: ${{ github.workspace }}/cover/coverage.xml | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tox_env: | ||
- py38 | ||
- py39 | ||
- py310 | ||
- py311 | ||
- py312-cover | ||
include: | ||
- tox_env: docs | ||
dnf_install: graphviz | ||
|
||
other-platforms: | ||
name: Tests on other platforms | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
- run: | | ||
pip install --editable .[tests] | ||
pytest -vv | ||
strategy: | ||
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: macos-13 | ||
python_version: "3.12" | ||
- os: macos-14 | ||
python_version: "3.12" | ||
|
||
paywalled-platforms: | ||
name: Tests on paywalled platforms | ||
if: github.repository_owner == 'Telecominfraproject' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
- run: | | ||
pip install --editable .[tests] | ||
pytest -vv | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: macos-13-xlarge # Apple M1 CPU | ||
python_version: "3.12" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 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. | ||
|
||
.. 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. | ||
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 | ||
|
||
## Quick Start | ||
|
||
tbd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = python -msphinx | ||
SPHINXPROJ = GNPyAPI | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
GNPy API : Optical Route Planning API | ||
===================================================================== | ||
|
||
`GNPy <http://github.com/telecominfraproject/oopt-gnpy-api>`_ | ||
|
||
tbd | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
intro | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _intro: | ||
|
||
Introduction | ||
============ | ||
|
||
tbd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=python -msphinx | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
set SPHINXPROJ=GNPyAPI | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The Sphinx module was not found. Make sure you have Sphinx installed, | ||
echo.then set the SPHINXBUILD environment variable to point to the full | ||
echo.path of the 'sphinx-build' executable. Alternatively you may add the | ||
echo.Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env python | ||
|
||
"""GNPy official API | ||
""" |
Oops, something went wrong.