gnpy-api 0.1.2__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/.github/workflows/main.yml +6 -5
  2. gnpy_api-0.2.0/AUTHORS +1 -0
  3. gnpy_api-0.2.0/ChangeLog +7 -0
  4. gnpy_api-0.2.0/PKG-INFO +132 -0
  5. gnpy_api-0.2.0/README.md +72 -0
  6. gnpy_api-0.2.0/gnpy_api.egg-info/PKG-INFO +132 -0
  7. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpy_api.egg-info/SOURCES.txt +6 -13
  8. gnpy_api-0.2.0/gnpy_api.egg-info/pbr.json +1 -0
  9. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpy_api.egg-info/requires.txt +1 -1
  10. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/__init__.py +1 -1
  11. gnpy_api-0.2.0/gnpyapi/core/route/path_request_route.py +36 -0
  12. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/route/status_route.py +1 -1
  13. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/service/path_request_service.py +0 -1
  14. gnpy_api-0.2.0/gnpyapi/exampledata/planning_demand_example.json +1757 -0
  15. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/setup.cfg +1 -1
  16. gnpy_api-0.2.0/tests/data/req/planning_demand_example.json +1757 -0
  17. gnpy_api-0.2.0/tests/data/req/planning_demand_wrong_eqpt.json +1757 -0
  18. gnpy_api-0.2.0/tests/data/req/planning_demand_wrong_topology.json +1757 -0
  19. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/tests/data/res/planning_demand_res.json +646 -426
  20. gnpy_api-0.2.0/tests/service/test_path_request_service.py +41 -0
  21. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/tests/test_api.py +13 -11
  22. gnpy_api-0.2.0/tests/utils/__init__.py +0 -0
  23. gnpy_api-0.2.0/tests/utils/input.py +6 -0
  24. gnpy_api-0.1.2/AUTHORS +0 -1
  25. gnpy_api-0.1.2/ChangeLog +0 -7
  26. gnpy_api-0.1.2/PKG-INFO +0 -77
  27. gnpy_api-0.1.2/README.md +0 -17
  28. gnpy_api-0.1.2/gnpy_api.egg-info/PKG-INFO +0 -77
  29. gnpy_api-0.1.2/gnpy_api.egg-info/pbr.json +0 -1
  30. gnpy_api-0.1.2/gnpyapi/core/route/path_request_route.py +0 -28
  31. gnpy_api-0.1.2/gnpyapi/yang/gnpy-api@2021-01-06.yang +0 -81
  32. gnpy_api-0.1.2/gnpyapi/yang/gnpy-eqpt-config@2020-10-22.yang +0 -442
  33. gnpy_api-0.1.2/gnpyapi/yang/gnpy-eqpt-config@2025-01-20.yang +0 -770
  34. gnpy_api-0.1.2/gnpyapi/yang/gnpy-network-topology@2020-10-22.yang +0 -300
  35. gnpy_api-0.1.2/gnpyapi/yang/gnpy-network-topology@2025-01-20.yang +0 -594
  36. gnpy_api-0.1.2/gnpyapi/yang/gnpy-path-computation-simplified@2020-10-22.yang +0 -559
  37. gnpy_api-0.1.2/gnpyapi/yang/gnpy-path-computation@2025-01-21.yang +0 -632
  38. gnpy_api-0.1.2/gnpyapi/yang/ietf-layer0-types@2024-03-04.yang +0 -2247
  39. gnpy_api-0.1.2/gnpyapi/yang/ietf-optical-impairment-topology@2024-05-21.yang +0 -1776
  40. gnpy_api-0.1.2/gnpyapi/yang/ietf-routing-types@2017-12-04.yang +0 -771
  41. gnpy_api-0.1.2/gnpyapi/yang/ietf-te-topology@2020-08-06.yang +0 -1952
  42. gnpy_api-0.1.2/gnpyapi/yang/ietf-te-types@2022-10-21.yang +0 -3458
  43. gnpy_api-0.1.2/tests/data/req/planning_demand_example.json +0 -1578
  44. gnpy_api-0.1.2/tests/service/test_path_request_service.py +0 -55
  45. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/Dockerfile +0 -0
  46. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/LICENSE +0 -0
  47. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/Makefile +0 -0
  48. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/biblio.bib +0 -0
  49. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/conf.py +0 -0
  50. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/images/GNPy-logo.png +0 -0
  51. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/index.rst +0 -0
  52. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/intro.rst +0 -0
  53. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/docs/make.bat +0 -0
  54. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpy_api.egg-info/dependency_links.txt +0 -0
  55. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpy_api.egg-info/not-zip-safe +0 -0
  56. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpy_api.egg-info/top_level.txt +0 -0
  57. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/__init__.py +0 -0
  58. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/exception/__init__.py +0 -0
  59. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/exception/config_error.py +0 -0
  60. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/exception/equipment_error.py +0 -0
  61. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/exception/exception_handler.py +0 -0
  62. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/exception/path_computation_error.py +0 -0
  63. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/exception/topology_error.py +0 -0
  64. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/model/__init__.py +0 -0
  65. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/model/error.py +0 -0
  66. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/model/result.py +0 -0
  67. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/route/__init__.py +0 -0
  68. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/service/__init__.py +0 -0
  69. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/service/config_service.py +0 -0
  70. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/service/equipment_service.py +0 -0
  71. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/core/service/topology_service.py +0 -0
  72. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/gnpyapi/tools/__init__.py +0 -0
  73. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/samples/rest_example.py +0 -0
  74. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/setup.py +0 -0
  75. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/tests/__init__.py +0 -0
  76. {gnpy_api-0.1.2/gnpyapi/exampledata → gnpy_api-0.2.0/tests/data/req/legacy}/planning_demand_example.json +0 -0
  77. {gnpy_api-0.1.2/tests/data/req → gnpy_api-0.2.0/tests/data/req/legacy}/planning_demand_wrong_eqpt.json +0 -0
  78. {gnpy_api-0.1.2/tests/data/req → gnpy_api-0.2.0/tests/data/req/legacy}/planning_demand_wrong_topology.json +0 -0
  79. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/tests/service/__init__.py +0 -0
  80. {gnpy_api-0.1.2 → gnpy_api-0.2.0}/tox.ini +0 -0
@@ -109,17 +109,18 @@ jobs:
109
109
  fail-fast: false
110
110
  matrix:
111
111
  include:
112
- - os: windows-2019
113
- python_version: "3.10"
114
112
  - os: windows-2022
115
113
  python_version: "3.11"
116
114
  - os: windows-2022
117
115
  python_version: "3.12"
118
- - os: macos-13
116
+ - os: windows-2025
117
+ python_version: "3.11"
118
+ - os: windows-2025
119
119
  python_version: "3.12"
120
120
  - os: macos-14
121
121
  python_version: "3.12"
122
-
122
+ - os: macos-15
123
+ python_version: "3.12"
123
124
  paywalled-platforms:
124
125
  name: Tests on paywalled platforms
125
126
  if: github.repository_owner == 'Telecominfraproject'
@@ -138,5 +139,5 @@ jobs:
138
139
  fail-fast: false
139
140
  matrix:
140
141
  include:
141
- - os: macos-13-xlarge # Apple M1 CPU
142
+ - os: macos-14-xlarge # Apple M1 CPU
142
143
  python_version: "3.12"
gnpy_api-0.2.0/AUTHORS ADDED
@@ -0,0 +1 @@
1
+ Renato Ambrosone <renato.ambrosone@polito.it>
@@ -0,0 +1,7 @@
1
+ CHANGES
2
+ =======
3
+
4
+ v0.2.0
5
+ ------
6
+
7
+ * README update for release 0.2
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: gnpy-api
3
+ Version: 0.2.0
4
+ Home-page: https://github.com/Telecominfraproject/oopt-gnpy-api
5
+ Author: Telecom Infra Project
6
+ Author-email: adamico@nec-labs.com
7
+ License: BSD-3-Clause
8
+ Project-URL: Bug Tracker, https://github.com/Telecominfraproject/oopt-gnpy-api/issues
9
+ Project-URL: Documentation, https://gnpyapi.readthedocs.io/
10
+ Keywords: optics,network,fiber,communication,route,planning,optimization,api
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Telecommunications Industry
15
+ Classifier: License :: OSI Approved :: BSD License
16
+ Classifier: Natural Language :: English
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Classifier: Topic :: Scientific/Engineering :: Physics
27
+ Classifier: Topic :: System :: Networking
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown; variant=GFM
30
+ License-File: LICENSE
31
+ Requires-Dist: setuptools
32
+ Requires-Dist: gnpy==2.14
33
+ Requires-Dist: flask>=1.1.2
34
+ Requires-Dist: Flask-Injector
35
+ Requires-Dist: pyopenssl==25.0.0
36
+ Provides-Extra: tests
37
+ Requires-Dist: build<2,>=1.0.3; extra == "tests"
38
+ Requires-Dist: pytest<8,>=7.4.3; extra == "tests"
39
+ Requires-Dist: pyang<3,>=2.6.1; extra == "tests"
40
+ Provides-Extra: docs
41
+ Requires-Dist: alabaster<1,>=0.7.12; extra == "docs"
42
+ Requires-Dist: docutils<1,>=0.17.1; extra == "docs"
43
+ Requires-Dist: myst-parser<1,>=0.16.1; extra == "docs"
44
+ Requires-Dist: Pygments<3,>=2.11.2; extra == "docs"
45
+ Requires-Dist: rstcheck; extra == "docs"
46
+ Requires-Dist: Sphinx<6,>=5.3.0; extra == "docs"
47
+ Requires-Dist: sphinxcontrib-bibtex<3,>=2.4.1; extra == "docs"
48
+ Dynamic: author
49
+ Dynamic: author-email
50
+ Dynamic: classifier
51
+ Dynamic: description
52
+ Dynamic: description-content-type
53
+ Dynamic: home-page
54
+ Dynamic: keywords
55
+ Dynamic: license
56
+ Dynamic: license-file
57
+ Dynamic: project-url
58
+ Dynamic: requires-python
59
+
60
+ # GNPy API
61
+ [![Install via pip](https://img.shields.io/pypi/v/gnpy-api)](https://pypi.org/project/gnpy-api/)
62
+ [![Python versions](https://img.shields.io/pypi/pyversions/gnpy-api)](https://pypi.org/project/gnpy-api/)
63
+ [![Gerrit](https://img.shields.io/badge/patches-via%20Gerrit-blue)](https://review.gerrithub.io/q/project:Telecominfraproject/oopt-gnpy-api)
64
+
65
+ REST API (experimental)
66
+ -----------------------
67
+ 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.
68
+
69
+ [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.
70
+
71
+ ## 🚀 Installation
72
+ ### Build from Source - Option 1
73
+ Clone the repository and install the package:
74
+ ```bash
75
+ python3 setup.py install
76
+ ```
77
+ or if you want to install it in a docker container:
78
+ ```bash
79
+ docker docker build ./ -t gnpy-api
80
+ ```
81
+
82
+ ### PiPy - Option 2
83
+ ```bash
84
+ pip install gnpy-api
85
+ ```
86
+
87
+
88
+ ### DockerHub - Option 3
89
+ Coming....
90
+ ## Quick Start
91
+
92
+ ## 🧪 Usage - CLI
93
+ Start the REST API server:
94
+ ```bash
95
+ python ./samples/rest_example.py
96
+ ```
97
+ See the help for the REST API:
98
+ ```bash
99
+ python ./samples/rest_example.py -h
100
+ ```
101
+ Send example data to the REST API:
102
+ ```bash
103
+ curl --location 'https://localhost:8080/api/v0.1/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json -k
104
+ ```
105
+ ## 🧪 Usage - Docker
106
+
107
+
108
+
109
+ ## 🔄 Compatibility
110
+
111
+ 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.
112
+
113
+
114
+
115
+ | Interface Version | Compatible GNPy Version | Notes |
116
+ |-------------------|-----------------|--------------------------------|
117
+ | `v0.2.x` | `>=2.14 ` | YANG model validation |
118
+ | `v0.1.x` | `>=2.12.1` | Initial release |
119
+
120
+ ⚠️ If you use an incompatible combination, some features may not work correctly or may produce unexpected errors.
121
+
122
+ To check your GNPy version, run:
123
+
124
+ ```bash
125
+ pip show gnpy
126
+ ```
127
+
128
+ ## 📚 Documentation
129
+ Refer to the official [GNPy documentation](https://github.com/Telecominfraproject/oopt-gnpy/tree/master/docs) for information about network modeling and simulation capabilities.
130
+
131
+ API documentation is available in the docs folder.
132
+
@@ -0,0 +1,72 @@
1
+ # GNPy API
2
+ [![Install via pip](https://img.shields.io/pypi/v/gnpy-api)](https://pypi.org/project/gnpy-api/)
3
+ [![Python versions](https://img.shields.io/pypi/pyversions/gnpy-api)](https://pypi.org/project/gnpy-api/)
4
+ [![Gerrit](https://img.shields.io/badge/patches-via%20Gerrit-blue)](https://review.gerrithub.io/q/project:Telecominfraproject/oopt-gnpy-api)
5
+
6
+ REST API (experimental)
7
+ -----------------------
8
+ 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.
9
+
10
+ [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.
11
+
12
+ ## 🚀 Installation
13
+ ### Build from Source - Option 1
14
+ Clone the repository and install the package:
15
+ ```bash
16
+ python3 setup.py install
17
+ ```
18
+ or if you want to install it in a docker container:
19
+ ```bash
20
+ docker docker build ./ -t gnpy-api
21
+ ```
22
+
23
+ ### PiPy - Option 2
24
+ ```bash
25
+ pip install gnpy-api
26
+ ```
27
+
28
+
29
+ ### DockerHub - Option 3
30
+ Coming....
31
+ ## Quick Start
32
+
33
+ ## 🧪 Usage - CLI
34
+ Start the REST API server:
35
+ ```bash
36
+ python ./samples/rest_example.py
37
+ ```
38
+ See the help for the REST API:
39
+ ```bash
40
+ python ./samples/rest_example.py -h
41
+ ```
42
+ Send example data to the REST API:
43
+ ```bash
44
+ curl --location 'https://localhost:8080/api/v0.1/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json -k
45
+ ```
46
+ ## 🧪 Usage - Docker
47
+
48
+
49
+
50
+ ## 🔄 Compatibility
51
+
52
+ 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.
53
+
54
+
55
+
56
+ | Interface Version | Compatible GNPy Version | Notes |
57
+ |-------------------|-----------------|--------------------------------|
58
+ | `v0.2.x` | `>=2.14 ` | YANG model validation |
59
+ | `v0.1.x` | `>=2.12.1` | Initial release |
60
+
61
+ ⚠️ If you use an incompatible combination, some features may not work correctly or may produce unexpected errors.
62
+
63
+ To check your GNPy version, run:
64
+
65
+ ```bash
66
+ pip show gnpy
67
+ ```
68
+
69
+ ## 📚 Documentation
70
+ Refer to the official [GNPy documentation](https://github.com/Telecominfraproject/oopt-gnpy/tree/master/docs) for information about network modeling and simulation capabilities.
71
+
72
+ API documentation is available in the docs folder.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: gnpy-api
3
+ Version: 0.2.0
4
+ Home-page: https://github.com/Telecominfraproject/oopt-gnpy-api
5
+ Author: Telecom Infra Project
6
+ Author-email: adamico@nec-labs.com
7
+ License: BSD-3-Clause
8
+ Project-URL: Bug Tracker, https://github.com/Telecominfraproject/oopt-gnpy-api/issues
9
+ Project-URL: Documentation, https://gnpyapi.readthedocs.io/
10
+ Keywords: optics,network,fiber,communication,route,planning,optimization,api
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Telecommunications Industry
15
+ Classifier: License :: OSI Approved :: BSD License
16
+ Classifier: Natural Language :: English
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Classifier: Topic :: Scientific/Engineering :: Physics
27
+ Classifier: Topic :: System :: Networking
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown; variant=GFM
30
+ License-File: LICENSE
31
+ Requires-Dist: setuptools
32
+ Requires-Dist: gnpy==2.14
33
+ Requires-Dist: flask>=1.1.2
34
+ Requires-Dist: Flask-Injector
35
+ Requires-Dist: pyopenssl==25.0.0
36
+ Provides-Extra: tests
37
+ Requires-Dist: build<2,>=1.0.3; extra == "tests"
38
+ Requires-Dist: pytest<8,>=7.4.3; extra == "tests"
39
+ Requires-Dist: pyang<3,>=2.6.1; extra == "tests"
40
+ Provides-Extra: docs
41
+ Requires-Dist: alabaster<1,>=0.7.12; extra == "docs"
42
+ Requires-Dist: docutils<1,>=0.17.1; extra == "docs"
43
+ Requires-Dist: myst-parser<1,>=0.16.1; extra == "docs"
44
+ Requires-Dist: Pygments<3,>=2.11.2; extra == "docs"
45
+ Requires-Dist: rstcheck; extra == "docs"
46
+ Requires-Dist: Sphinx<6,>=5.3.0; extra == "docs"
47
+ Requires-Dist: sphinxcontrib-bibtex<3,>=2.4.1; extra == "docs"
48
+ Dynamic: author
49
+ Dynamic: author-email
50
+ Dynamic: classifier
51
+ Dynamic: description
52
+ Dynamic: description-content-type
53
+ Dynamic: home-page
54
+ Dynamic: keywords
55
+ Dynamic: license
56
+ Dynamic: license-file
57
+ Dynamic: project-url
58
+ Dynamic: requires-python
59
+
60
+ # GNPy API
61
+ [![Install via pip](https://img.shields.io/pypi/v/gnpy-api)](https://pypi.org/project/gnpy-api/)
62
+ [![Python versions](https://img.shields.io/pypi/pyversions/gnpy-api)](https://pypi.org/project/gnpy-api/)
63
+ [![Gerrit](https://img.shields.io/badge/patches-via%20Gerrit-blue)](https://review.gerrithub.io/q/project:Telecominfraproject/oopt-gnpy-api)
64
+
65
+ REST API (experimental)
66
+ -----------------------
67
+ 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.
68
+
69
+ [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.
70
+
71
+ ## 🚀 Installation
72
+ ### Build from Source - Option 1
73
+ Clone the repository and install the package:
74
+ ```bash
75
+ python3 setup.py install
76
+ ```
77
+ or if you want to install it in a docker container:
78
+ ```bash
79
+ docker docker build ./ -t gnpy-api
80
+ ```
81
+
82
+ ### PiPy - Option 2
83
+ ```bash
84
+ pip install gnpy-api
85
+ ```
86
+
87
+
88
+ ### DockerHub - Option 3
89
+ Coming....
90
+ ## Quick Start
91
+
92
+ ## 🧪 Usage - CLI
93
+ Start the REST API server:
94
+ ```bash
95
+ python ./samples/rest_example.py
96
+ ```
97
+ See the help for the REST API:
98
+ ```bash
99
+ python ./samples/rest_example.py -h
100
+ ```
101
+ Send example data to the REST API:
102
+ ```bash
103
+ curl --location 'https://localhost:8080/api/v0.1/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json -k
104
+ ```
105
+ ## 🧪 Usage - Docker
106
+
107
+
108
+
109
+ ## 🔄 Compatibility
110
+
111
+ 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.
112
+
113
+
114
+
115
+ | Interface Version | Compatible GNPy Version | Notes |
116
+ |-------------------|-----------------|--------------------------------|
117
+ | `v0.2.x` | `>=2.14 ` | YANG model validation |
118
+ | `v0.1.x` | `>=2.12.1` | Initial release |
119
+
120
+ ⚠️ If you use an incompatible combination, some features may not work correctly or may produce unexpected errors.
121
+
122
+ To check your GNPy version, run:
123
+
124
+ ```bash
125
+ pip show gnpy
126
+ ```
127
+
128
+ ## 📚 Documentation
129
+ Refer to the official [GNPy documentation](https://github.com/Telecominfraproject/oopt-gnpy/tree/master/docs) for information about network modeling and simulation capabilities.
130
+
131
+ API documentation is available in the docs folder.
132
+
@@ -42,24 +42,17 @@ gnpyapi/core/service/path_request_service.py
42
42
  gnpyapi/core/service/topology_service.py
43
43
  gnpyapi/exampledata/planning_demand_example.json
44
44
  gnpyapi/tools/__init__.py
45
- gnpyapi/yang/gnpy-api@2021-01-06.yang
46
- gnpyapi/yang/gnpy-eqpt-config@2020-10-22.yang
47
- gnpyapi/yang/gnpy-eqpt-config@2025-01-20.yang
48
- gnpyapi/yang/gnpy-network-topology@2020-10-22.yang
49
- gnpyapi/yang/gnpy-network-topology@2025-01-20.yang
50
- gnpyapi/yang/gnpy-path-computation-simplified@2020-10-22.yang
51
- gnpyapi/yang/gnpy-path-computation@2025-01-21.yang
52
- gnpyapi/yang/ietf-layer0-types@2024-03-04.yang
53
- gnpyapi/yang/ietf-optical-impairment-topology@2024-05-21.yang
54
- gnpyapi/yang/ietf-routing-types@2017-12-04.yang
55
- gnpyapi/yang/ietf-te-topology@2020-08-06.yang
56
- gnpyapi/yang/ietf-te-types@2022-10-21.yang
57
45
  samples/rest_example.py
58
46
  tests/__init__.py
59
47
  tests/test_api.py
60
48
  tests/data/req/planning_demand_example.json
61
49
  tests/data/req/planning_demand_wrong_eqpt.json
62
50
  tests/data/req/planning_demand_wrong_topology.json
51
+ tests/data/req/legacy/planning_demand_example.json
52
+ tests/data/req/legacy/planning_demand_wrong_eqpt.json
53
+ tests/data/req/legacy/planning_demand_wrong_topology.json
63
54
  tests/data/res/planning_demand_res.json
64
55
  tests/service/__init__.py
65
- tests/service/test_path_request_service.py
56
+ tests/service/test_path_request_service.py
57
+ tests/utils/__init__.py
58
+ tests/utils/input.py
@@ -0,0 +1 @@
1
+ {"git_version": "33ed765", "is_release": false}
@@ -1,5 +1,5 @@
1
1
  setuptools
2
- gnpy==2.12.1
2
+ gnpy==2.14
3
3
  flask>=1.1.2
4
4
  Flask-Injector
5
5
  pyopenssl==25.0.0
@@ -4,7 +4,7 @@
4
4
  """
5
5
  from flask import Flask
6
6
 
7
- API_VERSION = "/api/v0.1"
7
+ API_VERSION = "/api/v0.2"
8
8
 
9
9
  app = Flask(__name__)
10
10
 
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ import json
3
+
4
+ from flask import request
5
+
6
+ from gnpyapi.core import app
7
+ from gnpyapi.core.exception.equipment_error import EquipmentError
8
+ from gnpyapi.core.exception.topology_error import TopologyError
9
+ from gnpyapi.core.service.path_request_service import PathRequestService
10
+ from gnpy.tools.convert_legacy_yang import yang_to_legacy
11
+ from gnpyapi.core import API_VERSION
12
+
13
+ PATH_REQUEST_BASE_PATH = '/path-request'
14
+
15
+
16
+ @app.route(API_VERSION + PATH_REQUEST_BASE_PATH, methods=['POST'])
17
+ def path_request(path_request_service: PathRequestService):
18
+ is_legacy = 'gnpy-api:api' not in request.json
19
+ if not is_legacy:
20
+ legacy_data = yang_to_legacy(json.loads(request.json))
21
+ service = legacy_data['gnpy-path-computation:services']
22
+ topology = legacy_data['gnpy-network-topology:topology']
23
+ equipment = yang_to_legacy(json.loads(request.json)["gnpy-api:api"]['gnpy-eqpt-config:equipment'])
24
+ else:
25
+ data = request.json
26
+ service = data['gnpy-api:service']
27
+ if 'gnpy-api:topology' in data:
28
+ topology = data['gnpy-api:topology']
29
+ else:
30
+ raise TopologyError('No topology found in request')
31
+ if 'gnpy-api:equipment' in data:
32
+ equipment = data['gnpy-api:equipment']
33
+ else:
34
+ raise EquipmentError('No equipment found in request')
35
+
36
+ return path_request_service.path_request(topology, equipment, service), 201
@@ -5,4 +5,4 @@ from gnpyapi.core import API_VERSION
5
5
 
6
6
  @app.route(API_VERSION + '/status', methods=['GET'])
7
7
  def api_status():
8
- return {"version": "v0.1", "status": "ok"}, 200
8
+ return {"version": f"{API_VERSION}", "status": "ok"}, 200
@@ -6,7 +6,6 @@ from gnpy.core.exceptions import EquipmentConfigError, NetworkTopologyError
6
6
  from gnpy.tools.json_io import results_to_json, load_eqpt_topo_from_json
7
7
  from gnpy.tools.worker_utils import designed_network, planning
8
8
  from gnpyapi.core.exception.topology_error import TopologyError
9
-
10
9
  from gnpyapi.core.exception.equipment_error import EquipmentError
11
10
 
12
11
  _logger = logging.getLogger(__name__)