diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 705d3ca6..a05ced5f 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -25,9 +25,9 @@ jobs: with: python-version: "3.9" cache: 'pip' # cache pip dependencies - cache-dependency-path: setup.cfg + cache-dependency-path: pyproject.toml - - name: Install dependencies + - name: Install tools run: | python -m pip install --upgrade pip python -m pip install black isort diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc9b3381..af6d1252 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,9 +7,11 @@ name: Test on: push: - branches: [ "main", "develop" ] + branches: + - main pull_request: - branches: [ "main", "develop" ] + branches: + - main permissions: contents: read @@ -39,7 +41,7 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' # caching pip dependencies - cache-dependency-path: setup.cfg + cache-dependency-path: pyproject.toml - name: Install dependencies run: | diff --git a/pyproject.toml b/pyproject.toml index e31e80b8..da024d21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,8 +30,7 @@ dependencies = [ "prtpy", "pydot", "dataclasses-json", - "importlib-resources; python_version < '3.9'", - "sdxdatamodel @ git+https://github.com/atlanticwave-sdx/datamodel@2.0.0" + "sdx-datamodel @ git+https://github.com/atlanticwave-sdx/datamodel@2.0.2" ] [project.urls] @@ -42,6 +41,7 @@ Issues = "https://github.com/atlanticwave-sdx/pce/issues" test = [ "pytest >= 7.1.2", "pytest-cov >= 3.0.0", + "importlib-resources; python_version < '3.9'", ] pygraphviz = [ "pygraphviz" diff --git a/src/sdx_pce/data/requests/test_request.json b/src/sdx_pce/data/requests/test_request.json deleted file mode 100644 index d747b127..00000000 --- a/src/sdx_pce/data/requests/test_request.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "id": "test-connection-request", - "name": "Test connection request", - "start_time": "2000-01-23T04:56:07.000Z", - "end_time": "2000-01-23T04:56:07.000Z", - "bandwidth_required": 10, - "latency_required": 300, - "egress_port": - { - "id": "urn:sdx:port:amlight.net:A1:1", - "name": "Novi100:1", - "node": "urn:sdx:node:amlight.net:A1", - "status": "up" - }, - "ingress_port": - { - "id": "urn:ogf:network:sdx:port:zaoxi:A1:2", - "name": "Novi100:2", - "node": "urn:ogf:network:sdx:node:zaoxi:A1", - "status": "up" - } -} diff --git a/src/sdx_pce/data/topologies/amlight.json b/src/sdx_pce/data/topologies/amlight.json deleted file mode 100644 index 1d87ef73..00000000 --- a/src/sdx_pce/data/topologies/amlight.json +++ /dev/null @@ -1,321 +0,0 @@ -{ - "id": "urn:ogf:network:sdx:topology:amlight.net", - "name": "AmLight-OXP", - "model_version":"1.0.0", - "time_stamp": "2000-01-23T04:56:07+00:00", - "version": 1, - "links": [ - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:amlight:B1-B2", - "latency": 5, - "name": "amlight:B1-B2", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:sdx:port:amlight.net:B1:2", - "name": "Novi01:2", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:2", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - }, - { - "id": "urn:sdx:port:amlight.net:B2:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:2", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:2", - "status": "up" - } - ], - "short_name": "Miami-BocaRaton", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:amlight:A1-B1", - "latency": 5, - "name": "amlight:A1-B1", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:sdx:port:amlight.net:A1:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:1", - "node": "urn:sdx:node:amlight.net:A1", - "short_name": "A1:1", - "status": "up" - }, - { - "id": "urn:sdx:port:amlight.net:B1:3", - "name": "Novi01:3", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:3", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "redclara-miami", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:amlight:A1-B2", - "latency": 5, - "name": "amlight:A1-B2", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:sdx:port:amlight.net:A1:2", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:2", - "node": "urn:sdx:node:amlight.net:A1", - "short_name": "A1:2", - "status": "up" - }, - { - "id": "urn:sdx:port:amlight.net:B2:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:3", - "status": "up" - } - ], - "short_name": "redclara-BocaRaton", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:nni:Miami-Sanpaolo", - "latency": 10, - "name": "nni:Miami-Sanpaolo", - "packet_loss": 59.621339166831824, - "nni": "True", - "ports": [ - { - "id": "urn:sdx:port:amlight:B1:1", - "name": "Novi01:1", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:1", - "name": "Novi01:1", - "node": "urn:ogf:network:sdx:port:sax:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "Miami-Sanpaolo", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:nni:BocaRaton-Fortaleza", - "latency": 10, - "name": "nni:BocaRaton-Fortaleza", - "packet_loss": 59.621339166831824, - "nni": "True", - "ports": [ - { - "id": "urn:sdx:port:amlight.net:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:1", - "status": "up" - } - ], - "short_name": "BocaRaton-Fortaleza", - "bandwidth": 100000 - } - ], - "nodes": [ - { - "id": "urn:sdx:node:amlight.net:B1", - "location": { - "address": "Miami", - "latitude": 25.75633040531146, - "longitude": -80.37676058477908, - "ISO3166-2-lvl4": "US-MIA" - }, - "name": "amlight:Novi01", - "ports": [ - { - "id": "urn:sdx:port:amlight:B1:1", - "name": "Novi01:1", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:sdx:port:amlight.net:B1:2", - "name": "Novi01:2", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:2", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:sdx:port:amlight.net:B1:3", - "name": "Novi01:3", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:3", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - } - ], - "short_name": "B1" - }, - { - "id": "urn:sdx:node:amlight.net:B2", - "location": { - "address": "BocaRaton", - "latitude": 26.381437356374075, - "longitude": -80.10225977485742, - "ISO3166-2-lvl4": "US-BC" - }, - "name": "amlight:Novi02", - "ports": [ - { - "id": "urn:sdx:port:amlight.net:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:sdx:port:amlight.net:B2:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:2", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:2", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:sdx:port:amlight.net:B2:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:3", - "status": "up", - "state": "enabled" - } - ], - "short_name": "B2" - }, - { - "id": "urn:sdx:node:amlight.net:A1", - "location": { - "address": "redclara", - "latitude": 30.34943181039702, - "longitude": -81.66666016473143, - "ISO3166-2-lvl4": "US-RC" - }, - "name": "amlight:Novi100", - "ports": [ - { - "id": "urn:sdx:port:amlight.net:A1:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:1", - "node": "urn:sdx:node:amlight.net:A1", - "short_name": "A1:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:sdx:port:amlight.net:A1:2", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:2", - "node": "urn:sdx:node:amlight.net:A1", - "short_name": "A1:2", - "status": "up", - "state": "enabled" - } - ], - "short_name": "A1" - } - ], - "domain_service": { - "owner":"FIU" - } - } \ No newline at end of file diff --git a/src/sdx_pce/data/topologies/sax.json b/src/sdx_pce/data/topologies/sax.json deleted file mode 100644 index a4f6a7b2..00000000 --- a/src/sdx_pce/data/topologies/sax.json +++ /dev/null @@ -1,498 +0,0 @@ -{ - "id": "urn:ogf:network:sdx:topology:sax.net", - "name": "SAX-OXP", - "time_stamp": "2000-01-23T04:56:07+00:00", - "version": 1, - "model_version":"1.0.0", - "links": [ - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:sax:B1-B2", - "latency": 5, - "name": "sax:B1-B2", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B1:2", - "name": "Novi01:2", - "node": "urn:ogf:network:sdx:node:sax:B1", - "short_name": "B1:2", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:2", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:2", - "status": "up" - } - ], - "short_name": "SaoPaulo-Fortaleza", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:sax:Panama-Fortaleza", - "latency": 5, - "name": "sax:Panama-Fortaleza", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B3:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:2", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:4", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:4", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:3", - "status": "up" - } - ], - "short_name": "Panama-Fortaleza", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:sax:SanPaolo-Fortaleza", - "latency": 5, - "name": "nni:SanPaolo-Fortaleza", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B3:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi03:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:3", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:4", - "name": "Novi01:3", - "node": "urn:ogf:network:sdx:node:sax:B1", - "short_name": "B1:4", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "BocaRaton-Fortaleza", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:sax:A1-B1", - "latency": 5, - "name": "sax:A1-B1", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:A1:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:1", - "node": "urn:ogf:network:sdx:node:sax:A1", - "short_name": "A1:1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:3", - "name": "Novi01:3", - "node": "urn:ogf:network:sdx:node:sax:B1", - "short_name": "B1:3", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "redclara-SaoPaulo", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:sax:A1-B2", - "latency": 5, - "name": "sax:A1-B2", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:A1:2", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:2", - "node": "urn:ogf:network:sdx:node:sax:A1", - "short_name": "A1:2", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:3", - "status": "up" - } - ], - "short_name": "redclara-Fortaleza", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:nni:Miami-Sanpaolo", - "nni": "True", - "latency": 10, - "name": "nni:Miami-Sanpaolo", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:sdx:port:amlight:B1:1", - "name": "Novi01:1", - "node": "urn:sdx:node:amlight.net:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:1", - "name": "Novi01:1", - "node": "urn:ogf:network:sdx:node:sax:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "Miami-Sanpaolo", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:nni:BocaRaton-Fortaleza", - "latency": 10, - "name": "nni:BocaRaton-Fortaleza", - "packet_loss": 59.621339166831824, - "nni": "True", - "ports": [ - { - "id": "urn:sdx:port:amlight.net:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:sdx:node:amlight.net:B2", - "short_name": "B2:1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:1", - "status": "up" - } - ], - "short_name": "BocaRaton-Fortaleza", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:nni:Fortaleza-Sangano", - "latency": 5, - "name": "nni:Fortaleza-Sangano", - "packet_loss": 59.621339166831824, - "nni": "True", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B3:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:1", - "name": "Novi01:1", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "Fortaleza-Sangano", - "bandwidth": 100000 - } - ], - "nodes": [ - { - "id": "urn:ogf:network:sdx:node:sax:B1", - "location": { - "address": "SaoPaulo", - "latitude": -23.5311561958366, - "longitude": -46.650271781410524, - "ISO3166-2-lvl4": "BR-SP" - }, - "name": "sax:Novi01", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B1:1", - "name": "Novi01:1", - "node": "urn:ogf:network:sdx:port:sax:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:2", - "name": "Novi01:2", - "node": "urn:ogf:network:sdx:port:sax:B1", - "short_name": "B1:2", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:3", - "name": "Novi01:3", - "node": "urn:ogf:network:sdx:port:sax:B1", - "short_name": "B1:3", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B1:4", - "name": "Novi01:3", - "node": "urn:ogf:network:sdx:port:sax:B1", - "short_name": "B1:4", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - } - ], - "short_name": "B1" - }, - { - "id": "urn:ogf:network:sdx:node:sax:B2", - "location": { - "address": "PanamaCity", - "latitude": 8.993040465928525, - "longitude": -79.4947050137491, - "ISO3166-2-lvl4": "US-PN" - }, - "name": "sax:Novi02", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:2", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:2", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:3", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B2:4", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:4", - "node": "urn:ogf:network:sdx:node:sax:B2", - "short_name": "B2:3", - "status": "up", - "state": "enabled" - } - ], - "short_name": "B2" - }, - { - "id": "urn:ogf:network:sdx:node:sax:B3", - - "location": { - "address": "Fortaleza", - "latitude": -3.73163824920348, - "longitude": -38.52443289673026, - "ISO3166-2-lvl4": "BR-FR" - }, - "name": "sax:Novi03", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B3:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B3:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:2", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:B3:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi03:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:3", - "status": "up", - "state": "enabled" - } - ], - "short_name": "B3" - }, - { - "id": "urn:ogf:network:sdx:node:sax:A1", - "location": { - "address": "Santiago", - "latitude": -33.4507049233331, - "longitude": -70.64634765264213, - "ISO3166-2-lvl4": "CL-SN" - }, - "name": "sax:Novi100", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:A1:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:1", - "node": "urn:ogf:network:sdx:node:sax:A1", - "short_name": "A1:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:sax:A1:2", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:2", - "node": "urn:ogf:network:sdx:node:sax:A1", - "short_name": "A1:2", - "status": "up", - "state": "enabled" - } - ], - "short_name": "A1" - } - ], - "domain_service": { - "owner":"RNP" - } -} diff --git a/src/sdx_pce/data/topologies/zaoxi.json b/src/sdx_pce/data/topologies/zaoxi.json deleted file mode 100644 index 2488d380..00000000 --- a/src/sdx_pce/data/topologies/zaoxi.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "id": "urn:ogf:network:sdx:topology:zaoxi.net", - "name": "ZAOXI-OXP", - "time_stamp": "2000-01-23T04:56:07+00:00", - "version": 1, - "model_version":"1.0.0", - "links": [ - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:zaoxi:B1-B2", - "latency": 5, - "name": "zaoxi:B1-B2", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:2", - "name": "Novi01:2", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B2:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:2", - "node": "urn:ogf:network:sdx:node:zaoxi:B2", - "short_name": "B2:2", - "status": "up" - } - ], - "short_name": "Sangano-Capetown", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:zaoxi:A1-B1", - "latency": 5, - "name": "zaoxi:A1-B1", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:zaoxi:A1:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:1", - "node": "urn:ogf:network:sdx:node:zaoxi:A1", - "short_name": "A1:1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:3", - "name": "Novi01:3", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "short_name": "B1:3", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "Karoo-Sangano", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:zaoxi:A1-B2", - "latency": 5, - "name": "zaoxi:A1-B2", - "packet_loss": 59.621339166831824, - "ports": [ - { - "id": "urn:ogf:network:sdx:port:zaoxi:A1:2", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:2", - "node": "urn:ogf:network:sdx:node:zaoxi:A1", - "short_name": "A1:2", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B2:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:zaoxi:B2", - "short_name": "B2:3", - "status": "up" - } - ], - "short_name": "Karoo-Capetown", - "bandwidth": 100000 - }, - { - "availability": 56.37376656633328, - "residual_bandwidth": 100000, - "id": "urn:ogf:network:sdx:link:nni:Fortaleza-Sangano", - "latency": 10, - "name": "nni:Fortaleza-Sangano", - "packet_loss": 59.621339166831824, - "nni": "True", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:sax:B3:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:sax:B3", - "short_name": "B3:1", - "status": "up" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:1", - "name": "Novi01:1", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up" - } - ], - "short_name": "Fortaleza-Sangano", - "bandwidth": 100000 - } - ], - "nodes": [ - { - "id": "urn:ogf:network:sdx:node:zaoxi:B1", - "location": { - "address": "Sangano", - "latitude": -9.533459658700743, - "longitude": 13.216709879405311, - "ISO3166-2-lvl4": "IT-SN" - }, - "name": "zaoxi:Novi01", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:1", - "name": "Novi01:1", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "short_name": "B1:1", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:2", - "name": "Novi01:2", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "short_name": "B1:2", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B1:3", - "name": "Novi01:3", - "node": "urn:ogf:network:sdx:node:zaoxi:B1", - "short_name": "B1:3", - "label_range": [ - "100-200", - "10001" - ], - "status": "up", - "state": "enabled" - } - ], - "short_name": "B1" - }, - { - "id": "urn:ogf:network:sdx:node:zaoxi:B2", - "location": { - "address": "CapeTown", - "latitude": -3.73163824920348, - "longitude": -38.52443289673026, - "ISO3166-2-lvl4": "ZA-WC" - }, - "name": "zaoxi:Novi02", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:zaoxi:B2:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi02:1", - "node": "urn:ogf:network:sdx:node:zaoxi:B2", - "short_name": "B2:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B2:2", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:2", - "node": "urn:ogf:network:sdx:node:zaoxi:B2", - "short_name": "B2:2", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:B2:3", - "label_range": [ - "100-200", - "10001" - ], - "name": "Novi02:3", - "node": "urn:ogf:network:sdx:node:zaoxi:B2", - "short_name": "B2:3", - "status": "up", - "state": "enabled" - } - ], - "short_name": "B2" - }, - { - "id": "urn:ogf:network:sdx:node:zaoxi:A1", - "location": { - "address": "Karoo", - "latitude": -32.3632301851245, - "longitude": 22.541224555821298, - "ISO3166-2-lvl4": "ZA-KR" - }, - "name": "zaoxi:Novi100", - "ports": [ - { - "id": "urn:ogf:network:sdx:port:zaoxi:A1:1", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:1", - "node": "urn:ogf:network:sdx:node:zaoxi:A1", - "short_name": "A1:1", - "status": "up", - "state": "enabled" - }, - { - "id": "urn:ogf:network:sdx:port:zaoxi:A1:2", - "label_range": [ - "100-200", - "1000" - ], - "name": "Novi100:2", - "node": "urn:ogf:network:sdx:node:zaoxi:A1", - "short_name": "A1:2", - "status": "up", - "state": "enabled" - } - ], - "short_name": "A1" - } - ] -} diff --git a/src/sdx_pce/topology/grenmlconverter.py b/src/sdx_pce/topology/grenmlconverter.py index 088d4c62..b80245db 100644 --- a/src/sdx_pce/topology/grenmlconverter.py +++ b/src/sdx_pce/topology/grenmlconverter.py @@ -1,6 +1,6 @@ from grenml import GRENMLManager from grenml.models.nodes import Node -from sdx.datamodel.models.topology import Topology +from sdx_datamodel.models.topology import Topology class GrenmlConverter(object): diff --git a/src/sdx_pce/topology/manager.py b/src/sdx_pce/topology/manager.py index 6a5feb28..2684a78c 100644 --- a/src/sdx_pce/topology/manager.py +++ b/src/sdx_pce/topology/manager.py @@ -2,11 +2,11 @@ import datetime import networkx as nx -from sdx.datamodel.models.topology import ( +from sdx_datamodel.models.topology import ( TOPOLOGY_INITIAL_VERSION, SDX_TOPOLOGY_ID_prefix, ) -from sdx.datamodel.parsing.topologyhandler import TopologyHandler +from sdx_datamodel.parsing.topologyhandler import TopologyHandler from .grenmlconverter import GrenmlConverter diff --git a/src/sdx_pce/topology/temanager.py b/src/sdx_pce/topology/temanager.py index eb891122..d16f853e 100644 --- a/src/sdx_pce/topology/temanager.py +++ b/src/sdx_pce/topology/temanager.py @@ -4,7 +4,7 @@ import networkx as nx from networkx.algorithms import approximation as approx -from sdx.datamodel.parsing.connectionhandler import ConnectionHandler +from sdx_datamodel.parsing.connectionhandler import ConnectionHandler from sdx_pce.models import ( ConnectionPath, @@ -109,7 +109,7 @@ def _update_vlan_tags_table(self, domain_name, port_list): self._vlan_tags_table[domain_name] = {} for port_id, link in port_list.items(): - # TODO: port here seems to be a dict, not sdx.datamodel.models.Port + # TODO: port here seems to be a dict, not sdx_datamodel.models.Port for port in link.ports: # TODO: sometimes port_id and "inner" port_id below # can be different. Why? For example, port_id of diff --git a/tests/__init__.py b/tests/__init__.py index cb38e0d3..32edc37c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -10,13 +10,15 @@ class TestData: - # Some data files are in src/sdx_pce/data. - PACKAGE_DATA_DIR = files("sdx_pce") / "data" + # Some data files are in src/sdx_datamodel/data. + TOPOLOGY_DIR = files("sdx_datamodel") / "data" / "topologies" + TOPOLOGY_FILE_ZAOXI = TOPOLOGY_DIR / "zaoxi.json" + TOPOLOGY_FILE_SAX = TOPOLOGY_DIR / "sax.json" + TOPOLOGY_FILE_AMLIGHT = TOPOLOGY_DIR / "amlight.json" + TOPOLOGY_FILE_SDX = TOPOLOGY_DIR / "sdx.json" - TOPOLOGY_FILE_ZAOXI = PACKAGE_DATA_DIR / "topologies" / "zaoxi.json" - TOPOLOGY_FILE_SAX = PACKAGE_DATA_DIR / "topologies" / "sax.json" - TOPOLOGY_FILE_AMLIGHT = PACKAGE_DATA_DIR / "topologies" / "amlight.json" - CONNECTION_REQ = PACKAGE_DATA_DIR / "requests" / "test_request.json" + REQUESTS_DIR = files("sdx_datamodel") / "data" / "requests" + CONNECTION_REQ = REQUESTS_DIR / "test_request.json" # Write test output files in OS temporary directory. TEST_OUTPUT_DIR = pathlib.Path(tempfile.gettempdir()) @@ -27,7 +29,6 @@ class TestData: # Other test data files. TEST_DATA_DIR = pathlib.Path(__file__).parent / "data" - TOPOLOGY_FILE_SDX = TEST_DATA_DIR / "sdx.json" CONNECTION_REQ_AMLIGHT = TEST_DATA_DIR / "test_request_amlight.json" TOPOLOGY_FILE_SAX_2 = TEST_DATA_DIR / "sax-2.json" diff --git a/tox.ini b/tox.ini index 95c2f0a2..6cd6b034 100644 --- a/tox.ini +++ b/tox.ini @@ -11,17 +11,16 @@ requires = tox>=4 [testenv] -description = run the tests with pytest +description = run tests with pytest package = wheel wheel_build_env = .pkg deps = - pytest>=6 - pytest-cov + [test] commands = pytest {tty:--color=yes} {posargs} [testenv:extras] -description = run tests, with optional dependencies installed. -extras = - pygraphviz +description = run tests, with extra dependencies installed. +extras = + pygraphviz