22 Commits

Author SHA1 Message Date
Jan Kundrát
d201ec26bf OFC 2021 demo: config generators and their output
The original topology (`original-gnpy.json`) comes from the past demos
we've done. What's new is all that YANG work.

Change-Id: I9940a6a620ae9c6f0948d5c5ff7d788f66277571
2021-06-06 12:37:01 +02:00
Jan Kundrát
183639ba07 REST: change the layout
Include GNPy-level optical parameters, especially those which are
required for launch fiber into each fiber segment. That's what ONOS uses
when it configures the ROADMs. Add some extra bits ("GNPy element
type"); these were requested by Andrea during a call a long time ago,
and these were part of the previous demos.

Don't create separate entries for each parameter, just put them
together.

FIXME: the expected data needs regeneration, but my naive attempt
failed.

Change-Id: I39d9c6bdd869ff69e4ff5c3e8c2286b837526ea7
Co-authored-by: EstherLerouzic <esther.lerouzic@orange.com>
2021-06-06 12:36:23 +02:00
Jan Kundrát
20c6d5cf95 API: a REST server for GNPy
All data are provisioned via YANG.

Change-Id: I3efeccd6c8b13f8f76146779e18f6bc18c2807b0
2021-06-06 12:22:51 +02:00
Jan Kundrát
2b38e677b2 YANG: topology info for ONOS
These bits are irrelevant for GNPy, but required on the ONOS side. I'm
not particularly happy with the format of the links, or the fact that we
need them to be done manually. I really wanted to generate them from the
underlying GNPy topology, however, that's hard because ONOS needs port
information (so that it knows how to configure these ROADMs).

FIXME: It might be possible if everything is in the same network
instance. In that case, this model would just augment each link with
port IDs.  However, I'm not really happy with having "unrecognized"
elements in the GNPy-specific topology. Or perhaps that's actually OK?

Change-Id: I31be96c04f069ab797b9da82993633dc804180e2
2021-06-06 12:22:51 +02:00
Jan Kundrát
dab521a99e YANG: tests: re-reading the equipment and topology from JSON
Currently this is semi-broken. Some are genuine bugs, but others are due
to floating point math I'm afraid.

Change-Id: Ie29cca11ad9dc47db36c1fc79a5c6f85134a67c3
2021-06-06 12:22:51 +02:00
Jan Kundrát
6cc55b83e5 YANG: examples should produce exact-same results
Change-Id: I960a2d852603c7543201c4815ce6e788b41c682a
2021-06-06 12:22:51 +02:00
Jan Kundrát
ddbb9b5af7 YANG: Test conversion of equipment + settings + topology into YANG
Change-Id: I9cd5915417d3a667cfec63b0cf2220df9973ee6e
2021-06-06 12:22:51 +02:00
Jan Kundrát
dd3d2e1152 YANG: loading and storing topologies
GNPy's in-memory representation is closely modeled on the legacy JSON
files. Everything is a node, and the edges hold no data. In our YANG
models this is different, and all Fiber instances are stored as links.

Originally I wanted to be smart with Fused nodes and automatically
remove them "when they are not needed".  In legacy JSON, the `Fused`
thingy was sometimes placed as a magic clue to signify that no EDFA can
be put on that particular place. This is not needed in YANG, so I wanted
to remove these extra Fused nodes, but boy, was it a deep hole to dig
myself in.

FIXME: EDFAs are still placed even though the docs say otherwise!

Change-Id: I27bd9414e8237d94b980a200ce9f9792602b5430
2021-06-06 12:22:51 +02:00
Jan Kundrát
936b17c151 YANG: Network Topology
The topology model (`tip-photonic-topology`) uses `leafref`s for
"instantiating" actual nodes from models defined in the equipment
library. The topology is unidirectional.

At first, I used an ad-hoc, custom topology for simplicity. This was
changed in response to Jonas' comment; there's clearly no need to
reinvent this particular wheel. Now the model builds on top of RFC8345.

Both [`ietf-network-topology`](https://tools.ietf.org/html/rfc8345#section-4.2)
and the associated `ietf-network` are needed.  The augmentations make it
a bit harder to see the YANG rendering of the resulting modules, but
that's just how the IETF model was designed.  There's nothing to fix on
our side.

The `must` statements which ensure that a topology is well-connected
leaves much to be desired. I guess I just don't buy the reasoning about
`require-instance: false` given in the RFC. If you need to break
topology, use a datastore which is defined to have broken referential
integrity, e.g., `operational`. Oh well.

Unlike the previous JSON files, this puts the fiber data into `nt:link`.

This occurred to me when in Angers at the face-to-face meeting. I talked
with Esther about the way the
draft-ietf-ccamp-optical-impairment-topology-yang is structured.
Basically, they decided to stick the whole Optical Multiplex Section
(OMS) into a `te:link` instead of using topologies and layer adaptations
-- something which felt strange to me, given my software engineering
background and (especially) my lack of hands-on experience with building
and running of optical networks (it looks like CESNET's focus is quite
unusual after all). One of the reasons for not using a `nw:node` and
using an `nt:link` instead is that "there's no NETCONF end point to use
to talk to a fiber".

The situation is similar here; there's little point in using a
full-blown node when modeling something which just boils down to a link.
This doesn't mean that the GNPy code shall change -- it's just about
changing the representation in user-facing data, such as network
topologies.

This cuts quite a lot of boilerplate, so it's a good change, IMHO. On
the other hand, I wasn't really able to "optimize out" the extra `Fused`
nodes just yet.

Change-Id: I2208fa81e63df6e13cb502bd2c4b0cfbfdb0ed3b
2021-06-06 12:22:51 +02:00
Jan Kundrát
5f38db2d2f YANG: Reading and saving equipment catalog and simulation options from YANG files
To make sure that I get everything right, I built this code for
initializing the equipment library around the already existing JSON IO
loader. That is far from optimal because there is no type safety
whatsoever in these classes, and object properties are created in a
super ad-hoc manner at runtime. That is rather painful to work with
because there is no place anywhere in the code which would list all
properties that are *supposed* to be present.

Change-Id: Ibbfd97a5a949cf107fd98484b19b24bf9f4ca3e9
2021-06-06 12:22:51 +02:00
Jan Kundrát
7172ceab20 YANG: Global simulation parameters
It occurred to me that it's better to separate out "static data from
datasheets" (`tip-photonic-equipment`) and "how does my network look
like" (`tip-photonic-topology`) from the "simulation control and
settings".

Previously, some of these parameters (which are, essentially, policy
decisions) were kept in the equipment config (`SI` and `Span`, or the
transponder costs, or the EDFAs that were allowed for automatic
placement), and others were provisioned out-of-band via
`sim_params.json`. Let's put them all into a single model.

Change-Id: I159a0b5f331711d7bc88786ee3f1c1cb8c35454c
2021-06-06 12:22:51 +02:00
Jan Kundrát
7874ad61af YANG: Equipment Library
The first step in adding YANG description for GNPy's input is the
equipment library (`tip-photonic-equipment`). It contains data about all
defined EDFA and Fiber types. This is supposed to be functionally
equivalent to the `eqpt_config.json`, but the actual JSON structure is
different.

The core idea of this model is to describe capabilities of the
simulation engine as it exists, which means that the individual
choice/case statements mirror our different "simulation input
parameters". The user is not expected to do any augmentations of the
YANG model -- just describe the amplifiers, fiber, etc, with data. This
means that the user just *uses* the YANG model, which is unlike another
proposal that was floated around back in 2019 which used YANG-level
augmentations for the equipment library.

The pre-YANG code actually split stuff from `eqpt_config.json` into
additional JSON files for "fancy bits", such as the DGT LUT. That's
something that, IMHO, does not make sense when we're willing to ship
with machine-validation of the complete input set. So instead of
deferring to another JSON file for the NF-/gain-ripple/DGT, let's move
everything in-line into the input data. This has one obvious downside in
making the amplifier data a bit too verbose. There were several options:

- Ignore the human-friendliness and push everything into the amplifier
description. This is nice and self-contained, but the data are going to
be very, very long, and the majority of the WG was worried that it would
make human editing too difficult.

- Move everything to a side-loaded JSON file. This option separates out
some numerical parameters from the equipment library, and therefore
splits the configuration into two places. One of these places would be
exempt from the YANG validation, and loaded via unspecified means.
That's a no-go.

- Put stuff into a YANG model, but use one level of indirection between
the amplifier description and the numerical data.

This took us quite some time to decide, but ultimately on 2020-09-01 we
decided that the numbers that we have been shipping are *probably*
specific to a given EDFA model they were measured on. The actual *slope*
of the DGT looks very similar between, say, the Juniper/Lumentum
measurements and the data from Orange, but the multiplication factor is
different. So the outcome was that we will probably have to ship with
some sane default, *but* any measurements done by the user will apply
only to a specific amplifier model. The YANG model reflects that, and it
uses per-type lists. They are now indexed by frequency as agreed on the
2020-09-01 coders call.

In the real world, some "common fiber types" are well-defined by ITU,
such as the SSMF. Esther tried to model this via a set of identities and
YANG `identityref`s. I think that there's no disadvantage in shipping
these data as a default content of the YANG-formatted datastore,
similarly to how the equipment library used to be structured prior to
this patch. Once again, I'm following the pattern where the user can
change any *data* without augmenting the YANG model. The only reason for
editing/augmenting the (equipment) YANG model should be changes in our
simulation *engine*, such as when adding different input parameters for
NF calculations, or adding Raman amplification, etc.

The amplifier model has been reworked a bit. I've reduced the number of
available "simulation parameters" to a reasonable minimum as suggested
by Jean-Luc (cf. issue #227):

- a polynomial NF model
- a simplified model for operators with NF_min and NF_max
- a dual-stage amplifier comprising two individual sub-amplifiers that
  are each any of the above
- a faux-Raman
- three OpenROADM-specific models

In terms of correspondence to the previous code, the "polynomial NF" is
used for current `advanced_model` (which uses yet another external JSON
file) and the `fixed_gain` model. The simplified, min-max-NF is what
Jean-Luc called "operator model"; the wording is a compromise of various
suggestions done via GitHub. The OpenROADM models are, unfortunately,
magic, especially the preamp+booster simulation. But it reflects how
it's been implemented in GNPy.

The values which are stored in the YANG-formatted JSON files have
different units than what was stored in the legacy JSON files. We are
now using the "customary units", such as ps/km, instead of s/m. This is
largely a matter of taste, but the technical reason behind this is that
YANG only defines a decimal64 data type with a limited precision, and we
were running out of fraction-digits for certain parameters where the SI
representation is "too low" (the pmd-coefficient is one example).

Other "subtle" changes have been done as well, such as clarifying that
the amplifier's band boundaries refer to the edges of the passband and
not the central frequencies, etc.

Change-Id: I449d66e952834011b3ec476023c9cc353dfca5c0
2021-06-06 12:22:51 +02:00
Jan Kundrát
cddebd55a1 YANG: tests: validate our sample data against the YANG model
I'm using the yagnson library for this, and that library needs two
pieces of data as its inputs:

- a "YANG Module Library", which is usually a JSON description of all
available and activated YANG modules along its enabled features, etc,

- actual YANG models, typically specified as a list of filesystem paths
which hold them.

I generated that ietf-yanglib file via something like:

 $ python path/to/yangson/tools/python/mkylib.py \
     gnpy/yang/ext \
     gnpy/yang/tip \
     > gnpy/yang/yanglib.json`

When this adds support for `ietf-geo-location` in future, make sure to
edit the output so that it does not accidentally enable all of the
geolocation features (but that's for later, anyway). And we might
actually not end up doing that.

Change-Id: I51e342cd556ecc381ff0bf35df2bfa70f5f83ba8
2021-06-06 12:22:51 +02:00
Jan Kundrát
aa96694c19 YANG: import: IETF models for network topologies
These will be used by our own topology. I've obtained them from
YangModels/yang@5b7ffd4e.

Change-Id: I90c8e3566293f4e747865a9739a0e5ce0cafea42
2021-06-06 12:22:51 +02:00
Jan Kundrát
1ed81a6fd9 YANG: import: basic stuff from IETF to make yangson happy
So, unlike pyang, yangson appears to choke on fewer constructs. As a
disadvantage, it apparently doesn't ship with some basic YANG stuff
(which I'm adding in this commit).

It also requires an explicit action for registering all YANG modules
into a library, and that action is performed by a script which doesn't
get installed when installing via `pip install`. That's something that
I'll fix upstream.

But hey, it's pure Python code which can perform JSON validation
according to a YANG schema. That awards the tool enough bonus points
over both pyang (ahem ahem no validation ahem ahem) and libyang (native
code plus a dependency on libredblack/libavl native library, which might
together be a bit too much to ask our users for I'm afraid).

Change-Id: I36fd742cc23ac8fe58ea34c37b15fec9aca54785
2021-06-06 12:22:51 +02:00
Jan Kundrát
f611f3d899 YANG: Prepare for distributing YANG modules
I'm using a second-level module namespace (gnpy.yang) for the same
reasons as when shipping the example data via gnpy/example-data/ --
these will be used in the subsequent commits when we actually start
adding YANG models. There is also some code (not much now, a lot more in
future) for working with these models, and in future also for loading
actual data. These *could* be put into gnpy.tools.*, but I think it's
more straightforward to just keep them in the YANG namespace.

Change-Id: Ic40738ddd8346429bde01e591d19fd2ce8cb687d
2021-06-06 12:22:51 +02:00
Jan Kundrát
f919bbea41 tests: requests: rely on pytest's own dict support
When `pytest` is run with `-vv`, it shows a diff of multiline strings
and dict just fine. The only drawback is that there's the raw string
with newlines shown as "\n", however, *then* the nice diff pretty
printing kicks in, and the result is:

 E                 Common items:
 E                 {'response-id': '5'}
 E                 Differing items:
 E                 {'path-properties': {'path-metric': [{'accumulative-value': 21.68, 'metric-type': 'SNR-bandwidth'}, {'accumulative-val...EDFA', 'link-tp-id': 'east edfa in Rennes_STA to Stbrieuc', 'node-id': 'east edfa in Rennes_STA to Stbrieuc'}}}, ...]}} != {'path-properties': {'path-metric': [{'accumulative-value': 21.68, 'metric-type': 'SNR-bandwidth'}, {'accumulative-val...EDFA', 'link-tp-id': 'east edfa in Rennes_STA to Stbrieuc', 'node-id': 'east edfa in Rennes_STA to Stbrieuc'}}}, ...]}}
 E                 Full diff:
 E                   {
 E                    'path-properties': {'path-metric': [{'accumulative-value': 21.68,
 E                                                         'metric-type': 'SNR-bandwidth'},
 E                                                        {'accumulative-value': 28.77,
 E                                                         'metric-type': 'SNR-0.1nm'},
 E                                                        {'accumulative-value': 23.7,
 E                                                         'metric-type': 'OSNR-bandwidth'},
 E                                                        {'accumulative-value': 30.79,
 E                                                         'metric-type': 'OSNR-0.1nm'},
 E                                                        {'accumulative-value': 0.0019952623149688794,
 E                                                         'metric-type': 'reference_power'},
 E                                                        {'accumulative-value': 20000000000.0,
 E                                                         'metric-type': 'path_bandwidth'}],
 ...
 ... now, it's a bit annoying that there's too much output, but
 ... that's just for context; the offending lines will be properly
 ... marked, see --\
 ...               |
 ...               v
 ...
 E                                                               {'path-route-object': {'index': 17,
 E                 -                                                                    'num-unnum-hop': {'gnpy-node-type': 'transceiver',
 E                 ?                                                                                       ^ ^^^^^^^  - ^      ^^^^^^^^^ -
 E                 +                                                                    'num-unnum-hop': {'link-tp-id': 'trx '
 E                 ?                                                                                       ^^ ^   ^^^      ^^
 E                 -                                                                                      'link-tp-id': 'trx '
 E                                                                                                                      'Lannion_CAS',
 E                                                                                                        'node-id': 'trx '
 E                                                                                                                   'Lannion_CAS'}}},
 E                                                               {'path-route-object': {'index': 18,
 E                                                                                      'label-hop': {'M': 6,
 E                                                                                                    'N': -274}}},
 E                                                               {'path-route-object': {'index': 19,
 E                                                                                      'transponder': {'transponder-mode': 'mode '
 E                                                                                                                          '2',
 E                                                                                                      'transponder-type': 'vendorA_trx-type1'}}}]},
 E                    'response-id': '5',
 E                   }

 tests/test_parser.py:312: AssertionError

Change-Id: I60b4e3bfa432a720a381bf2c0a9f0288e989dab2
2021-06-06 11:53:42 +02:00
Jan Kundrát
4202d85260 Bump the minimal required Python to 3.8
We discussed this at one of the recent coder calls; the motivation
includes better mypy type hint support, especially in numpy, but also in
the language core, and of course the dataclasses.

Change-Id: I8ffee28c33f167cbcba978c85486e58a1b8c99be
2021-06-05 01:05:24 +02:00
Jan Kundrát
d5ca3fe6f6 tests: enable pytest's builtin multiline diffing
...because it works on strings while doesn't work on byte arrays.

Change-Id: I2bb3b5a0a3d6ad965321c58fb90a02341db66d0f
2021-06-05 01:05:24 +02:00
Jan Kundrát
e5efdc0138 Do not load equipment['SI']['default'].power_range_db in the gain mode
It is not used, so don't check it.

Change-Id: I309638ac8e647ed9f507016a116d9c8d0342c32d
2021-06-04 23:11:51 +02:00
Jan Kundrát
4fe77b2519 utils: document round2float
Change-Id: I344c4a03e7d3e0614e0fc3307b12af359c61b882
2021-06-04 23:11:23 +02:00
Jan Kundrát
1c971dbaeb OpenROADM: add "some" TX roll-off for all modes
...because it is not optional in the YANG model.

Change-Id: I38025b504a34083c12dc67f86c285761b2b242c4
2021-06-04 23:10:58 +02:00
166 changed files with 24433 additions and 26804 deletions

47
.docker-travis.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -e
IMAGE_NAME=telecominfraproject/oopt-gnpy
IMAGE_TAG=$(git describe --tags)
ALREADY_FOUND=0
docker pull ${IMAGE_NAME}:${IMAGE_TAG} && ALREADY_FOUND=1
if [[ $ALREADY_FOUND == 0 ]]; then
docker build . -t ${IMAGE_NAME}
docker tag ${IMAGE_NAME} ${IMAGE_NAME}:${IMAGE_TAG}
# shared directory setup: do not clobber the real data
mkdir trash
cd trash
docker run -it --rm --volume $(pwd):/shared ${IMAGE_NAME} gnpy-transmission-example
else
echo "Image ${IMAGE_NAME}:${IMAGE_TAG} already available, will just update the other tags"
fi
docker images
do_docker_login() {
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
}
if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then
if [[ "${TRAVIS_BRANCH}" == "develop" || "${TRAVIS_BRANCH}" == "docker" ]]; then
echo "Publishing latest"
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest
do_docker_login
if [[ $ALREADY_FOUND == 0 ]]; then
docker push ${IMAGE_NAME}:${IMAGE_TAG}
fi
docker push ${IMAGE_NAME}:latest
elif [[ "${TRAVIS_BRANCH}" == "master" ]]; then
echo "Publishing stable"
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:stable
do_docker_login
if [[ $ALREADY_FOUND == 0 ]]; then
docker push ${IMAGE_NAME}:${IMAGE_TAG}
fi
docker push ${IMAGE_NAME}:stable
fi
fi

View File

@@ -1,145 +0,0 @@
on:
push:
pull_request:
branches:
- master
name: CI
jobs:
build:
name: Tox test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: fedora-python/tox-github-action@v37.0
with:
tox_env: ${{ matrix.tox_env }}
dnf_install: ${{ matrix.dnf_install }}
- uses: codecov/codecov-action@v3.1.1
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
pypi:
needs: build
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'Telecominfraproject' }}
name: PyPI packaging
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.12'
- uses: casperdcl/deploy-pypi@bb869aafd89f657ceaafe9561d3b5584766c0f95
with:
password: ${{ secrets.PYPI_API_TOKEN }}
pip: wheel -w dist/ --no-deps .
upload: true
docker:
needs: build
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && github.repository_owner == 'Telecominfraproject' }}
name: Docker image
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: jktjkt
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract tag name
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
id: extract_pretty_git
run: echo ::set-output name=GIT_DESC::$(git describe --tags)
- name: Build and push a container
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
context: .
push: true
tags: |
telecominfraproject/oopt-gnpy:${{ steps.extract_pretty_git.outputs.GIT_DESC }}
telecominfraproject/oopt-gnpy:master
- name: Extract tag name
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
id: extract_tag_name
run: echo ::set-output name=GIT_DESC::${GITHUB_REF/refs\/tags\//}
- name: Build and push a container
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
with:
context: .
push: true
tags: |
telecominfraproject/oopt-gnpy:${{ steps.extract_tag_name.outputs.GIT_DESC }}
telecominfraproject/oopt-gnpy:latest
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-12
python_version: "3.11"
- os: macos-13
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"

View File

@@ -1,3 +0,0 @@
queries:
- exclude: py/clear-text-logging-sensitive-data
- exclude: py/clear-text-storage-sensitive-data

View File

@@ -1,17 +1,5 @@
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12"
apt_packages:
- graphviz
image: latest
python:
install:
- method: pip
path: .
extra_requirements:
- docs
sphinx:
configuration: docs/conf.py
version: 3.8
requirements_file: docs/requirements.txt

27
.travis.yml Normal file
View File

@@ -0,0 +1,27 @@
dist: focal
os: linux
language: python
services: docker
python:
- "3.8"
- "3.9"
before_install:
- sudo apt-get -y install graphviz
install: skip
script:
- pip install --editable .
- pip install pytest-cov rstcheck
- pytest --cov-report=xml --cov=gnpy -v
- pip install -r docs/requirements.txt
- rstcheck --ignore-roles cite *.rst
- sphinx-build -W --keep-going docs/ x-throwaway-location
after_success:
- bash <(curl -s https://codecov.io/bash)
jobs:
include:
- stage: test
name: Docker image
script:
- git fetch --unshallow
- ./.docker-travis.sh
- docker images

View File

@@ -2,33 +2,23 @@
- project:
check:
jobs:
- tox-py38:
vars:
ensure_tox_version: '<4'
- tox-py39:
vars:
ensure_tox_version: '<4'
- tox-py310-cover:
vars:
ensure_tox_version: '<4'
- tox-docs-f36:
vars:
ensure_tox_version: '<4'
- tox-py38-cover
- coverage-diff:
voting: false
dependencies:
- tox-py310-cover-previous
- tox-py310-cover
- tox-py38-cover-previous
- tox-py38-cover
vars:
coverage_job_name_previous: tox-py310-cover-previous
coverage_job_name_current: tox-py310-cover
coverage_job_name_previous: tox-py38-cover-previous
coverage_job_name_current: tox-py38-cover
- tox-linters-diff-n-report:
voting: false
vars:
ensure_tox_version: '<4'
- tox-py310-cover-previous:
vars:
ensure_tox_version: '<4'
- tox-docs-f32
- tox-py38-cover-previous
gate:
jobs:
- tox-py38-f32
- tox-docs-f32
tag:
jobs:
- oopt-release-python:

View File

@@ -11,21 +11,18 @@ To learn how to contribute, please see CONTRIBUTING.md
- Brian Taylor (Facebook) <briantaylor@fb.com>
- David Boertjes (Ciena) <dboertje@ciena.com>
- Diego Landa (Facebook) <dlanda@fb.com>
- Emmanuelle Delfour (Orange) <WEDE7391@orange.com>
- Esther Le Rouzic (Orange) <esther.lerouzic@orange.com>
- Gabriele Galimberti (Cisco) <ggalimbe@cisco.com>
- Gert Grammel (Juniper Networks) <ggrammel@juniper.net>
- Giacomo Borraccini (Politecnico di Torino) <giacomo.borraccini@polito.it>
- Gilad Goldfarb (Facebook) <giladg@fb.com>
- James Powell (Telecom Infra Project) <james.powell@telecominfraproject.com>
- Jan Kundrát (Telecom Infra Project) <jkt@jankundrat.com>
- Jan Kundrát (Telecom Infra Project) <jan.kundrat@telecominfraproject.com>
- Jeanluc Augé (Orange) <jeanluc.auge@orange.com>
- Jonas Mårtensson (RISE) <jonas.martensson@ri.se>
- Mattia Cantono (Politecnico di Torino) <mattia.cantono@polito.it>
- Miguel Garrich (University Catalunya) <miquel.garrich@upct.es>
- Raj Nagarajan (Lumentum) <raj.nagarajan@lumentum.com>
- Roberts Miculens (Lattelecom) <roberts.miculens@lattelecom.lv>
- Sami Alavi (NUST) <sami.mansooralavi1999@gmail.com>
- Shengxiang Zhu (University of Arizona) <szhu@email.arizona.edu>
- Stefan Melin (Telia Company) <Stefan.Melin@teliacompany.com>
- Vittorio Curri (Politecnico di Torino) <vittorio.curri@polito.it>

View File

@@ -3,12 +3,12 @@
[![Install via pip](https://img.shields.io/pypi/v/gnpy)](https://pypi.org/project/gnpy/)
[![Python versions](https://img.shields.io/pypi/pyversions/gnpy)](https://pypi.org/project/gnpy/)
[![Documentation status](https://readthedocs.org/projects/gnpy/badge/?version=master)](http://gnpy.readthedocs.io/en/master/?badge=master)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Telecominfraproject/oopt-gnpy/main.yml)](https://github.com/Telecominfraproject/oopt-gnpy/actions/workflows/main.yml)
[![CI](https://travis-ci.com/Telecominfraproject/oopt-gnpy.svg?branch=master)](https://travis-ci.com/Telecominfraproject/oopt-gnpy)
[![Gerrit](https://img.shields.io/badge/patches-via%20Gerrit-blue)](https://review.gerrithub.io/q/project:Telecominfraproject/oopt-gnpy+is:open)
[![Contributors](https://img.shields.io/github/contributors-anon/Telecominfraproject/oopt-gnpy)](https://github.com/Telecominfraproject/oopt-gnpy/graphs/contributors)
[![Code Quality via LGTM.com](https://img.shields.io/lgtm/grade/python/github/Telecominfraproject/oopt-gnpy)](https://lgtm.com/projects/g/Telecominfraproject/oopt-gnpy/)
[![Code Coverage via codecov](https://img.shields.io/codecov/c/github/Telecominfraproject/oopt-gnpy)](https://codecov.io/gh/Telecominfraproject/oopt-gnpy)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3458319.svg)](https://doi.org/10.5281/zenodo.3458319)
[![Matrix chat](https://img.shields.io/matrix/oopt-gnpy:matrix.org)](https://matrix.to/#/%23oopt-gnpy%3Amatrix.org?via=matrix.org)
GNPy is an open-source, community-developed library for building route planning and optimization tools in real-world mesh optical networks.
We are a consortium of operators, vendors, and academic researchers sponsored via the [Telecom Infra Project](http://telecominfraproject.com)'s [OOPT/PSE](https://telecominfraproject.com/open-optical-packet-transport) working group.
@@ -18,14 +18,12 @@ Together, we are building this tool for rapid development of production-grade ro
## Quick Start
Install either via [Docker](https://gnpy.readthedocs.io/en/master/install.html#using-prebuilt-docker-images), or as a [Python package](https://gnpy.readthedocs.io/en/master/install.html#using-python-on-your-computer).
Install either via [Docker](docs/install.rst#install-docker), or as a [Python package](docs/install.rst#install-pip).
Read our [documentation](https://gnpy.readthedocs.io/), learn from the demos, and [get in touch with us](https://github.com/Telecominfraproject/oopt-gnpy/discussions).
This example demonstrates how GNPy can be used to check the expected SNR at the end of the line by varying the channel input power:
![Running a simple simulation example](docs/images/gnpy-transmission-example.svg)
[![Running a simple simulation example](https://telecominfraproject.github.io/oopt-gnpy/docs/images/transmission_main_example.svg)](https://asciinema.org/a/252295)
GNPy can do much more, including acting as a Path Computation Engine, tracking bandwidth requests, or advising the SDN controller about a best possible path through a large DWDM network.
Learn more about this [in the documentation](https://gnpy.readthedocs.io/), or give it a [try online at `gnpy.app`](https://gnpy.app/):
[![Path propagation at gnpy.app](docs/images/2022-04-12-gnpy-app.png)](https://gnpy.app/)
Learn more about this [in the documentation](https://gnpy.readthedocs.io/).

View File

@@ -7,12 +7,11 @@ There are weekly calls about our progress.
Newcomers, users and telecom operators are especially welcome there.
We encourage all interested people outside the TIP to [join the project](https://telecominfraproject.com/apply-for-membership/) and especially to [get in touch with us](https://github.com/Telecominfraproject/oopt-gnpy/discussions).
(contributing)=
## Contributing
`gnpy` is looking for additional contributors, especially those with experience planning and maintaining large-scale, real-world mesh optical networks.
To get involved, please contact [Jan Kundrát](mailto:jkt@jankundrat.com) or [Gert Grammel](mailto:ggrammel@juniper.net).
To get involved, please contact [Jan Kundrát](mailto:jan.kundrat@telecominfraproject.com) or [Gert Grammel](mailto:ggrammel@juniper.net).
`gnpy` contributions are currently limited to members of [TIP](http://telecominfraproject.com).
Membership is free and open to all.

View File

@@ -1848,15 +1848,3 @@ month={Sept},}
title = {Telecom Infra Project},
url = {https://www.telecominfraproject.com},
}
@ARTICLE{DAmicoJLT2022,
author={DAmico, Andrea and Correia, Bruno and London, Elliot and Virgillito,
Emanuele and Borraccini, Giacomo and Napoli, Antonio and Curri, Vittorio},
journal={Journal of Lightwave Technology},
title={Scalable and Disaggregated GGN Approximation Applied to a C+L+S Optical Network},
year={2022},
volume={40},
number={11},
pages={3499-3511},
doi={10.1109/JLT.2022.3162134}
}

View File

@@ -29,7 +29,6 @@ This path is directional, and all "GNPy elements" along the path match the unidi
The network topology contains not just the physical topology of the network, but also references to the :ref:`equipment library<concepts-equipment>` and a set of *operating parameters* for each entity.
These parameters include the **fiber length** of each fiber, the connector **attenutation losses**, or an amplifier's specific **gain setting**.
The topology is specified via :ref:`XLS files<excel>` or via :ref:`JSON<legacy-json>`.
.. _complete-vs-incomplete:

View File

@@ -65,7 +65,7 @@ author = 'Telecom Infra Project - OOPT PSE Group'
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@@ -84,11 +84,18 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme_options = {
'logo': 'images/GNPy-logo.png',
'logo_name': False,
}
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
html_theme = 'default'
html_theme_options = {
'logo_only': True,
}
else:
html_theme = 'alabaster'
html_theme_options = {
'logo': 'images/GNPy-logo.png',
'logo_name': False,
}
html_logo = 'images/GNPy-logo.png'
@@ -183,5 +190,3 @@ autodoc_default_options = {
}
graphviz_output_format = 'svg'
bibtex_bibfiles = ['biblio.bib']

View File

@@ -4,7 +4,7 @@ Extending GNPy with vendor-specific data
========================================
GNPy ships with an :ref:`equipment library<concepts-equipment>` containing machine-readable datasheets of networking equipment.
Vendors who are willing to contribute descriptions of their supported products are encouraged to `submit a patch <https://review.gerrithub.io/Documentation/intro-gerrit-walkthrough-github.html>`__ -- or just :ref:`get in touch with us directly<contributing>`.
Vendors who are willing to contribute descriptions of their supported products are encouraged to `submit a patch <https://review.gerrithub.io/Documentation/intro-gerrit-walkthrough-github.html>`__.
This chapter discusses option for modeling performance of :ref:`EDFA amplifiers<extending-edfa>`, :ref:`Raman amplifiers<extending-raman>`, :ref:`transponders<extending-transponder>` and :ref:`ROADMs<extending-roadm>`.
@@ -29,7 +29,7 @@ The NF is expressed as a third-degree polynomial:
f(x) &= \text{a}x^3 + \text{b}x^2 + \text{c}x + \text{d}
\text{NF} &= f(G - G_\text{max})
\text{NF} &= f(G_\text{max} - G)
This model can be also used for fixed-gain fixed-NF amplifiers.
In that case, use:
@@ -91,8 +91,7 @@ Advanced Specification
**********************
The amplifier performance can be further described in terms of gain ripple, NF ripple, and the dynamic gain tilt.
When provided, the amplifier characteristic is fine-tuned as a function of carrier frequency. Note that in this advanced
specification tilt is defined vs frequency while tilt_target specified in EDFA instances is defined vs wavelength.
When provided, the amplifier characteristic is fine-tuned as a function of carrier frequency.
.. _extending-raman:
@@ -101,10 +100,10 @@ Raman Amplifiers
An accurate simulation of Raman amplification requires knowledge of:
* the *power* and *wavelength* of all Raman pumping lasers,
* the *direction*, whether it is co-propagating or counter-propagating,
* the Raman efficiency of the fiber,
* the fiber temperature.
- the *power* and *wavelength* of all Raman pumping lasers,
- the *direction*, whether it is co-propagating or counter-propagating,
- the Raman efficiency of the fiber,
- the fiber temperature.
Under certain scenarios it is useful to be able to run a simulation without an accurate Raman description.
For these purposes, it is possible to approximate a Raman amplifier via a fixed-gain EDFA with the :ref:`polynomial NF<ext-nf-model-polynomial-NF>` model using :math:`\text{a} = \text{b} = \text{c} = 0`, and a desired effective :math:`\text{d} = NF`.
@@ -120,32 +119,38 @@ A *mode* usually refers to a particular performance point that is defined by a c
The following data are required for each mode:
``bit_rate``
Data bit rate, in :math:`\text{bits}\times s^{-1}`.
``baud_rate``
Symbol modulation rate, in :math:`\text{baud}`.
``OSNR``
Minimal required OSNR for the receiver. In :math:`\text{dB}`
``bit-rate``
Data bit rate, in :math:`\text{Gbits}\times s^{-1}`.
``baud-rate``
Symbol modulation rate, in :math:`\text{Gbaud}`.
``required-osnr``
Minimal allowed OSNR for the receiver.
``tx-osnr``
Initial OSNR at the transmitter's output. In :math:`\text{dB}`
``min-spacing``
Initial OSNR at the transmitter's output.
``grid-spacing``
Minimal grid spacing, i.e., an effective channel spectral bandwidth.
In :math:`\text{Hz}`.
``roll-off``
``tx-roll-off``
Roll-off parameter (:math:`\beta`) of the TX pulse shaping filter.
This assumes a raised-cosine filter.
``rx-power-min`` and ``rx-power-max``
(work in progress) The allowed range of power at the receiver.
The allowed range of power at the receiver.
In :math:`\text{dBm}`.
``penalties``
Impairments such as Chromatic Dispersion (CD), Polarization Mode Dispersion (PMD), and Polarization Dispersion Loss (PDL)
result in penalties at the receiver. The receiver's ability to handle these impairments can be defined for each mode as
a list of {impairment: in defined units, 'penalty_value' in dB} (see `transceiver section here <json.rst#_transceiver>`).
Maximum allowed CD, maximum allowed PMD, and maximum allowed PDL should be listed there with corresponding penalties.
Impairments experienced during propagation are linearly interpolated between given points to obtain the corresponding penalty.
The accumulated penalties are subtracted from the path GSNR before comparing with the minimum required OSNR.
Impairments: PMD in :math:`\text{ps}`, CD in :math:`\text{ps/nm}`, PDL in :math:`\text{dB}`, penalty_value in :math:`\text{dB}`
``cd-max``
Maximal allowed Chromatic Dispersion (CD).
In :math:`\text{ps}/\text{nm}`.
``pmd-max``
Maximal allowed Polarization Mode Dispersion (PMD).
In :math:`\text{ps}`.
``cd-penalty``
*Work-in-progress.*
Describes the increase of the requires GSNR as the :abbr:`CD (Chromatic Dispersion)` deteriorates.
``dgd-penalty``
*Work-in-progress.*
Describes the increase of the requires GSNR as the :abbr:`DGD (Differential Group Delay)` deteriorates.
``pmd-penalty``
*Work-in-progress.*
Describes the increase of the requires GSNR as the :abbr:`PMD (Polarization Mode Dispersion)` deteriorates.
GNPy does not directly track the FEC performance, so the type of chosen FEC is likely indicated in the *name* of the selected transponder mode alone.
@@ -163,7 +168,6 @@ The set of parameters for each ROADM model therefore includes:
Per-channel target TX power towards the egress amplifier.
Within GNPy, a ROADM is expected to attenuate any signal that enters the ROADM node to this level.
This can be overridden on a per-link in the network topology.
Targets can be set using power or power spectral density (see `roadm section here <json.rst#__roadm>`)
``pmd``
Polarization mode dispersion (PMD) penalty of the express path.
In :math:`\text{ps}`.

6
docs/gnpy-api-yang.rst Normal file
View File

@@ -0,0 +1,6 @@
``gnpy.yang``
-------------
.. automodule:: gnpy.yang
.. automodule:: gnpy.yang.conversion
.. automodule:: gnpy.yang.io

View File

@@ -12,3 +12,4 @@ API Reference Documentation
gnpy-api-core
gnpy-api-topology
gnpy-api-tools
gnpy-api-yang

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 478 KiB

View File

@@ -13,11 +13,11 @@ in real-world mesh optical networks. It is based on the Gaussian Noise Model.
install
json
excel
yang
extending
about-project
model
gnpy-api
release-notes
Indices and tables
==================

View File

@@ -10,33 +10,33 @@ fully-functional programs.
**Note**: *If you are a network operator or involved in route planning and
optimization for your organization, please contact project maintainer Jan
Kundrát <jkt@jankundrat.com>. gnpy is looking for users with
Kundrát <jan.kundrat@telecominfraproject.com>. gnpy is looking for users with
specific, delineated use cases to drive requirements for future
development.*
This example demonstrates how GNPy can be used to check the expected SNR at the end of the line by varying the channel input power,
or to run a planning script to check SNR of several services:
This example demonstrates how GNPy can be used to check the expected SNR at the end of the line by varying the channel input power:
.. image:: images/gnpy-transmission-example.svg
.. image:: https://telecominfraproject.github.io/oopt-gnpy/docs/images/transmission_main_example.svg
:width: 100%
:align: left
:alt: Running a simple simulation example
:target: https://asciinema.org/a/252295
By default, the gnpy-transmission-example script operates on a single span network defined in
`gnpy/example-data/edfa_example_network.json <../gnpy/example-data/edfa_example_network.json>`_
By default, this script operates on a single span network defined in
`gnpy/example-data/edfa_example_network.json <gnpy/example-data/edfa_example_network.json>`_
You can specify a different network at the command line as follows. For
example, to use the CORONET Global network defined in
`gnpy/example-data/CORONET_Global_Topology.json <../gnpy/example-data/CORONET_Global_Topology.json>`_:
`gnpy/example-data/CORONET_Global_Topology.json <gnpy/example-data/CORONET_Global_Topology.json>`_:
.. code-block:: shell-session
$ gnpy-transmission-example $(gnpy-example-data)/CORONET_Global_Topology.json
It is also possible to use an Excel file input (for example
`gnpy/example-data/CORONET_Global_Topology.xls <../gnpy/example-data/CORONET_Global_Topology.xls>`_).
`gnpy/example-data/CORONET_Global_Topology.xls <gnpy/example-data/CORONET_Global_Topology.xls>`_).
The Excel file will be processed into a JSON file with the same prefix.
Further details about the Excel data structure are available `in the documentation <excel.rst>`__.
Further details about the Excel data structure are available `in the documentation <docs/excel.rst>`__.
The main transmission example will calculate the average signal OSNR and SNR
across network elements (transceiver, ROADMs, fibers, and amplifiers)
@@ -57,10 +57,10 @@ interference noise.
Further Instructions for Use
----------------------------
Simulations are driven by a set of `JSON <json.rst>`__ or `XLS <excel.rst>`__ files.
Simulations are driven by a set of `JSON <docs/json.rst>`__ or `XLS <docs/excel.rst>`__ files.
The ``gnpy-transmission-example`` script propagates a spectrum of channels at 32 Gbaud, 50 GHz spacing and 0 dBm/channel.
Launch power in fiber spans can be overridden by using the ``--power`` argument.
Launch power can be overridden by using the ``--power`` argument.
Spectrum information is not yet parametrized but can be modified directly in the ``eqpt_config.json`` (via the ``SpectralInformation`` -SI- structure) to accommodate any baud rate or spacing.
The number of channel is computed based on ``spacing`` and ``f_min``, ``f_max`` values.
@@ -72,8 +72,8 @@ An experimental support for Raman amplification is available:
$(gnpy-example-data)/raman_edfa_example_network.json \
--sim $(gnpy-example-data)/sim_params.json --show-channels
Configuration of Raman pumps (their frequencies, power and pumping direction) is done via the `RamanFiber element in the network topology <../gnpy/example-data/raman_edfa_example_network.json>`_.
General numeric parameters for simulation control are provided in the `gnpy/example-data/sim_params.json <../gnpy/example-data/sim_params.json>`_.
Configuration of Raman pumps (their frequencies, power and pumping direction) is done via the `RamanFiber element in the network topology <gnpy/example-data/raman_edfa_example_network.json>`_.
General numeric parameters for simulation control are provided in the `gnpy/example-data/sim_params.json <gnpy/example-data/sim_params.json>`_.
Use ``gnpy-path-request`` to request several paths at once:
@@ -83,7 +83,7 @@ Use ``gnpy-path-request`` to request several paths at once:
$ gnpy-path-request -o output_file.json \
meshTopologyExampleV2.xls meshTopologyExampleV2_services.json
This program operates on a network topology (`JSON <json.rst>`__ or `Excel <excel.rst>`__ format), processing the list of service requests (JSON or XLS again).
This program operates on a network topology (`JSON <docs/json.rst>`__ or `Excel <docs/excel.rst>`__ format), processing the list of service requests (JSON or XLS again).
The service requests and reply formats are based on the `draft-ietf-teas-yang-path-computation-01 <https://tools.ietf.org/html/draft-ietf-teas-yang-path-computation-01>`__ with custom extensions (e.g., for transponder modes).
An example of the JSON input is provided in file `service-template.json`, while results are shown in `path_result_template.json`.
@@ -92,4 +92,4 @@ As a result transponder type is not part of the network info. it is related to t
The current version includes a spectrum assigment features that enables to compute a candidate spectrum assignment for each service based on a first fit policy. Spectrum is assigned based on service specified spacing value, path_bandwidth value and selected mode for the transceiver. This spectrum assignment includes a basic capacity planning capability so that the spectrum resource is limited by the frequency min and max values defined for the links. If the requested services reach the link spectrum capacity, additional services feasibility are computed but marked as blocked due to spectrum reason.
OpenROADM networks can be simulated via ``gnpy/example-data/eqpt_config_openroadm_*.json`` -- see ``gnpy/example-data/Sweden_OpenROADM*_example_network.json`` as an example.
OpenROADM networks can be simulated via ``gnpy/example-data/eqpt_config_openroadm.json`` -- see ``gnpy/example-data/Sweden_OpenROADM_example_network.json`` as an example.

File diff suppressed because it is too large Load Diff

View File

@@ -126,9 +126,9 @@ that can be easily evaluated extending the FWM theory from a set of discrete
tones - the standard FWM theory introduced back in the 90s by Inoue
:cite:`Innoue-FWM`- to a continuity of tones, possibly spectrally shaped.
Signals propagating in the fiber are not equivalent to Gaussian noise, but
thanks to the absence of in-line compensation for chromatic dispersion, the
thanks to the absence of in-line compensation for choromatic dispersion, the
become so, over short distances. So, the Gaussian noise model with incoherent
accumulation of NLI has extensively proved to be a quick yet accurate and
accumulation of NLI has estensively proved to be a quick yet accurate and
conservative tool to estimate propagation impairments of fiber propagation.
Note that the GN-model has not been derived with the aim of an *exact*
performance estimation, but to pursue a conservative performance prediction.
@@ -145,4 +145,4 @@ Raman Scattering in order to give a proper estimation for all channels
:cite:`cantono2018modeling`. This will be the main upgrade required within the
PSE framework.
.. bibliography::
.. bibliography:: biblio.bib

View File

@@ -1,269 +0,0 @@
.. _release-notes:
Release change log
==================
Each release introduces some changes and new features.
(prepare text for next release)
ROADM impairments can be defined per degree and roadm-path type (add, drop or express).
Minimum loss when crossing a ROADM is no more 0 dB. It can be set per ROADM degree with roadm-path-impairments.
The transceiver output power, which was previously set using the same parameter as the input span power (power_dbm),
can now be set using a different parameter. It can be set as:
- for all channels, with tx_power_dbm using SI similarly to tx_osnr (gnpy-transmission-example script)
.. code-block:: json
"SI": [{
"f_min": 191.35e12,
"baud_rate": 32e9,
"f_max": 196.1e12,
"spacing": 50e9,
"power_dbm": 3,
"power_range_db": [0, 0, 1],
"roll_off": 0.15,
"tx_osnr": 40,
"tx_power_dbm": -10,
"sys_margins": 2
}
]
- for certain channels, using -spectrum option and tx_channel_power_dbm option (gnpy-transmission-example script).
.. code-block:: json
{
"spectrum": [
{
"f_min": 191.35e12,
"f_max":193.1e12,
"baud_rate": 32e9,
"slot_width": 50e9,
"power_dbm": 0,
"roll_off": 0.15,
"tx_osnr": 40
},
{
"f_min": 193.15e12,
"f_max":193.15e12,
"baud_rate": 32e9,
"slot_width": 50e9,
"power_dbm": 0,
"roll_off": 0.15,
"tx_osnr": 40,
"tx_power_dbm": -10
},
{
"f_min": 193.2e12,
"f_max":195.1e12,
"baud_rate": 32e9,
"slot_width": 50e9,
"power_dbm": 0,
"roll_off": 0.15,
"tx_osnr": 40
}
]
}
- per service using the additional parameter ``tx_power`` which similarly to ``power`` should be defined in Watt (gnpy-path-request script)
.. code-block:: json
{
"path-request": [
{
"request-id": "0",
"source": "trx SITE1",
"destination": "trx SITE2",
"src-tp-id": "trx SITE1",
"dst-tp-id": "trx SITE2",
"bidirectional": false,
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"spacing": 50000000000.0,
"path_bandwidth": 100000000000.0
}
}
},
{
"request-id": "0 with tx_power",
"source": "trx SITE1",
"destination": "trx SITE2",
"src-tp-id": "trx SITE1",
"dst-tp-id": "trx SITE2",
"bidirectional": false,
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"tx_power": 0.0001,
"spacing": 50000000000.0,
"path_bandwidth": 100000000000.0
}
}
}
]
}
v2.9
----
The revision introduces a major refactor that separates design and propagation. Most of these changes have no impact
on the user experience, except the following ones:
**Network design - amplifiers**: amplifier saturation is checked during design in all cases, even if type_variety is
set; amplifier gain is no more computed on the fly but only at design phase.
Before, the design did not consider amplifier power saturation during design if amplifier type_variety was stated.
With this revision, the saturation is always applied:
If design is made for a per channel power that leads to saturation, the target are properly reduced and the design
is freezed. So that when a new simulation is performed on the same network for lower levels of power per channel
the same gain target is applied. Before these were recomputed, changing the gain targets, so the simulation was
not considering the exact same working points for amplifiers in case of saturation.
Note that this case (working with saturation settings) is not recommended.
The gain of amplifiers was estimated on the fly also in case of RamanFiber preceding elements. The refactor now
requires that an estimation of Raman gain of the RamanFiber is done during design to properly compute a gain target.
The Raman gain is estimated at design for every RamanFiber span and also during propagation instead of being only
estimated at propagation stage for those Raman Fiber spans concerned with the transmission. The auto-design is more
accurate for unpropagated spans, but this results in an increase overall computation time.
This will be improved in the future.
**Network design - ROADMs**: ROADM target power settings are verified during design.
Design checks that expected power coming from every directions ingress from a ROADM are consistent with output power
targets. The checks only considers the adjacent previous hop. If the expected power at the input of this ROADM is
lower than the target power on the out-degree of the ROADM, a warning is displayed, and user is asked to review the
input network to avoid this situation. This does not change the design or propagation behaviour.
**Propagation**: amplifier gain target is no more recomputed during propagation. It is now possible to freeze
the design and propagate without automatic changes.
In previous release, gain was recomputed during propagation based on an hypothetical reference noiseless channel
propagation. It was not possible to «freeze» the autodesign, and propagate without recomputing the gain target
of amplifiers.
With this new release, the design is freezed, so that it is possible to compare performances on same basis.
**Display**: "effective pch (dbm)" is removed. Display contains the target pch which is the target power per channel
in dBm, computed based on reference channel used for design and the amplifier delta_p in dB (and before out VOA
contribution). Note that "actual pch out (dBm)" is the actual propagated total power per channel averaged per spectrum
band definition at the output of the amplifier element, including noises and out VOA contribution.
v2.8
----
**Spectrum assignment**: requests can now support multiple slots.
The definition in service file supports multiple assignments (unchanged syntax):
.. code-block:: json
"effective-freq-slot": [
{
"N": 0,
"M": 4
}, {
"N": 50,
"M": 4
}
],
But in results, label-hop is now a list of slots and center frequency index:
.. code-block:: json
{
"path-route-object": {
"index": 4,
"label-hop": [
{
"N": 0,
"M": 4
}, {
"N": 50,
"M": 4
}
]
}
},
instead of
.. code-block:: json
{
"path-route-object": {
"index": 4,
"label-hop": {
"N": 0,
"M": 4
}
}
},
**change in display**: only warnings are displayed ; information are disabled and needs the -v (verbose)
option to be displayed on standard output.
**frequency scaling**: A more accurate description of fiber parameters is implemented, including frequency scaling of
chromatic dispersion, effective area, Raman gain coefficient, and nonlinear coefficient.
In particular:
1. Chromatic dispersion can be defined with ``'dispersion'`` and ``'dispersion_slope'``, as in previous versions, or
with ``'dispersion_per_frequency'``; the latter must be defined as a dictionary with two keys, ``'value'`` and
``'frequency'`` and it has higher priority than the entries ``'dispersion'`` and ``'dispersion_slope'``.
Essential change: In previous versions, when it was not provided the ``'dispersion_slope'`` was calculated in an
involute manner to get a vanishing beta3 , and this was a mere artifact for NLI evaluation purposes (namely to evaluate
beta2 and beta3, not for total dispersion accumulation). Now, the evaluation of beta2 and beta3 is performed explicitly
in the element.py module.
2. The effective area is provided as a scalar value evaluated at the Fiber reference frequency and properly scaled
considering the Fiber refractive indices n1 and n2, and the core radius. These quantities are assumed to be fixed and
are hard coded in the parameters.py module. Essential change: The effective area is always scaled along the frequency.
3. The Raman gain coefficient is properly scaled considering the overlapping of fiber effective area values scaled at
the interacting frequencies. Essential change: In previous version the Raman gain coefficient depends only on
the frequency offset.
4. The nonlinear coefficient ``'gamma'`` is properly scaled considering the refractive index n2 and the scaling
effective area. Essential change: As the effective area, the nonlinear coefficient is always scaled along the
frequency.
**power offset**: Power equalization now enables defining a power offset in transceiver library to represent
the deviation from the general equalisation strategy defined in ROADMs.
.. code-block:: json
"mode": [{
"format": "100G",
"baud_rate": 32.0e9,
"tx_osnr": 35.0,
"min_spacing": 50.0e9,
"cost": 1,
"OSNR": 10.0,
"bit_rate": 100.0e9,
"roll_off": 0.2,
"equalization_offset_db": 0.0
}, {
"format": "200G",
"baud_rate": 64.0e9,
"tx_osnr": 35.0,
"min_spacing": 75.0e9,
"cost": 1,
"OSNR": 13.0,
"bit_rate": 200.0e9,
"roll_off": 0.2,
"equalization_offset_db": 1.76
}
]
v2.7
----

7
docs/requirements.txt Normal file
View File

@@ -0,0 +1,7 @@
alabaster>=0.7.12,<1
docutils>=0.15.2,<1
myst-parser>=0.14.0,<1
Pygments>=2.7.4,<3
rstcheck
Sphinx>=3.5.0,<4
sphinxcontrib-bibtex>=0.4.2,<1

598
docs/yang.md Normal file
View File

@@ -0,0 +1,598 @@
(yang)=
# YANG-formatted data
(yang-equipment)=
## Equipment Library
The [equipment library](concepts-equipment) is defined via the `tip-photonic-equipment` YANG model.
The database describes all [amplifier models](yang-equipment-amplifier), all [types of fiber](yang-equipment-fiber), all possible [ROADM models](yang-equipment-roadm), etc.
(yang-equipment-amplifier)=
### Amplifiers
Amplifiers introduce noise to the signal during amplification, and care must be taken to describe their performance correctly.
There are some common input parameters:
`type`
: A free-form name which must be unique within the whole equipment library.
It will be used in the network topology to specify which amplifier model is deployed at the given place in the network.
`frequency-min` and `frequency-max`
: Operating range of the amplifier.
`gain-flatmax`
: The optimal operating point of the amplifier.
This is the place where the gain tilt and the NF of the amplifier are at its best.
`gain-min`
: Minimal possible gain that can be set for the EDFA.
Any lower gain requires adding a physical attenuator.
`max-power-out`
: Total power cap at the output of the amplifier, measured across the whole spectrum.
`has-output-voa`
: Specifies if there's a Variable Optical Attenuator (VOA) at the EDFA's output port.
One of the key parameters of an amplifier is the method to use for [computing the Noise Figure (NF)](concepts-nf-model).
Here's how they are represented in YANG data:
(yang-equipment-amplifier-polynomial-NF)=
#### `polynomial-NF`
The [Polynomial NF model](ext-nf-model-polynomial-NF) requires four coefficients for the polynomial function: `a`, `b`, `c` and `d`.
```json
{
"type": "Juniper-BoosterHG",
"gain-min": "10",
"gain-flatmax": "25",
"max-power-out": "21",
"frequency-min": "191.35",
"frequency-max": "196.1",
"polynomial-NF": {
"a": "0.0008",
"b": "0.0272",
"c": "-0.2249",
"d": "6.4902"
}
}
```
(yang-equipment-amplifier-min-max-NF)=
#### `min-max-NF`
This is an operator-focused model.
Performance is defined by the [minimal and maximal NF](nf-model-min-max-NF).
`nf-min`
: Minimal Noise Figure.
This is achieved when the EDFA operates at its maximal flat gain (see the `gain-flatmax` parameter).
`nf-max`
: Maximal Noise Figure.
This worst-case scenario applies when the EDFA operates at its minimal gain (see the `gain-min` parameter).
(yang-equipment-amplifier-openroadm)=
#### OpenROADM
NF models for preamps, boosters and inline amplifiers as defined via the OpenROADM group.
(yang-equipment-amplifier-polynomial-OSNR-OpenROADM)=
##### `OpenROADM-ILA`
This model is useful for [amplifiers compliant to the OpenROADM specification for ILA](ext-nf-model-polynomial-OSNR-OpenROADM).
The input parameters to this model are once again four coefficients `a`. `b`, `c` and `d`:
```json
{
"type": "low-noise",
"gain-min": "12",
"gain-flatmax": "27",
"max-power-out": "22",
"frequency-min": "191.35",
"frequency-max": "196.1",
"OpenROADM-ILA": {
"a": "-8.104e-4",
"b": "-6.221e-2",
"c": "-5.889e-1",
"d": "37.62",
}
}
```
(yang-equipment-amplifier-OpenROADM-preamp-booster)=
##### `OpenROADM-preamp` and `OpenROADM-booster`
No extra parameters are defined for these NF models.
See the [model documentation](ext-nf-model-noise-mask-OpenROADM) for details.
(yang-equipment-amplifier-composite)=
#### `composite`
A [composite](ext-nf-model-dual-stage-amplifier) amplifier combines two distinct amplifiers.
The first amplifier will be always operated at its maximal gain (and therefore its best NF).
`preamp`
: Reference to the first amplifier model
`booster`
: Reference to the second amplifier model
(yang-equipment-amplifier-raman-approximation)=
#### `raman-approximation`
A fixed-NF amplifier, especially suitable for emulating Raman amplifiers
in scenarios where the Raman-aware engine cannot be used.
`nf`
: Noise Figure of the amplifier.
(yang-equipment-amplifier-fine-tuning)=
#### Advanced EDFA parameters
In addition to all parameters specified above, it is also possible to describe the EDFA\'s performance in higher detail.
All of the following parameters are given as measurement points at arbitrary frequencies.
The more data points provided, the more accurate is the simulation.
The underlying model uses piecewise linear approximation to estimate values which are laying in between the provided values.
`dynamic-gain-tilt`
: FIXME: document this
`gain-ripple`
: Difference of the amplifier gain for a specified frequency, as compared to the typical gain over the whole spectrum
`nf-ripple`
: Difference in the resulting Noise Figure (NF) as a function of a carrier frequency
```json
{
"type": "vg-15-26",
"gain-min": "15",
"gain-flatmax": "26",
"dynamic-gain-tilt": [
{
"frequency": "191.35",
"dynamic-gain-tilt": "0"
},
{
"frequency": "196.1",
"dynamic-gain-tilt": "2.4"
}
],
"max-power-out": "23",
"min-max-NF": {
"nf-min": "6.0",
"nf-max": "10.0"
}
}
```
These values are optional. If not provided, gain and NF is assumed to not vary with carrier frequency.
(yang-equipment-fiber)=
### Fiber
An optical fiber attenuates the signal and acts as a medium for non-linear interference (NLI) for all signals in the propagated spectrum.
When using the Raman-aware simulation engine, the Raman effect is also considered.
`type`
: A free-form name which must be unique within the whole equipment library, such as `G.652`.
`chromatic-dispersion`
: Chromatic dispersion, in $\frac{ps}{nm\times km}$.
`chromatic-dispersion-slope`
: Dispersion slope is related to the $\beta _3$ coefficient.
In $\frac{ps}{nm^{2}\times km}$.
`gamma`
: Fiber\'s $\gamma$ coefficient.
In $\frac{1}{W\times km}$.
`pmd-coefficient`
: Coefficient for the Polarization Mode Dispersion (PMD).
In $\frac{ps}{\sqrt{km}}$.
`raman-efficiency`
: Normalized efficiency of the Raman amplification per operating frequency.
This is a required parameter if using Rama-aware simulation engine.
The data type is a YANG list keyed by `delta-frequency` (in $\text{THz}$).
For each `delta-frequency`, provide the `cr` parameter which is a dimensionless number indicating how effective the Raman transfer of energy is at that particular frequency offset from the pumping signal.
```javascript
{
"type": "SSMF",
"dispersion": "16.7",
"gamma": "1.27",
"pmd-coefficient": "0.0400028124",
"raman-efficiency": [
{
"delta-frequency": "0",
"cr": "0"
},
{
"delta-frequency": "0.5",
"cr": "9.4e-06"
},
// more frequencies go here
{
"delta-frequency": "42.0",
"cr": "1e-07"
}
]
}
```
(yang-equipment-roadm)=
### ROADMs
Compared to EDFAs and fibers, ROADM descriptions are simpler.
In GNPy, ROADM mainly acts as a smart, spectrum-specific attenuator which equalizes carrier power to a specified power level.
The PMD contribution is also taken into account, and the Add and Drop stages affect signal\'s OSNR as well.
`type`
: Unique model identification, used when cross-referencing from the network topology.
`add-drop-osnr`
: OSNR penalty introduced by the Add stage or the Drop stage of this ROADM type.
`target-channel-out-power`
: Per-channel target TX power towards the egress amplifier.
Within GNPy, a ROADM is expected to attenuate any signal that enters the ROADM node to this level.
This can be overridden on a per-link in the network topology.
`pmd`
: Polarization mode dispersion (PMD) penalty of the express path within this ROADM model.
In $\text{s}$.
`compatible-preamp` and `compatible-booster`
: List of all allowed booster/preamplifier types.
Useful for specifying constraints on what amplifier modules fit into ROADM chassis, and when using fully disaggregated ROADM topologies as well.
(yang-equipment-transponder)=
### Transponders
Transponders (or transceivers) are sources and detectors of optical signals.
There are a few parameters which apply to a transponder model:
`type`
: Unique name, for corss-referencing from the topology data.
`frequency-min` and `frequency-max`
: Minimal and maximal operating frequencies of the receiver and transmitter.
A lot of transponders can operate in a variety of modes, which are described via the `transceiver/mode` list:
`name`
: Identification of the transmission mode.
Free form, has to be unique within one transponder type.
`bit-rate`
: Data bit rate, in $\text{Gbits}\times s^{-1}$.
`baud-rate`
: Symbol modulation rate, in $\text{Gbaud}$.
`required-osnr`
: Minimal allowed OSNR for the receiver.
`in-band-tx-osnr`
: Worst-case guaranteed initial OSNR at the Tx port per 0.1nm of bandwidth
Only the in-band OSNR is considered.
`grid-spacing`
: Minimal grid spacing, i.e., an effective channel spectral bandwidth.
In $\text{Hz}$.
`tx-roll-off`
: Roll-off parameter ($\beta$) of the TX pulse shaping filter.
This assumes a raised-cosine filter.
(yang-simulation)=
## Simulation Parameters
The `tip-photonic-simulation` model holds options which control how a simulation behaves.
These include information such as the spectral allocation to work on, the initial launch power, or the desired precision of the Raman engine.
### Propagated spectrum
Channel allocation is controlled via `/tip-photonic-simulation:simulation/grid`.
This input structure does not support flexgrid (yet), and it assumes homogeneous channel allocation in a worst-case scenario (all channels allocated):
`frequency-min` and `frequency-max`
: Define the range of central channel frequencies.
`spacing`
: How far apart from each other to place channels.
`baud-rate`
: Modulation speed.
`power`
: Launch power, per-channel.
`tx-osnr`
: The initial OSNR of a signal at the transponder's TX port.
`tx-roll-off`
: Roll-off parameter (β) of the TX pulse shaping filter.
This assumes a raised-cosine filter.
### Autodesign
Autodesign is controlled via `/tip-photonic-simulation:autodesign`.
`power-adjustment-for-span-loss`
: This adjusts the launch power of each span depending on the span's loss.
When in effect, launch powers to spans are adjusted based on the total span loss.
The span loss is compared to a reference span of 20 dB, and the launch power is adjusted by about 0.3 * `loss_difference`, up to a provided maximal adjustment.
This adjustment is performed for all spans when running in the `power-mode` (see below).
When in `gain-mode`, it affects only EDFAs which do not have an explicitly assigned `delta-p`.
FIXME: there are more.
#### Power mode
FIXME: This is currently mostly undocumented.
Sorry.
In power mode, GNPy can try out several initial launch powers.
This is controlled via the `/tip-photonic-simulation:autodesign/power-mode/power-sweep`:
`start`
: Initial delta from the reference power when determining the best initial launch power.
`stop`
: Final delta from the reference power when determining the best initial launch power
`step-size`
: Step size when determining the best initial launch power
#### Gain mode
FIXME: This is currently mostly undocumented.
Sorry.
In the gain mode, EDFA gain is based on the previous span loss.
For all EDFAs whose gain has not been set manually, set the gain based on the following rules:
1) Set gain to the preceding span loss.
2) Offset the gains around the reference power (FIXME: what does it mean?
This will leave the gain of EDFAs which have their gains set manually in the network topology unchanged.
### Miscellaneous parameters
`/tip-photonic-simulation:system-margin`
: How many $\text{dB}$ of headroom to require.
This parameter is useful to account for component aging, fiber repairs, etc.
(yang-topology)=
## Network Topology
The *topology* acts as a "digital self" of the simulated network.
The topology builds upon the `ietf-network-topology` from [RFC8345](https://tools.ietf.org/html/rfc8345#section-4.2) and is implemented in the `tip-photonic-topology` YANG model.
In this network, the *nodes* correspond to [amplifiers](yang-topology-amplifier), [ROADMs](yang-topology-roadm), [transceivers](yang-topology-transceiver) and [attenuators](yang-topology-attenuator).
The *links* model [optical fiber](yang-topology-fiber) or [patchcords](yang-topology-patch)).
Additional elements are also available for modeling networks which have not been fully specified yet.
Where not every amplifier has been placed already, some links can be represented by a [tentative-link](yang-topology-tentative-link), and some amplifier nodes by [placeholders](yang-topology-amplifier-placeholder).
(yang-topology-common-node-props)=
### Common Node Properties
All *nodes* share a common set of properties for describing their physical location.
These are useful mainly for visualizing the network topology.
```javascript
{
"node-id": "123",
// ...more data go here...
"tip-photonic-topology:geo-location": {
"x": "0.5",
"y": "0.0"
}
}
```
Below is a reference as to how the individual elements are used.
(yang-topology-amplifier)=
### Amplifiers
A physical, unidirectional amplifier.
The amplifier *model* is specified via `tip-photonic-topology:amplifier/model` leafref.
#### Operational data
If not set, GNPy determines the optimal operating point of the amplifier for the specified simulation input parameters so that the total GSNR remains at its highest possible value.
`out-voa-target`
: Attenuation of the output VOA
`gain-target`
: Amplifier gain
`tilt-target`
: Amplifier tilt
#### Example
```json
{
"node-id": "edfa-A",
"tip-photonic-topology:amplifier": {
"model": "fixed-22",
"out-voa-target": "0.0",
"gain-target": "19.0",
"tilt-target": "10.0"
}
}
```
(yang-topology-transceiver)=
### Transceivers
Transceivers can be used as source and destination points of a path when requesting connectivity feasibility checks.
`model`
: Cross-reference to the equipment library, specifies the physical model of this transponder.
There are no transceiver-specific parameters.
Mode selection is done via global simulation parameters.
(yang-topology-roadm)=
### ROADMs
FIXME: topology
(yang-topology-attenuator)=
### Attenuators
This element (``attenuator``) is suitable for modeling a concentrated loss -- perhaps a real-world long-haul fiber with a splice that has a significant attenuation.
Only one attribute is defined:
`attenuation`
: Attenuation of the splice, in $\text{dB}$.
In the original data formed used by GNPy, the corresponding element, `Fused`, was often used as a cue which disabled automatic EDFA placement.
(yang-topology-amplifier-placeholder)=
### Amplifier Placeholders
In cases where the actual amplifier locations are already known, but a specific type of amplifier has not been decided yet, the `amplifier-placeholder` will be used.
This is typically put in place either as a preamp or booster at a ROADM site, or in between two `fiber` `nt::link` elements.
No properties are defined.
(yang-topology-fiber)=
### Fiber
An `nt:link` which contains a `fiber` represents a specific, tangible fiber which exists in the physical world.
It has a certain length, is made of a particular material, etc.
The following properties are defined:
`type`
: Class of the fiber.
Refers to the specified fiber material in the equipment library.
`length`
: Total length of the fiber, in :math:`\text{m}`.
`loss-per-km``
: Fiber attenuation per length.
In $\text{dB}/\text{km}$.
`attenuation-in``
: FIXME: can we remove this and go with a full-blown attenuator instead?
`conn-att-in` and `conn-att-out`
: Attenuation of the input and output connectors, respectively.
#### Raman properties
When using the Raman engine, additional properties are required:
`raman/temperature`
: This is the average temperature of the fiber, given in $\text{K}$.
### Raman amplification
Actual Raman amplification can be activated by adding several pump lasers below the `raman` container.
Use one list member per pump:
`raman/pump[]/frequency`
: Operating frequency of this pump.
In $\text{Hz}$.
`raman/pump[]/power`
: Pumping power, in $\text{dBm}$.
`raman/pump[]/direction`
: Direction in which the pumping power is being delivered into the fiber.
One of `co-propagating` (pumping in the same direction as the signal), or `counter-propagating` (pumping at the fiber end).
(yang-topology-patch)=
### Patch cords
An `nt:link` with a `patch` element inside corresponds to a short, direct link.
Typically, this is used for direct connections between equipment.
No non-linearities are considered.
(yang-topology-tentative-link)=
### Tentative links
An `nt:link` which contains a `tentative-link` is a placeholder for a link that will be constructed by GNPy.
Unlike either `patch` or `fiber`, this type of a link will never be used in a finalized, fully specified topology.
`type`
: Class of the fiber.
Refers to the specified fiber material in the equipment library.
`length`
: Total length of the fiber, in $\text{km}$.

View File

@@ -1,8 +1,8 @@
"""
'''
GNPy is an open-source, community-developed library for building route planning and optimization tools in real-world mesh optical networks. It is based on the Gaussian Noise Model.
Signal propagation is implemented in :py:mod:`.core`.
Path finding and spectrum assignment is in :py:mod:`.topology`.
Various tools and auxiliary code, including the JSON I/O handling, is in
:py:mod:`.tools`.
"""
'''

View File

@@ -1,4 +1,4 @@
"""
'''
Simulation of signal propagation in the DWDM network
Optical signals, as defined via :class:`.info.SpectralInformation`, enter
@@ -6,4 +6,4 @@ Optical signals, as defined via :class:`.info.SpectralInformation`, enter
through the :py:mod:`.network`.
The simulation is controlled via :py:mod:`.parameters` and implemented mainly
via :py:mod:`.science_utils`.
"""
'''

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
'''
gnpy.core.ansi_escapes
======================
A random subset of ANSI terminal escape codes for colored messages
"""
'''
red = '\x1b[1;31;40m'
blue = '\x1b[1;34;40m'

File diff suppressed because it is too large Load Diff

View File

@@ -1,82 +1,73 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
'''
gnpy.core.equipment
===================
This module contains functionality for specifying equipment.
"""
'''
from gnpy.core.utils import automatic_nch, db2lin
from gnpy.core.exceptions import EquipmentConfigError
def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=False):
"""return the trx and SI parameters from eqpt_config for a given type_variety and mode (ie format)
if the type or mode do no match an existing transceiver in the library, then the function
raises an error if error_message is True else returns a default mode based on equipment['SI']['default']
If trx_mode is None (but type is valid), it returns an undetermined mode whatever the error message:
this is a special case for automatic mode selection.
"""
"""return the trx and SI parameters from eqpt_config for a given type_variety and mode (ie format)"""
trx_params = {}
default_si_data = equipment['SI']['default']
# default transponder characteristics
# mainly used with transmission_main_example.py
default_trx_params = {
'f_min': default_si_data.f_min,
'f_max': default_si_data.f_max,
'baud_rate': default_si_data.baud_rate,
'spacing': default_si_data.spacing,
'OSNR': None,
'penalties': {},
'bit_rate': None,
'cost': None,
'roll_off': default_si_data.roll_off,
'tx_osnr': default_si_data.tx_osnr,
'min_spacing': None,
'equalization_offset_db': 0
}
# Undetermined transponder characteristics
# mainly used with path_request_run.py for the automatic mode computation case
undetermined_trx_params = {
"format": "undetermined",
"baud_rate": None,
"OSNR": None,
"penalties": None,
"bit_rate": None,
"roll_off": None,
"tx_osnr": None,
"min_spacing": None,
"cost": None,
"equalization_offset_db": 0
}
trxs = equipment['Transceiver']
if trx_type_variety in trxs:
modes = {mode['format']: mode for mode in trxs[trx_type_variety].mode}
trx_frequencies = {'f_min': trxs[trx_type_variety].frequency['min'],
'f_max': trxs[trx_type_variety].frequency['max']}
if trx_mode in modes:
# if called from transmission_main.py, trx_mode is ''
trx_params = {**modes[trx_mode], **trx_frequencies}
try:
trxs = equipment['Transceiver']
# if called from path_requests_run.py, trx_mode is filled with None when not specified by user
# if called from transmission_main.py, trx_mode is ''
if trx_mode is not None:
mode_params = next(mode for trx in trxs
if trx == trx_type_variety
for mode in trxs[trx].mode
if mode['format'] == trx_mode)
trx_params = {**mode_params}
# sanity check: spacing baudrate must be smaller than min spacing
if trx_params['baud_rate'] > trx_params['min_spacing']:
# sanity check: baudrate must be smaller than min spacing
raise EquipmentConfigError(f'Inconsistency in equipment library:\n Transponder "{trx_type_variety}" '
+ f'mode "{trx_params["format"]}" has baud rate '
+ f'{trx_params["baud_rate"] * 1e-9:.2f} GHz greater than min_spacing '
+ f'{trx_params["min_spacing"] * 1e-9:.2f}.')
trx_params['equalization_offset_db'] = trx_params.get('equalization_offset_db', 0)
return trx_params
if trx_mode is None:
# if called from path_requests_run.py, trx_mode is filled with None when not specified by user
trx_params = {**undetermined_trx_params, **trx_frequencies}
return trx_params
if trx_type_variety in trxs and error_message:
raise EquipmentConfigError(f'Could not find transponder "{trx_type_variety}" with mode "{trx_mode}" '
+ 'in equipment library')
if error_message:
raise EquipmentConfigError(f'Could not find transponder "{trx_type_variety}" in equipment library')
raise EquipmentConfigError(f'Inconsistency in equipment library:\n Transpoder "{trx_type_variety}" mode "{trx_params["format"]}" ' +
f'has baud rate {trx_params["baud_rate"]*1e-9} GHz greater than min_spacing {trx_params["min_spacing"]*1e-9}.')
else:
mode_params = {"format": "undetermined",
"baud_rate": None,
"OSNR": None,
"bit_rate": None,
"roll_off": None,
"tx_osnr": None,
"min_spacing": None,
"cost": None}
trx_params = {**mode_params}
trx_params['f_min'] = equipment['Transceiver'][trx_type_variety].frequency['min']
trx_params['f_max'] = equipment['Transceiver'][trx_type_variety].frequency['max']
# TODO: novel automatic feature maybe unwanted if spacing is specified
# trx_params['spacing'] = _automatic_spacing(trx_params['baud_rate'])
# temp = trx_params['spacing']
# print(f'spacing {temp}')
except StopIteration:
if error_message:
raise EquipmentConfigError(f'Could not find transponder "{trx_type_variety}" with mode "{trx_mode}" in equipment library')
else:
# default transponder charcteristics
# mainly used with transmission_main_example.py
trx_params['f_min'] = default_si_data.f_min
trx_params['f_max'] = default_si_data.f_max
trx_params['baud_rate'] = default_si_data.baud_rate
trx_params['spacing'] = default_si_data.spacing
trx_params['OSNR'] = None
trx_params['bit_rate'] = None
trx_params['cost'] = None
trx_params['roll_off'] = default_si_data.roll_off
trx_params['tx_osnr'] = default_si_data.tx_osnr
trx_params['min_spacing'] = None
nch = automatic_nch(trx_params['f_min'], trx_params['f_max'], trx_params['spacing'])
trx_params['nb_channel'] = nch
print(f'There are {nch} channels propagating')
trx_params['power'] = db2lin(default_si_data.power_dbm) * 1e-3
trx_params = {**default_trx_params}
return trx_params

View File

@@ -8,371 +8,49 @@ gnpy.core.info
This module contains classes for modelling :class:`SpectralInformation`.
"""
from __future__ import annotations
from collections import namedtuple
from collections.abc import Iterable
from typing import Union
from dataclasses import dataclass
from numpy import argsort, mean, array, append, ones, ceil, any, zeros, outer, full, ndarray, asarray
from gnpy.core.utils import automatic_nch, db2lin, watt2dbm
from gnpy.core.exceptions import SpectrumError
DEFAULT_SLOT_WIDTH_STEP = 12.5e9 # Hz
"""Channels with unspecified slot width will have their slot width evaluated as the baud rate rounded up to the minimum
multiple of the DEFAULT_SLOT_WIDTH_STEP (the baud rate is extended including the roll off in this evaluation)"""
from gnpy.core.utils import automatic_nch, lin2db
class Power(namedtuple('Power', 'signal nli ase')):
"""carriers power in W"""
class Channel(
namedtuple('Channel',
'channel_number frequency baud_rate slot_width roll_off power chromatic_dispersion pmd pdl latency')):
"""Class containing the parameters of a WDM signal.
class Channel(namedtuple('Channel', 'channel_number frequency baud_rate roll_off power chromatic_dispersion pmd')):
""" Class containing the parameters of a WDM signal.
:param channel_number: channel number in the WDM grid
:param frequency: central frequency of the signal (Hz)
:param baud_rate: the symbol rate of the signal (Baud)
:param slot_width: the slot width (Hz)
:param roll_off: the roll off of the signal. It is a pure number between 0 and 1
:param power (gnpy.core.info.Power): power of signal, ASE noise and NLI (W)
:param chromatic_dispersion: chromatic dispersion (s/m)
:param pmd: polarization mode dispersion (s)
:param pdl: polarization dependent loss (dB)
:param latency: propagation latency (s)
:param channel_number: channel number in the WDM grid
:param frequency: central frequency of the signal (Hz)
:param baud_rate: the symbol rate of the signal (Baud)
:param roll_off: the roll off of the signal. It is a pure number between 0 and 1
:param power (gnpy.core.info.Power): power of signal, ASE noise and NLI (W)
:param chromatic_dispersion: chromatic dispersion (s/m)
:param pmd: polarization mode dispersion (s)
"""
class SpectralInformation(object):
"""Class containing the parameters of the entire WDM comb.
delta_pdb_per_channel: (per frequency) per channel delta power in dbm for the actual mix of channels"""
def __init__(self, frequency: array, baud_rate: array, slot_width: array, signal: array, nli: array, ase: array,
roll_off: array, chromatic_dispersion: array, pmd: array, pdl: array, latency: array,
delta_pdb_per_channel: array, tx_osnr: array, tx_power: array, label: array):
indices = argsort(frequency)
self._frequency = frequency[indices]
self._df = outer(ones(frequency.shape), frequency) - outer(frequency, ones(frequency.shape))
self._number_of_channels = len(self._frequency)
self._channel_number = [*range(1, self._number_of_channels + 1)]
self._slot_width = slot_width[indices]
self._baud_rate = baud_rate[indices]
overlap = self._frequency[:-1] + self._slot_width[:-1] / 2 > self._frequency[1:] - self._slot_width[1:] / 2
if any(overlap):
overlap = [pair for pair in zip(overlap * self._channel_number[:-1], overlap * self._channel_number[1:])
if pair != (0, 0)]
raise SpectrumError(f'Spectrum required slot widths larger than the frequency spectral distances '
f'between channels: {overlap}.')
exceed = self._baud_rate > self._slot_width
if any(exceed):
raise SpectrumError(f'Spectrum baud rate, including the roll off, larger than the slot width for channels: '
f'{[ch for ch in exceed * self._channel_number if ch]}.')
self._signal = signal[indices]
self._nli = nli[indices]
self._ase = ase[indices]
self._roll_off = roll_off[indices]
self._chromatic_dispersion = chromatic_dispersion[indices]
self._pmd = pmd[indices]
self._pdl = pdl[indices]
self._latency = latency[indices]
self._delta_pdb_per_channel = delta_pdb_per_channel[indices]
self._tx_osnr = tx_osnr[indices]
self._tx_power = tx_power[indices]
self._label = label[indices]
@property
def frequency(self):
return self._frequency
@property
def df(self):
"""Matrix of relative frequency distances between all channels. Positive elements in the upper right side."""
return self._df
@property
def slot_width(self):
return self._slot_width
@property
def baud_rate(self):
return self._baud_rate
@property
def number_of_channels(self):
return self._number_of_channels
@property
def powers(self):
powers = zip(self.signal, self.nli, self.ase)
return [Power(*p) for p in powers]
@property
def signal(self):
return self._signal
@signal.setter
def signal(self, signal):
self._signal = signal
@property
def nli(self):
return self._nli
@nli.setter
def nli(self, nli):
self._nli = nli
@property
def ase(self):
return self._ase
@ase.setter
def ase(self, ase):
self._ase = ase
@property
def roll_off(self):
return self._roll_off
@property
def chromatic_dispersion(self):
return self._chromatic_dispersion
@chromatic_dispersion.setter
def chromatic_dispersion(self, chromatic_dispersion):
self._chromatic_dispersion = chromatic_dispersion
@property
def pmd(self):
return self._pmd
@property
def label(self):
return self._label
@pmd.setter
def pmd(self, pmd):
self._pmd = pmd
@property
def pdl(self):
return self._pdl
@pdl.setter
def pdl(self, pdl):
self._pdl = pdl
@property
def latency(self):
return self._latency
@latency.setter
def latency(self, latency):
self._latency = latency
@property
def delta_pdb_per_channel(self):
return self._delta_pdb_per_channel
@delta_pdb_per_channel.setter
def delta_pdb_per_channel(self, delta_pdb_per_channel):
self._delta_pdb_per_channel = delta_pdb_per_channel
@property
def tx_osnr(self):
return self._tx_osnr
@tx_osnr.setter
def tx_osnr(self, tx_osnr):
self._tx_osnr = tx_osnr
@property
def tx_power(self):
return self._tx_power
@tx_power.setter
def tx_power(self, tx_power):
self._tx_power = tx_power
@property
def channel_number(self):
return self._channel_number
@property
def carriers(self):
entries = zip(self.channel_number, self.frequency, self.baud_rate, self.slot_width,
self.roll_off, self.powers, self.chromatic_dispersion, self.pmd, self.pdl, self.latency)
return [Channel(*entry) for entry in entries]
def apply_attenuation_lin(self, attenuation_lin):
self.signal *= attenuation_lin
self.nli *= attenuation_lin
self.ase *= attenuation_lin
def apply_attenuation_db(self, attenuation_db):
attenuation_lin = 1 / db2lin(attenuation_db)
self.apply_attenuation_lin(attenuation_lin)
def apply_gain_lin(self, gain_lin):
self.signal *= gain_lin
self.nli *= gain_lin
self.ase *= gain_lin
def apply_gain_db(self, gain_db):
gain_lin = db2lin(gain_db)
self.apply_gain_lin(gain_lin)
def __add__(self, other: SpectralInformation):
try:
return SpectralInformation(frequency=append(self.frequency, other.frequency),
slot_width=append(self.slot_width, other.slot_width),
signal=append(self.signal, other.signal), nli=append(self.nli, other.nli),
ase=append(self.ase, other.ase),
baud_rate=append(self.baud_rate, other.baud_rate),
roll_off=append(self.roll_off, other.roll_off),
chromatic_dispersion=append(self.chromatic_dispersion,
other.chromatic_dispersion),
pmd=append(self.pmd, other.pmd),
pdl=append(self.pdl, other.pdl),
latency=append(self.latency, other.latency),
delta_pdb_per_channel=append(self.delta_pdb_per_channel,
other.delta_pdb_per_channel),
tx_osnr=append(self.tx_osnr, other.tx_osnr),
tx_power=append(self.tx_power, other.tx_power),
label=append(self.label, other.label))
except SpectrumError:
raise SpectrumError('Spectra cannot be summed: channels overlapping.')
def _replace(self, carriers):
self.chromatic_dispersion = array([c.chromatic_dispersion for c in carriers])
self.pmd = array([c.pmd for c in carriers])
self.pdl = array([c.pdl for c in carriers])
self.latency = array([c.latency for c in carriers])
self.signal = array([c.power.signal for c in carriers])
self.nli = array([c.power.nli for c in carriers])
self.ase = array([c.power.ase for c in carriers])
return self
class Pref(namedtuple('Pref', 'p_span0, p_spani, neq_ch ')):
"""noiseless reference power in dBm:
p_span0: inital target carrier power
p_spani: carrier power after element i
neq_ch: equivalent channel count in dB"""
def create_arbitrary_spectral_information(frequency: Union[ndarray, Iterable, float],
signal: Union[float, ndarray, Iterable],
baud_rate: Union[float, ndarray, Iterable],
tx_osnr: Union[float, ndarray, Iterable],
tx_power: Union[float, ndarray, Iterable] = None,
delta_pdb_per_channel: Union[float, ndarray, Iterable] = 0.,
slot_width: Union[float, ndarray, Iterable] = None,
roll_off: Union[float, ndarray, Iterable] = 0.,
chromatic_dispersion: Union[float, ndarray, Iterable] = 0.,
pmd: Union[float, ndarray, Iterable] = 0.,
pdl: Union[float, ndarray, Iterable] = 0.,
latency: Union[float, ndarray, Iterable] = 0.,
label: Union[str, ndarray, Iterable] = None):
"""This is just a wrapper around the SpectralInformation.__init__() that simplifies the creation of
a non-uniform spectral information with NLI and ASE powers set to zero."""
frequency = asarray(frequency)
number_of_channels = frequency.size
try:
signal = full(number_of_channels, signal)
baud_rate = full(number_of_channels, baud_rate)
roll_off = full(number_of_channels, roll_off)
slot_width = full(number_of_channels, slot_width) if slot_width is not None else \
ceil((1 + roll_off) * baud_rate / DEFAULT_SLOT_WIDTH_STEP) * DEFAULT_SLOT_WIDTH_STEP
chromatic_dispersion = full(number_of_channels, chromatic_dispersion)
pmd = full(number_of_channels, pmd)
pdl = full(number_of_channels, pdl)
latency = full(number_of_channels, latency)
nli = zeros(number_of_channels)
ase = zeros(number_of_channels)
delta_pdb_per_channel = full(number_of_channels, delta_pdb_per_channel)
tx_osnr = full(number_of_channels, tx_osnr)
tx_power = full(number_of_channels, tx_power)
label = full(number_of_channels, label)
return SpectralInformation(frequency=frequency, slot_width=slot_width,
signal=signal, nli=nli, ase=ase,
baud_rate=baud_rate, roll_off=roll_off,
chromatic_dispersion=chromatic_dispersion,
pmd=pmd, pdl=pdl, latency=latency,
delta_pdb_per_channel=delta_pdb_per_channel,
tx_osnr=tx_osnr, tx_power=tx_power, label=label)
except ValueError as e:
if 'could not broadcast' in str(e):
raise SpectrumError('Dimension mismatch in input fields.')
else:
raise
class SpectralInformation(namedtuple('SpectralInformation', 'pref carriers')):
def __new__(cls, pref, carriers):
return super().__new__(cls, pref, carriers)
def create_input_spectral_information(f_min, f_max, roll_off, baud_rate, spacing, tx_osnr, tx_power,
delta_pdb=0):
"""Creates a fixed slot width spectral information with flat power.
all arguments are scalar values"""
number_of_channels = automatic_nch(f_min, f_max, spacing)
frequency = [(f_min + spacing * i) for i in range(1, number_of_channels + 1)]
delta_pdb_per_channel = delta_pdb * ones(number_of_channels)
label = [f'{baud_rate * 1e-9 :.2f}G' for i in range(number_of_channels)]
return create_arbitrary_spectral_information(frequency, slot_width=spacing, signal=tx_power, baud_rate=baud_rate,
roll_off=roll_off, delta_pdb_per_channel=delta_pdb_per_channel,
tx_osnr=tx_osnr, tx_power=tx_power, label=label)
def carriers_to_spectral_information(initial_spectrum: dict[float, Carrier],
power: float) -> SpectralInformation:
"""Initial spectrum is a dict with key = carrier frequency, and value a Carrier object.
:param initial_spectrum: indexed by frequency in Hz, with power offset (delta_pdb), baudrate, slot width,
tx_osnr, tx_power and roll off.
:param power: power of the request
"""
frequency = list(initial_spectrum.keys())
signal = [c.tx_power for c in initial_spectrum.values()]
roll_off = [c.roll_off for c in initial_spectrum.values()]
baud_rate = [c.baud_rate for c in initial_spectrum.values()]
delta_pdb_per_channel = [c.delta_pdb for c in initial_spectrum.values()]
slot_width = [c.slot_width for c in initial_spectrum.values()]
tx_osnr = [c.tx_osnr for c in initial_spectrum.values()]
tx_power = [c.tx_power for c in initial_spectrum.values()]
label = [c.label for c in initial_spectrum.values()]
return create_arbitrary_spectral_information(frequency=frequency, signal=signal, baud_rate=baud_rate,
slot_width=slot_width, roll_off=roll_off,
delta_pdb_per_channel=delta_pdb_per_channel, tx_osnr=tx_osnr,
tx_power=tx_power, label=label)
@dataclass
class Carrier:
"""One channel in the initial mixed-type spectrum definition, each type being defined by
its delta_pdb (power offset with respect to reference power), baud rate, slot_width, roll_off
tx_power, and tx_osnr. delta_pdb offset is applied to target power out of Roadm.
Label is used to group carriers which belong to the same partition when printing results.
"""
delta_pdb: float
baud_rate: float
slot_width: float
roll_off: float
tx_osnr: float
tx_power: float
label: str
@dataclass
class ReferenceCarrier:
"""Reference channel type is used to determine target power out of ROADM for the reference channel when
constant power spectral density (PSD) equalization is set. Reference channel is the type that has been defined
in SI block and used for the initial design of the network.
Computing the power out of ROADM for the reference channel is required to correctly compute the loss
experienced by reference channel in Roadm element.
Baud rate is required to find the target power in constant PSD: power = PSD_target * baud_rate.
For example, if target PSD is 3.125e4mW/GHz and reference carrier type a 32 GBaud channel then
output power should be -20 dBm and for a 64 GBaud channel power target would need 3 dB more: -17 dBm.
Slot width is required to find the target power in constant PSW (constant power per slot width equalization):
power = PSW_target * slot_width.
For example, if target PSW is 2e4mW/GHz and reference carrier type a 32 GBaud channel in a 50GHz slot width then
output power should be -20 dBm and for a 64 GBaud channel in a 75 GHz slot width, power target would be -18.24 dBm.
Other attributes (like roll-off) may be added there for future equalization purpose.
"""
baud_rate: float
slot_width: float
def create_input_spectral_information(f_min, f_max, roll_off, baud_rate, power, spacing):
# pref in dB : convert power lin into power in dB
pref = lin2db(power * 1e3)
nb_channel = automatic_nch(f_min, f_max, spacing)
si = SpectralInformation(
pref=Pref(pref, pref, lin2db(nb_channel)),
carriers=[
Channel(f, (f_min + spacing * f),
baud_rate, roll_off, Power(power, 0, 0), 0, 0) for f in range(1, nb_channel + 1)
]
)
return si

View File

@@ -1,27 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
'''
gnpy.core.network
=================
Working with networks which consist of network elements
"""
'''
from copy import deepcopy
from operator import attrgetter
from collections import namedtuple
from logging import getLogger
from gnpy.core import elements
from gnpy.core import ansi_escapes, elements
from gnpy.core.exceptions import ConfigurationError, NetworkTopologyError
from gnpy.core.utils import round2float, convert_length, psd2powerdbm, lin2db, watt2dbm, dbm2watt
from gnpy.core.info import ReferenceCarrier, create_input_spectral_information
from gnpy.core.parameters import SimParams, EdfaParams
from gnpy.core.science_utils import RamanSolver
logger = getLogger(__name__)
from gnpy.core.utils import round2float, convert_length
from collections import namedtuple
def edfa_nf(gain_target, variety_type, equipment):
@@ -36,11 +27,10 @@ def edfa_nf(gain_target, variety_type, equipment):
)
amp.pin_db = 0
amp.nch = 88
amp.slot_width = 50e9
return amp._calc_nf(True)
def select_edfa(raman_allowed, gain_target, power_target, equipment, uid, restrictions=None, verbose=True):
def select_edfa(raman_allowed, gain_target, power_target, equipment, uid, restrictions=None):
"""amplifer selection algorithm
@Orange Jean-Luc Augé
"""
@@ -63,8 +53,15 @@ def select_edfa(raman_allowed, gain_target, power_target, equipment, uid, restri
# power attribut include power AND gain limitations
edfa_list = [Edfa_list(
variety=edfa_variety,
power=min(pin + edfa.gain_flatmax + TARGET_EXTENDED_GAIN, edfa.p_max) - power_target,
gain_min=gain_target + 3 - edfa.gain_min,
power=min(
pin
+ edfa.gain_flatmax
+ TARGET_EXTENDED_GAIN,
edfa.p_max
)
- power_target,
gain_min=gain_target + 3
- edfa.gain_min,
nf=edfa_nf(gain_target, edfa_variety, equipment))
for edfa_variety, edfa in edfa_dict.items()
if ((edfa.allowed_for_design or restrictions is not None) and not edfa.raman)]
@@ -73,8 +70,15 @@ def select_edfa(raman_allowed, gain_target, power_target, equipment, uid, restri
# do not allow extended gain min for Raman
raman_list = [Edfa_list(
variety=edfa_variety,
power=min(pin + edfa.gain_flatmax + TARGET_EXTENDED_GAIN, edfa.p_max) - power_target,
gain_min=gain_target - edfa.gain_min,
power=min(
pin
+ edfa.gain_flatmax
+ TARGET_EXTENDED_GAIN,
edfa.p_max
)
- power_target,
gain_min=gain_target
- edfa.gain_min,
nf=edfa_nf(gain_target, edfa_variety, equipment))
for edfa_variety, edfa in edfa_dict.items()
if (edfa.allowed_for_design and edfa.raman)] \
@@ -98,10 +102,10 @@ def select_edfa(raman_allowed, gain_target, power_target, equipment, uid, restri
please increase span fiber padding')
else:
# TODO: convert to logging
if verbose:
logger.warning(f'\n\tWARNING: target gain in node {uid} is below all available amplifiers min gain: '
+ '\n\tamplifier input padding will be assumed, consider increase span fiber padding '
+ 'instead.\n')
print(
f'{ansi_escapes.red}WARNING:{ansi_escapes.reset} target gain in node {uid} is below all available amplifiers min gain: \
amplifier input padding will be assumed, consider increase span fiber padding instead'
)
acceptable_gain_min_list = edfa_list
# filter on gain+power limitation:
@@ -121,33 +125,33 @@ def select_edfa(raman_allowed, gain_target, power_target, equipment, uid, restri
# =>chose the amp with the best NF among the acceptable ones:
selected_edfa = min(acceptable_power_list, key=attrgetter('nf')) # filter on NF
# check what are the gain and power limitations of this amp
power_reduction = min(selected_edfa.power, 0)
if power_reduction < -0.5 and verbose:
logger.warning(f'\n\tWARNING: target gain and power in node {uid}\n'
+ '\tis beyond all available amplifiers capabilities and/or extended_gain_range:\n'
+ f'\ta power reduction of {round(power_reduction, 2)} is applied\n')
power_reduction = round(min(selected_edfa.power, 0), 2)
if power_reduction < -0.5:
print(
f'{ansi_escapes.red}WARNING:{ansi_escapes.reset} target gain and power in node {uid}\n \
is beyond all available amplifiers capabilities and/or extended_gain_range:\n\
a power reduction of {power_reduction} is applied\n'
)
return selected_edfa.variety, power_reduction
def target_power(network, node, equipment): # get_fiber_dp
"""Computes target power using J. -L. Auge, V. Curri and E. Le Rouzic,
Open Design for Multi-Vendor Optical Networks, OFC 2019.
equation 4
"""
if isinstance(node, elements.Roadm):
return 0
SPAN_LOSS_REF = 20
POWER_SLOPE = 0.3
dp_range = list(equipment['Span']['default'].delta_power_range_db)
node_loss = span_loss(network, node, equipment)
node_loss = span_loss(network, node)
try:
dp = round2float((node_loss - SPAN_LOSS_REF) * POWER_SLOPE, dp_range[2])
dp = max(dp_range[0], dp)
dp = min(dp_range[1], dp)
except IndexError:
raise ConfigurationError('invalid delta_power_range_db definition in eqpt_config[Span]'
'delta_power_range_db: [lower_bound, upper_bound, step]')
raise ConfigurationError(f'invalid delta_power_range_db definition in eqpt_config[Span]'
f'delta_power_range_db: [lower_bound, upper_bound, step]')
return dp
@@ -186,74 +190,12 @@ def next_node_generator(network, node):
yield from next_node_generator(network, next_node)
def estimate_raman_gain(node, equipment, power_dbm):
"""If node is RamanFiber, then estimate the possible Raman gain if any
for this purpose computes stimulated_raman_scattering loss_profile. This may be time consuming.
"""
if isinstance(node, elements.RamanFiber):
if hasattr(node, "estimated_gain"):
return node.estimated_gain
f_min = equipment['SI']['default'].f_min
f_max = equipment['SI']['default'].f_max
roll_off = equipment['SI']['default'].roll_off
baud_rate = equipment['SI']['default'].baud_rate
power = dbm2watt(power_dbm)
spacing = equipment['SI']['default'].spacing
tx_osnr = equipment['SI']['default'].tx_osnr
# reduce the nb of channels to speed up
spacing = spacing * 3
power = power * 3
sim_params = {
"raman_params": {
"flag": True,
"result_spatial_resolution": 50e3,
"solver_spatial_resolution": 100
}
}
# in order to take into account gain generated in RamanFiber, propagate in the RamanFiber with
if hasattr(node, "estimated_gain"):
# do not compute twice to save on time
return node.estimated_gain
spectral_info = create_input_spectral_information(f_min=f_min, f_max=f_max, roll_off=roll_off,
baud_rate=baud_rate, tx_power=power, spacing=spacing,
tx_osnr=tx_osnr)
pin = watt2dbm(sum(spectral_info.signal))
attenuation_in_db = node.params.con_in + node.params.att_in
spectral_info.apply_attenuation_db(attenuation_in_db)
save_sim_params = {"raman_params": SimParams._shared_dict['raman_params'].to_json(),
"nli_params": SimParams._shared_dict['nli_params'].to_json()}
SimParams.set_params(sim_params)
stimulated_raman_scattering = RamanSolver.calculate_stimulated_raman_scattering(spectral_info, node)
attenuation_fiber = stimulated_raman_scattering.loss_profile[:spectral_info.number_of_channels, -1]
spectral_info.apply_attenuation_lin(attenuation_fiber)
attenuation_out_db = node.params.con_out
spectral_info.apply_attenuation_db(attenuation_out_db)
pout = watt2dbm(sum(spectral_info.signal))
estimated_loss = pin - pout
estimated_gain = node.loss - estimated_loss
node.estimated_gain = estimated_gain
SimParams.set_params(save_sim_params)
return round(estimated_gain, 2)
else:
return 0.0
def span_loss(network, node, equipment, input_power=None):
"""Total loss of a span (Fiber and Fused nodes) which contains the given node
Do not recompute, if it was already computed: records it in design_span_loss"""
if hasattr(node, "design_span_loss"):
return node.design_span_loss
def span_loss(network, node):
"""Total loss of a span (Fiber and Fused nodes) which contains the given node"""
loss = node.loss if node.passive else 0
loss += sum(n.loss for n in prev_node_generator(network, node))
loss += sum(n.loss for n in next_node_generator(network, node))
# add the possible Raman gain
gain = estimate_raman_gain(node, equipment, input_power)
gain += sum(estimate_raman_gain(n, equipment, input_power) for n in prev_node_generator(network, node))
gain += sum(estimate_raman_gain(n, equipment, input_power) for n in next_node_generator(network, node))
return loss - gain
return loss
def find_first_node(network, node):
@@ -290,48 +232,46 @@ def set_amplifier_voa(amp, power_target, power_mode):
amp.out_voa = voa
def set_egress_amplifier(network, this_node, equipment, pref_ch_db, pref_total_db, verbose):
"""This node can be a transceiver or a ROADM (same function called in both cases).
go through each link staring from this_node until next Roadm or Transceiver and
set gain and delta_p according to configurations set by user.
power_mode = True, set amplifiers delta_p and effective_gain
power_mode = False, set amplifiers effective_gain and ignore delta_p config: set it to None
def set_egress_amplifier(network, this_node, equipment, pref_ch_db, pref_total_db):
""" this node can be a transceiver or a ROADM (same function called in both cases)
"""
power_mode = equipment['Span']['default'].power_mode
next_oms = (n for n in network.successors(this_node) if not isinstance(n, elements.Transceiver))
this_node_degree = {k: v for k, v in this_node.per_degree_pch_out_db.items()} if hasattr(this_node, 'per_degree_pch_out_db') else {}
for oms in next_oms:
# go through all the OMS departing from the ROADM
prev_node = this_node
node = oms
if isinstance(this_node, elements.Transceiver):
# todo change pref to a ref channel
if equipment['SI']['default'].tx_power_dbm is not None:
this_node_out_power = equipment['SI']['default'].tx_power_dbm
else:
this_node_out_power = pref_ch_db
if isinstance(this_node, elements.Roadm):
# get target power out from ROADM for the reference carrier based on equalization settings
this_node_out_power = this_node.get_per_degree_ref_power(degree=node.uid)
# if isinstance(next_node, elements.Fused): #support ROADM wo egress amp for metro applications
# node = find_last_node(next_node)
# next_node = next(n for n in network.successors(node))
# next_node = find_last_node(next_node)
if node.uid not in this_node_degree:
# if no target power is defined on this degree or no per degree target power is given use the global one
# if target_pch_out_db is not an attribute, then the element must be a transceiver
this_node_degree[node.uid] = getattr(this_node.params, 'target_pch_out_db', 0)
# use the target power on this degree
prev_dp = this_node_out_power - pref_ch_db
prev_dp = this_node_degree[node.uid] - pref_ch_db
dp = prev_dp
prev_voa = 0
voa = 0
visited_nodes = []
while not (isinstance(node, elements.Roadm) or isinstance(node, elements.Transceiver)):
# go through all nodes in the OMS (loop until next Roadm instance)
next_node = get_next_node(node, network)
try:
next_node = next(network.successors(node))
except StopIteration:
raise NetworkTopologyError(f'{type(node).__name__} {node.uid} is not properly connected, please check network topology')
visited_nodes.append(node)
if next_node in visited_nodes:
raise NetworkTopologyError(f'Loop detected for {type(node).__name__} {node.uid}, '
+ 'please check network topology')
raise NetworkTopologyError(f'Loop detected for {type(node).__name__} {node.uid}, please check network topology')
if isinstance(node, elements.Edfa):
node_loss = span_loss(network, prev_node, equipment)
node_loss = span_loss(network, prev_node)
voa = node.out_voa if node.out_voa else 0
if node.operational.delta_p is None:
dp = target_power(network, next_node, equipment) + voa
if node.delta_p is None:
dp = target_power(network, next_node, equipment)
else:
dp = node.operational.delta_p
dp = node.delta_p
if node.effective_gain is None or power_mode:
gain_target = node_loss + dp - prev_dp + prev_voa
else: # gain mode with effective_gain
@@ -342,8 +282,8 @@ def set_egress_amplifier(network, this_node, equipment, pref_ch_db, pref_total_d
if isinstance(prev_node, elements.Fiber):
max_fiber_lineic_loss_for_raman = \
equipment['Span']['default'].max_fiber_lineic_loss_for_raman * 1e-3 # dB/m
raman_allowed = (prev_node.params.loss_coef < max_fiber_lineic_loss_for_raman).all()
equipment['Span']['default'].max_fiber_lineic_loss_for_raman
raman_allowed = prev_node.params.loss_coef < max_fiber_lineic_loss_for_raman
else:
raman_allowed = False
@@ -358,246 +298,48 @@ def set_egress_amplifier(network, this_node, equipment, pref_ch_db, pref_total_d
restrictions = next_node.restrictions['preamp_variety_list']
else:
restrictions = None
edfa_variety, power_reduction = select_edfa(raman_allowed, gain_target, power_target, equipment,
node.uid, restrictions, verbose)
edfa_variety, power_reduction = select_edfa(raman_allowed, gain_target, power_target, equipment, node.uid, restrictions)
extra_params = equipment['Edfa'][edfa_variety]
node.params.update_params(extra_params.__dict__)
dp += power_reduction
gain_target += power_reduction
elif node.params.raman and not raman_allowed:
print(f'{ansi_escapes.red}WARNING{ansi_escapes.reset}: raman is used in node {node.uid}\n but fiber lineic loss is above threshold\n')
else:
# Check power saturation also in this case
p_max = equipment['Edfa'][node.params.type_variety].p_max
if power_mode:
power_reduction = min(0, p_max - (pref_total_db + dp))
else:
pout = pref_total_db + prev_dp - node_loss - prev_voa + gain_target
power_reduction = min(0, p_max - pout)
dp += power_reduction
gain_target += power_reduction
if node.params.raman and not raman_allowed:
if isinstance(prev_node, elements.Fiber):
logger.warning(f'\n\tWARNING: raman is used in node {node.uid}\n '
+ '\tbut fiber lineic loss is above threshold\n')
else:
logger.critical(f'\n\tWARNING: raman is used in node {node.uid}\n '
+ '\tbut previous node is not a fiber\n')
# if variety is imposed by user, and if the gain_target (computed or imposed) is also above
# variety max gain + extended range, then warn that gain > max_gain + extended range
if gain_target - equipment['Edfa'][node.params.type_variety].gain_flatmax - \
equipment['Span']['default'].target_extended_gain > 1e-2 and verbose:
equipment['Span']['default'].target_extended_gain > 1e-2:
# 1e-2 to allow a small margin according to round2float min step
logger.warning(f'\n\tWARNING: effective gain in Node {node.uid}\n'
+ f'\tis above user specified amplifier {node.params.type_variety}\n'
+ '\tmax flat gain: '
+ f'{equipment["Edfa"][node.params.type_variety].gain_flatmax}dB ; '
+ f'required gain: {round(gain_target, 2)}dB. Please check amplifier type.\n')
print(f'{ansi_escapes.red}WARNING{ansi_escapes.reset}: '
f'WARNING: effective gain in Node {node.uid} is above user '
f'specified amplifier {node.params.type_variety}\n'
f'max flat gain: {equipment["Edfa"][node.params.type_variety].gain_flatmax}dB ; '
f'required gain: {gain_target}dB. Please check amplifier type.')
node.delta_p = dp if power_mode else None
node.effective_gain = gain_target
# if voa is not set, then set it and possibly optimize it with gain and update delta_p and
# effective_gain values
set_amplifier_voa(node, power_target, power_mode)
# set_amplifier_voa may change delta_p in power_mode
node._delta_p = node.delta_p if power_mode else dp
# target_pch_out_dbm records target power for design: If user defines one, then this is displayed,
# else display the one computed during design
if node.delta_p is not None and node.operational.delta_p is not None:
# use the user defined target
node.target_pch_out_dbm = round(node.operational.delta_p + pref_ch_db, 2)
elif node.delta_p is not None:
# use the design target if no target were set
node.target_pch_out_dbm = round(node.delta_p + pref_ch_db, 2)
elif node.delta_p is None:
node.target_pch_out_dbm = None
elif isinstance(node, elements.RamanFiber):
_ = span_loss(network, node, equipment, input_power=pref_ch_db + dp)
prev_dp = dp
prev_voa = voa
prev_node = node
node = next_node
# print(f'{node.uid}')
def set_roadm_ref_carrier(roadm, equipment):
"""ref_carrier records carrier information used for design and usefull for equalization
"""
roadm.ref_carrier = ReferenceCarrier(baud_rate=equipment['SI']['default'].baud_rate,
slot_width=equipment['SI']['default'].spacing)
def set_roadm_per_degree_targets(roadm, network):
"""Set target powers/PSD on all degrees
This is needed to populate per_degree_pch_out_dbm or per_degree_pch_psd or per_degree_pch_psw dicts when
they are not initialized by users.
"""
next_oms = (n for n in network.successors(roadm) if not isinstance(n, elements.Transceiver))
for node in next_oms:
# go through all the OMS departing from the ROADM
if node.uid not in roadm.per_degree_pch_out_dbm and node.uid not in roadm.per_degree_pch_psd and \
node.uid not in roadm.per_degree_pch_psw:
# if no target power is defined on this degree or no per degree target power is given use the global one
if roadm.params.target_pch_out_db:
roadm.per_degree_pch_out_dbm[node.uid] = roadm.params.target_pch_out_db
elif roadm.params.target_psd_out_mWperGHz:
roadm.per_degree_pch_psd[node.uid] = roadm.params.target_psd_out_mWperGHz
elif roadm.params.target_out_mWperSlotWidth:
roadm.per_degree_pch_psw[node.uid] = roadm.params.target_out_mWperSlotWidth
else:
raise ConfigurationError(roadm.uid, 'needs an equalization target')
def set_roadm_input_powers(network, roadm, equipment, pref_ch_db):
"""Set reference powers at ROADM input for a reference channel and based on the adjacent OMS.
This supposes that there is no dependency on path. For example, the succession:
node power out of element
roadm A (target power -10dBm) -10dBm
fiber A (16 dB loss) -26dBm
roadm B (target power -12dBm) -26dBm
fiber B (10 dB loss) -36dBm
roadm C (target power -14dBm) -36dBm
is not consistent because target powers in roadm B and roadm C can not be met.
input power for the reference channel will be set -26 dBm in roadm B and -22dBm in roadm C,
because at design time we can not know about path.
The function raises a warning if target powers can not be met with the design.
User should be aware that design was not successfull and that power reduction was applied.
Note that this value is only used for visualisation purpose (to compute ROADM loss in elements).
"""
previous_elements = [n for n in network.predecessors(roadm)]
roadm.ref_pch_in_dbm = {}
for element in previous_elements:
node = element
loss = 0.0
while isinstance(node, (elements.Fiber, elements.Fused, elements.RamanFiber)):
# go through all predecessors until a power target is found either in an amplifier, a ROADM or a transceiver
# then deduce power at ROADM input from this degree based on this target and crossed losses
loss += node.loss
previous_node = node
node = next(network.predecessors(node))
if isinstance(node, elements.Edfa):
roadm.ref_pch_in_dbm[element.uid] = pref_ch_db + node._delta_p - node.out_voa - loss
elif isinstance(node, elements.Roadm):
roadm.ref_pch_in_dbm[element.uid] = \
node.get_per_degree_ref_power(degree=previous_node.uid) - loss
elif isinstance(node, elements.Transceiver):
roadm.ref_pch_in_dbm[element.uid] = pref_ch_db - loss
# check if target power can be met
temp = []
if roadm.per_degree_pch_out_dbm:
temp.append(max([p for p in roadm.per_degree_pch_out_dbm.values()]))
if roadm.per_degree_pch_psd:
temp.append(max([psd2powerdbm(p, roadm.ref_carrier.baud_rate) for p in roadm.per_degree_pch_psd.values()]))
if roadm.per_degree_pch_psw:
temp.append(max([psd2powerdbm(p, roadm.ref_carrier.slot_width) for p in roadm.per_degree_pch_psw.values()]))
if roadm.params.target_pch_out_db:
temp.append(roadm.params.target_pch_out_db)
if roadm.params.target_psd_out_mWperGHz:
temp.append(psd2powerdbm(roadm.params.target_psd_out_mWperGHz, roadm.ref_carrier.baud_rate))
if roadm.params.target_out_mWperSlotWidth:
temp.append(psd2powerdbm(roadm.params.target_out_mWperSlotWidth, roadm.ref_carrier.slot_width))
if not temp:
raise ConfigurationError(f'Could not find target power/PSD/PSW in ROADM "{roadm.uid}"')
target_to_be_supported = max(temp)
for from_degree, in_power in roadm.ref_pch_in_dbm.items():
if in_power < target_to_be_supported:
logger.warning(
f'WARNING: maximum target power {target_to_be_supported}dBm '
+ f'in ROADM "{roadm.uid}" can not be met for at least one crossing path. Min input power '
+ f'from "{from_degree}" direction is {round(in_power, 2)}dBm. Please correct input topology.'
)
def set_fiber_input_power(network, fiber, equipment, pref_ch_db):
"""Set reference powers at fiber input for a reference channel.
Supposes that target power out of ROADMs and amplifiers are consistent.
This is only for visualisation purpose
"""
loss = 0.0
node = next(network.predecessors(fiber))
while isinstance(node, elements.Fused):
loss += node.loss
previous_node = node
node = next(network.predecessors(node))
if isinstance(node, (elements.Fiber, elements.RamanFiber)) and node.ref_pch_in_dbm is not None:
fiber.ref_pch_in_dbm = node.ref_pch_in_dbm - loss - node.loss
if isinstance(node, (elements.Fiber, elements.RamanFiber)) and node.ref_pch_in_dbm is None:
set_fiber_input_power(network, node, equipment, pref_ch_db)
fiber.ref_pch_in_dbm = node.ref_pch_in_dbm - loss - node.loss
elif isinstance(node, elements.Roadm):
fiber.ref_pch_in_dbm = \
node.get_per_degree_ref_power(degree=previous_node.uid) - loss
elif isinstance(node, elements.Edfa):
fiber.ref_pch_in_dbm = pref_ch_db + node._delta_p - node.out_voa - loss
elif isinstance(node, elements.Transceiver):
fiber.ref_pch_in_dbm = pref_ch_db - loss
def set_roadm_internal_paths(roadm, network):
"""Set ROADM path types (express, add, drop)
Uses implicit guess if no information is set in ROADM
"""
next_oms = [n.uid for n in network.successors(roadm) if not isinstance(n, elements.Transceiver)]
previous_oms = [n.uid for n in network.predecessors(roadm) if not isinstance(n, elements.Transceiver)]
drop_port = [n.uid for n in network.successors(roadm) if isinstance(n, elements.Transceiver)]
add_port = [n.uid for n in network.predecessors(roadm) if isinstance(n, elements.Transceiver)]
default_express = 'express'
default_add = 'add'
default_drop = 'drop'
# take user defined element impairment id if it exists
correct_from_degrees = []
correct_add = []
correct_to_degrees = []
correct_drop = []
for from_degree in previous_oms:
correct_from_degrees.append(from_degree)
for to_degree in next_oms:
correct_to_degrees.append(to_degree)
impairment_id = roadm.get_per_degree_impairment_id(from_degree, to_degree)
roadm.set_roadm_paths(from_degree=from_degree, to_degree=to_degree, path_type=default_express,
impairment_id=impairment_id)
for drop in drop_port:
correct_drop.append(drop)
impairment_id = roadm.get_per_degree_impairment_id(from_degree, drop)
path_type = roadm.get_path_type_per_id(impairment_id)
# a degree connected to a transceiver MUST be add or drop
# but a degree connected to something else could be an express, add or drop
# (for example case of external shelves)
if path_type and path_type != 'drop':
msg = f'Roadm {roadm.uid} path_type is defined as {path_type} but it should be drop'
raise NetworkTopologyError(msg)
roadm.set_roadm_paths(from_degree=from_degree, to_degree=drop, path_type=default_drop,
impairment_id=impairment_id)
for to_degree in next_oms:
for add in add_port:
correct_add.append(add)
impairment_id = roadm.get_per_degree_impairment_id(add, to_degree)
path_type = roadm.get_path_type_per_id(impairment_id)
if path_type and path_type != 'add':
msg = f'Roadm {roadm.uid} path_type is defined as {path_type} but it should be add'
raise NetworkTopologyError(msg)
roadm.set_roadm_paths(from_degree=add, to_degree=to_degree, path_type=default_add,
impairment_id=impairment_id)
# sanity check: raise an error if per_degree from or to degrees are not in the correct list
# raise an error if user defined path_type is not consistent with inferred path_type:
for item in roadm.per_degree_impairments.values():
if item['from_degree'] not in correct_from_degrees + correct_add or \
item['to_degree'] not in correct_to_degrees + correct_drop:
msg = f'Roadm {roadm.uid} has wrong from-to degree uid {item["from_degree"]} - {item["to_degree"]}'
raise NetworkTopologyError(msg)
if isinstance(this_node, elements.Roadm):
this_node.per_degree_pch_out_db = {k: v for k, v in this_node_degree.items()}
def add_roadm_booster(network, roadm):
next_nodes = [n for n in network.successors(roadm)
if not (isinstance(n, elements.Transceiver) or isinstance(n, elements.Fused)
or isinstance(n, elements.Edfa))]
if not (isinstance(n, elements.Transceiver) or isinstance(n, elements.Fused) or isinstance(n, elements.Edfa))]
# no amplification for fused spans or TRX
for next_node in next_nodes:
network.remove_edge(roadm, next_node)
amp = elements.Edfa(
uid=f'Edfa_booster_{roadm.uid}_to_{next_node.uid}',
params=EdfaParams.default_values,
params={},
metadata={
'location': {
'latitude': roadm.lat,
@@ -623,7 +365,7 @@ def add_roadm_preamp(network, roadm):
network.remove_edge(prev_node, roadm)
amp = elements.Edfa(
uid=f'Edfa_preamp_{roadm.uid}_from_{prev_node.uid}',
params=EdfaParams.default_values,
params={},
metadata={
'location': {
'latitude': roadm.lat,
@@ -646,13 +388,13 @@ def add_roadm_preamp(network, roadm):
def add_inline_amplifier(network, fiber):
next_node = get_next_node(fiber, network)
next_node = next(network.successors(fiber))
if isinstance(next_node, elements.Fiber) or isinstance(next_node, elements.RamanFiber):
# no amplification for fused spans or TRX
network.remove_edge(fiber, next_node)
amp = elements.Edfa(
uid=f'Edfa_{fiber.uid}',
params=EdfaParams.default_values,
params={},
metadata={
'location': {
'latitude': (fiber.lat + next_node.lat) / 2,
@@ -671,9 +413,6 @@ def add_inline_amplifier(network, fiber):
def calculate_new_length(fiber_length, bounds, target_length):
"""If fiber is over boundary, then assume this is a link "intent" and computes the set of
identical fiber spans this link should be composed of.
"""
if fiber_length < bounds.stop:
return fiber_length, 1
@@ -687,27 +426,13 @@ def calculate_new_length(fiber_length, bounds, target_length):
return (length1, n_spans1)
elif (bounds.start <= length2 <= bounds.stop) and not(bounds.start <= length1 <= bounds.stop):
return (length2, n_spans2)
elif length2 - target_length <= target_length - length1 and length2 <= bounds.stop:
return (length2, n_spans2)
else:
elif target_length - length1 < length2 - target_length:
return (length1, n_spans1)
else:
return (length2, n_spans2)
def get_next_node(node, network):
"""get_next node else raise tha appropriate error
"""
try:
next_node = next(network.successors(node))
return next_node
except StopIteration:
raise NetworkTopologyError(
f'{type(node).__name__} {node.uid} is not properly connected, please check network topology')
def split_fiber(network, fiber, bounds, target_length):
"""If fiber length exceeds boundary then assume this is a link "intent", and replace this one-span link
with an n_spans link, with identical fiber types.
"""
def split_fiber(network, fiber, bounds, target_length, equipment):
new_length, n_spans = calculate_new_length(fiber.params.length, bounds, target_length)
if n_spans == 1:
return
@@ -750,10 +475,11 @@ def split_fiber(network, fiber, bounds, target_length):
def add_connector_loss(network, fibers, default_con_in, default_con_out, EOL):
"""Add default connector loss if no loss are defined. EOL repair margin is added as a connector loss
"""
for fiber in fibers:
next_node = get_next_node(fiber, network)
try:
next_node = next(network.successors(fiber))
except StopIteration:
raise NetworkTopologyError(f'Fiber {fiber.uid} is not properly connected, please check network topology')
if fiber.params.con_in is None:
fiber.params.con_in = default_con_in
if fiber.params.con_out is None:
@@ -762,18 +488,19 @@ def add_connector_loss(network, fibers, default_con_in, default_con_out, EOL):
fiber.params.con_out += EOL
def add_fiber_padding(network, fibers, padding, equipment):
"""Add a padding att_in at the input of the 1st fiber of a succession of fibers and fused
"""
def add_fiber_padding(network, fibers, padding):
"""last_fibers = (fiber for n in network.nodes()
if not (isinstance(n, elements.Fiber) or isinstance(n, elements.Fused))
for fiber in network.predecessors(n)
if isinstance(fiber, elements.Fiber))"""
for fiber in fibers:
next_node = get_next_node(fiber, network)
try:
next_node = next(network.successors(fiber))
except StopIteration:
raise NetworkTopologyError(f'Fiber {fiber.uid} is not properly connected, please check network topology')
if isinstance(next_node, elements.Fused):
continue
# do not pad if this is a Raman Fiber
if isinstance(fiber, elements.RamanFiber):
continue
this_span_loss = span_loss(network, fiber, equipment)
fiber.design_span_loss = this_span_loss
this_span_loss = span_loss(network, fiber)
if this_span_loss < padding:
# add a padding att_in at the input of the 1st fiber:
# address the case when several fibers are spliced together
@@ -782,69 +509,38 @@ def add_fiber_padding(network, fibers, padding, equipment):
# just after a roadm: need to check that first_fiber is really a fiber
if isinstance(first_fiber, elements.Fiber):
first_fiber.params.att_in = first_fiber.params.att_in + padding - this_span_loss
fiber.design_span_loss += first_fiber.params.att_in
def add_missing_elements_in_network(network, equipment):
"""Autodesign network: add missing elements. split fibers if their length is too big
add ROADM preamp or booster and inline amplifiers between fibers
"""
def build_network(network, equipment, pref_ch_db, pref_total_db):
default_span_data = equipment['Span']['default']
max_length = int(convert_length(default_span_data.max_length, default_span_data.length_units))
min_length = max(int(default_span_data.padding / 0.2 * 1e3), 50_000)
bounds = range(min_length, max_length)
target_length = max(min_length, min(max_length, 90_000))
target_length = max(min_length, 90_000)
# set roadm loss for gain_mode before to build network
fibers = [f for f in network.nodes() if isinstance(f, elements.Fiber)]
add_connector_loss(network, fibers, default_span_data.con_in, default_span_data.con_out, default_span_data.EOL)
add_fiber_padding(network, fibers, default_span_data.padding)
# don't group split fiber and add amp in the same loop
# =>for code clarity (at the expense of speed):
for fiber in fibers:
split_fiber(network, fiber, bounds, target_length)
split_fiber(network, fiber, bounds, target_length, equipment)
roadms = [r for r in network.nodes() if isinstance(r, elements.Roadm)]
for roadm in roadms:
add_roadm_preamp(network, roadm)
add_roadm_booster(network, roadm)
fibers = [f for f in network.nodes() if isinstance(f, elements.Fiber)]
for fiber in fibers:
add_inline_amplifier(network, fiber)
def add_missing_fiber_attributes(network, equipment):
"""Fill in connector loss with default values. Add the padding loss is required.
EOL is added as a connector loss
"""
default_span_data = equipment['Span']['default']
fibers = [f for f in network.nodes() if isinstance(f, elements.Fiber)]
add_connector_loss(network, fibers, default_span_data.con_in, default_span_data.con_out, default_span_data.EOL)
# don't group split fiber and add amp in the same loop
# =>for code clarity (at the expense of speed):
add_fiber_padding(network, fibers, default_span_data.padding, equipment)
def build_network(network, equipment, pref_ch_db, pref_total_db, set_connector_losses=True, verbose=True):
"""Set roadm equalization target and amplifier gain and power
"""
roadms = [r for r in network.nodes() if isinstance(r, elements.Roadm)]
transceivers = [t for t in network.nodes() if isinstance(t, elements.Transceiver)]
if set_connector_losses:
add_missing_fiber_attributes(network, equipment)
# set roadm equalization targets first
for roadm in roadms:
set_roadm_ref_carrier(roadm, equipment)
set_roadm_per_degree_targets(roadm, network)
# then set amplifiers gain, delta_p and out_voa on each OMS
for roadm in roadms + transceivers:
set_egress_amplifier(network, roadm, equipment, pref_ch_db, pref_total_db, verbose)
for roadm in roadms:
set_roadm_input_powers(network, roadm, equipment, pref_ch_db)
set_roadm_internal_paths(roadm, network)
for fiber in [f for f in network.nodes() if isinstance(f, (elements.Fiber, elements.RamanFiber))]:
set_fiber_input_power(network, fiber, equipment, pref_ch_db)
set_egress_amplifier(network, roadm, equipment, pref_ch_db, pref_total_db)
def design_network(reference_channel, network, equipment, set_connector_losses=True, verbose=True):
"""Network is designed according to reference channel. Verbose indicate if the function should
print all warnings or not
"""
pref_ch_db = watt2dbm(reference_channel.power) # reference channel power
pref_total_db = pref_ch_db + lin2db(reference_channel.nb_channel) # reference total power
build_network(network, equipment, pref_ch_db, pref_total_db, set_connector_losses=set_connector_losses,
verbose=verbose)
trx = [t for t in network.nodes() if isinstance(t, elements.Transceiver)]
for t in trx:
next_node = next(network.successors(t), None)
if next_node and not isinstance(next_node, elements.Roadm):
set_egress_amplifier(network, t, equipment, 0, pref_total_db)

View File

@@ -7,12 +7,11 @@ gnpy.core.parameters
This module contains all parameters to configure standard network elements.
"""
from collections import namedtuple
from scipy.constants import c, pi
from numpy import asarray, array, exp, sqrt, log, outer, ones, squeeze, append, flip, linspace, full
from numpy import squeeze, log10, exp
from gnpy.core.utils import convert_length
from gnpy.core.utils import db2lin, convert_length
from gnpy.core.exceptions import ParametersError
@@ -29,228 +28,110 @@ class Parameters:
class PumpParams(Parameters):
def __init__(self, power, frequency, propagation_direction):
self.power = power
self.frequency = frequency
self.propagation_direction = propagation_direction.lower()
self._power = power
self._frequency = frequency
self._propagation_direction = propagation_direction
@property
def power(self):
return self._power
@property
def frequency(self):
return self._frequency
@property
def propagation_direction(self):
return self._propagation_direction
class RamanParams(Parameters):
def __init__(self, flag=False, result_spatial_resolution=10e3, solver_spatial_resolution=50):
"""Simulation parameters used within the Raman Solver
def __init__(self, **kwargs):
self._flag_raman = kwargs['flag_raman']
self._space_resolution = kwargs['space_resolution'] if 'space_resolution' in kwargs else None
self._tolerance = kwargs['tolerance'] if 'tolerance' in kwargs else None
:params flag: boolean for enabling/disable the evaluation of the Raman power profile in frequency and position
:params result_spatial_resolution: spatial resolution of the evaluated Raman power profile
:params solver_spatial_resolution: spatial step for the iterative solution of the first order ode
"""
self.flag = flag
self.result_spatial_resolution = result_spatial_resolution # [m]
self.solver_spatial_resolution = solver_spatial_resolution # [m]
@property
def flag_raman(self):
return self._flag_raman
def to_json(self):
return {"flag": self.flag,
"result_spatial_resolution": self.result_spatial_resolution,
"solver_spatial_resolution": self.solver_spatial_resolution}
@property
def space_resolution(self):
return self._space_resolution
@property
def tolerance(self):
return self._tolerance
class NLIParams(Parameters):
def __init__(self, method='gn_model_analytic', dispersion_tolerance=1, phase_shift_tolerance=0.1,
computed_channels=None, computed_number_of_channels=None):
"""Simulation parameters used within the Nli Solver
def __init__(self, **kwargs):
self._nli_method_name = kwargs['nli_method_name']
self._wdm_grid_size = kwargs['wdm_grid_size']
self._dispersion_tolerance = kwargs['dispersion_tolerance']
self._phase_shift_tolerance = kwargs['phase_shift_tolerance']
self._f_cut_resolution = None
self._f_pump_resolution = None
self._computed_channels = kwargs['computed_channels'] if 'computed_channels' in kwargs else None
:params method: formula for NLI calculation
:params dispersion_tolerance: tuning parameter for ggn model solution
:params phase_shift_tolerance: tuning parameter for ggn model solution
:params computed_channels: the NLI is evaluated for these channels and extrapolated for the others
:params computed_number_of_channels: the NLI is evaluated for this number of channels equally distributed
in the spectrum and extrapolated for the others
"""
self.method = method.lower()
self.dispersion_tolerance = dispersion_tolerance
self.phase_shift_tolerance = phase_shift_tolerance
self.computed_channels = computed_channels
self.computed_number_of_channels = computed_number_of_channels
@property
def nli_method_name(self):
return self._nli_method_name
def to_json(self):
return {"method": self.method,
"dispersion_tolerance": self.dispersion_tolerance,
"phase_shift_tolerance": self.phase_shift_tolerance,
"computed_channels": self.computed_channels,
"computed_number_of_channels": self.computed_number_of_channels}
@property
def wdm_grid_size(self):
return self._wdm_grid_size
@property
def dispersion_tolerance(self):
return self._dispersion_tolerance
@property
def phase_shift_tolerance(self):
return self._phase_shift_tolerance
@property
def f_cut_resolution(self):
return self._f_cut_resolution
@f_cut_resolution.setter
def f_cut_resolution(self, f_cut_resolution):
self._f_cut_resolution = f_cut_resolution
@property
def f_pump_resolution(self):
return self._f_pump_resolution
@f_pump_resolution.setter
def f_pump_resolution(self, f_pump_resolution):
self._f_pump_resolution = f_pump_resolution
@property
def computed_channels(self):
return self._computed_channels
class SimParams(Parameters):
_shared_dict = {'nli_params': NLIParams(), 'raman_params': RamanParams()}
@classmethod
def set_params(cls, sim_params):
cls._shared_dict['nli_params'] = NLIParams(**sim_params.get('nli_params', {}))
cls._shared_dict['raman_params'] = RamanParams(**sim_params.get('raman_params', {}))
def __init__(self, **kwargs):
try:
if 'nli_parameters' in kwargs:
self._nli_params = NLIParams(**kwargs['nli_parameters'])
else:
self._nli_params = None
if 'raman_parameters' in kwargs:
self._raman_params = RamanParams(**kwargs['raman_parameters'])
else:
self._raman_params = None
except KeyError as e:
raise ParametersError(f'Simulation parameters must include {e}. Configuration: {kwargs}')
@property
def nli_params(self):
return self._shared_dict['nli_params']
return self._nli_params
@property
def raman_params(self):
return self._shared_dict['raman_params']
class RoadmParams(Parameters):
def __init__(self, **kwargs):
self.target_pch_out_db = kwargs.get('target_pch_out_db')
self.target_psd_out_mWperGHz = kwargs.get('target_psd_out_mWperGHz')
self.target_out_mWperSlotWidth = kwargs.get('target_out_mWperSlotWidth')
equalisation_type = ['target_pch_out_db', 'target_psd_out_mWperGHz', 'target_out_mWperSlotWidth']
temp = [kwargs.get(k) is not None for k in equalisation_type]
if sum(temp) > 1:
raise ParametersError('ROADM config contains more than one equalisation type.'
+ 'Please choose only one', kwargs)
self.per_degree_pch_out_db = kwargs.get('per_degree_pch_out_db', {})
self.per_degree_pch_psd = kwargs.get('per_degree_psd_out_mWperGHz', {})
self.per_degree_pch_psw = kwargs.get('per_degree_psd_out_mWperSlotWidth', {})
try:
self.add_drop_osnr = kwargs['add_drop_osnr']
self.pmd = kwargs['pmd']
self.pdl = kwargs['pdl']
self.restrictions = kwargs['restrictions']
self.roadm_path_impairments = self.get_roadm_path_impairments(kwargs['roadm-path-impairments'])
except KeyError as e:
raise ParametersError(f'ROADM configurations must include {e}. Configuration: {kwargs}')
self.per_degree_impairments = kwargs.get('per_degree_impairments', [])
def get_roadm_path_impairments(self, path_impairments_list):
"""Get the ROADM list of profiles for impairments definition
transform the ietf model into gnpy internal model: add a path-type in the attributes
"""
if not path_impairments_list:
return {}
authorized_path_types = {
'roadm-express-path': 'express',
'roadm-add-path': 'add',
'roadm-drop-path': 'drop',
}
roadm_path_impairments = {}
for path_impairment in path_impairments_list:
index = path_impairment['roadm-path-impairments-id']
path_type = next(key for key in path_impairment if key in authorized_path_types.keys())
impairment_dict = dict({'path-type': authorized_path_types[path_type]}, **path_impairment[path_type][0])
roadm_path_impairments[index] = RoadmImpairment(impairment_dict)
return roadm_path_impairments
class RoadmPath:
def __init__(self, from_degree, to_degree, path_type, impairment_id=None, impairment=None):
"""Records roadm internal paths, types and impairment
path_type must be in "express", "add", "drop"
impairment_id must be one of the id detailed in equipement
"""
self.from_degree = from_degree
self.to_degree = to_degree
self.path_type = path_type
self.impairment_id = impairment_id
self.impairment = impairment
class RoadmImpairment:
"""Generic definition of impairments for express, add and drop"""
def __init__(self, params):
"""Records roadm internal paths and types"""
self.path_type = params.get('path-type')
self.pmd = params.get('roadm-pmd')
self.cd = params.get('roadm-cd')
self.pdl = params.get('roadm-pdl')
self.inband_crosstalk = params.get('roadm-inband-crosstalk')
self.maxloss = params.get('roadm-maxloss', 0)
if params.get('frequency-range') is not None:
self.fmin = params.get('frequency-range')['lower-frequency']
self.fmax = params.get('frequency-range')['upper-frequency']
else:
self.fmin, self.fmax = None, None
self.osnr = params.get('roadm-osnr', None)
self.pmax = params.get('roadm-pmax', None)
self.nf = params.get('roadm-noise-figure', None)
self.minloss = params.get('minloss', None)
self.typloss = params.get('typloss', None)
self.pmin = params.get('pmin', None)
self.ptyp = params.get('ptyp', None)
class FusedParams(Parameters):
def __init__(self, **kwargs):
self.loss = kwargs['loss'] if 'loss' in kwargs else 1
DEFAULT_RAMAN_COEFFICIENT = {
# SSMF Raman coefficient profile in terms of mode intensity (g0 * A_ff_overlap)
'gamma_raman': array(
[0.0, 8.524419934705497e-16, 2.643567866245371e-15, 4.410548410941305e-15, 6.153422961291078e-15,
7.484924703044943e-15, 8.452060808349209e-15, 9.101549322698156e-15, 9.57837595158966e-15,
1.0008642675474562e-14, 1.0865773569905647e-14, 1.1300776305865833e-14, 1.2143238647099625e-14,
1.3231065750676068e-14, 1.4624900971525384e-14, 1.6013330554840492e-14, 1.7458119359310242e-14,
1.9320241330434762e-14, 2.1720395392873534e-14, 2.4137337406734775e-14, 2.628163218460466e-14,
2.8041019963285974e-14, 2.9723155447089933e-14, 3.129353531005888e-14, 3.251796163324624e-14,
3.3198839487612773e-14, 3.329527690685666e-14, 3.313155691238456e-14, 3.289013852154548e-14,
3.2458917188506916e-14, 3.060684277937575e-14, 3.2660349473783173e-14, 2.957419109657689e-14,
2.518894321396672e-14, 1.734560485857344e-14, 9.902860761605233e-15, 7.219176385099358e-15,
6.079565990401311e-15, 5.828373065963427e-15, 7.20580801091692e-15, 7.561924351387493e-15,
7.621152352332206e-15, 6.8859886780643254e-15, 5.629181047471162e-15, 3.679727598966185e-15,
2.7555869742500355e-15, 2.4810133942597675e-15, 2.2160080532403624e-15, 2.1440626024765557e-15,
2.33873070799544e-15, 2.557317929858713e-15, 3.039839048226572e-15, 4.8337165515610065e-15,
5.4647431818257436e-15, 5.229187813711269e-15, 4.510768525811313e-15, 3.3213473130607794e-15,
2.2602577027996455e-15, 1.969576495866441e-15, 1.5179853954188527e-15, 1.2953988551200156e-15,
1.1304672156251838e-15, 9.10004390675213e-16, 8.432919922183503e-16, 7.849224069008326e-16,
7.827568196032024e-16, 9.000514440646232e-16, 1.3025926460013665e-15, 1.5444108938497558e-15,
1.8795594063060786e-15, 1.7796130169921014e-15, 1.5938159865046653e-15, 1.1585522355108287e-15,
8.507044444633358e-16, 7.625404663756823e-16, 8.14510750925789e-16, 9.047944693473188e-16,
9.636431901702084e-16, 9.298633899602105e-16, 8.349739503637023e-16, 7.482901278066085e-16,
6.240794767134268e-16, 5.00652535687506e-16, 3.553373263685851e-16, 2.0344217706119682e-16,
1.4267522642294203e-16, 8.980016576743517e-17, 2.9829068181832594e-17, 1.4861959129014824e-17,
7.404482113326137e-18]
), # m/W
# SSMF Raman coefficient profile
'g0': array(
[0.00000000e+00, 1.12351610e-05, 3.47838074e-05, 5.79356636e-05, 8.06921680e-05, 9.79845709e-05, 1.10454361e-04,
1.18735302e-04, 1.24736889e-04, 1.30110053e-04, 1.41001273e-04, 1.46383247e-04, 1.57011792e-04, 1.70765865e-04,
1.88408911e-04, 2.05914127e-04, 2.24074028e-04, 2.47508283e-04, 2.77729174e-04, 3.08044243e-04, 3.34764439e-04,
3.56481704e-04, 3.77127256e-04, 3.96269124e-04, 4.10955175e-04, 4.18718761e-04, 4.19511263e-04, 4.17025384e-04,
4.13565369e-04, 4.07726048e-04, 3.83671291e-04, 4.08564283e-04, 3.69571936e-04, 3.14442090e-04, 2.16074535e-04,
1.23097823e-04, 8.95457457e-05, 7.52470400e-05, 7.19806145e-05, 8.87961158e-05, 9.30812065e-05, 9.37058268e-05,
8.45719619e-05, 6.90585286e-05, 4.50407159e-05, 3.36521245e-05, 3.02292475e-05, 2.69376939e-05, 2.60020897e-05,
2.82958958e-05, 3.08667558e-05, 3.66024657e-05, 5.80610307e-05, 6.54797937e-05, 6.25022715e-05, 5.37806442e-05,
3.94996621e-05, 2.68120644e-05, 2.33038554e-05, 1.79140757e-05, 1.52472424e-05, 1.32707565e-05, 1.06541760e-05,
9.84649374e-06, 9.13999627e-06, 9.08971012e-06, 1.04227525e-05, 1.50419271e-05, 1.77838232e-05, 2.15810815e-05,
2.03744008e-05, 1.81939341e-05, 1.31862121e-05, 9.65352116e-06, 8.62698322e-06, 9.18688016e-06, 1.01737784e-05,
1.08017817e-05, 1.03903588e-05, 9.30040333e-06, 8.30809173e-06, 6.90650401e-06, 5.52238029e-06, 3.90648708e-06,
2.22908227e-06, 1.55796177e-06, 9.77218716e-07, 3.23477236e-07, 1.60602454e-07, 7.97306386e-08]
), # [1 / (W m)]
# Note the non-uniform spacing of this range; this is required for properly capturing the Raman peak shape.
'frequency_offset': array([
0., 0.5, 1., 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 5.5, 6., 6.5, 7., 7.5, 8., 8.5, 9., 9.5, 10., 10.5, 11., 11.5,
12., 12.5, 12.75, 13., 13.25, 13.5, 14., 14.5, 14.75, 15., 15.5, 16., 16.5, 17., 17.5, 18., 18.25, 18.5, 18.75,
19., 19.5, 20., 20.5, 21., 21.5, 22., 22.5, 23., 23.5, 24., 24.5, 25., 25.5, 26., 26.5, 27., 27.5, 28., 28.5,
29., 29.5, 30., 30.5, 31., 31.5, 32., 32.5, 33., 33.5, 34., 34.5, 35., 35.5, 36., 36.5, 37., 37.5, 38., 38.5,
39., 39.5, 40., 40.5, 41., 41.5, 42.]) * 1e12, # [Hz]
# Raman profile reference frequency
'reference_frequency': 206.184634112792e12, # [Hz] (1454 nm)
# Raman profile reference effective area
'reference_effective_area': 75.74659443542413e-12 # [m^2] (@1454 nm)
}
class RamanGainCoefficient(namedtuple('RamanGainCoefficient', 'normalized_gamma_raman frequency_offset')):
""" Raman Gain Coefficient Parameters
Based on:
Andrea DAmico, Bruno Correia, Elliot London, Emanuele Virgillito, Giacomo Borraccini, Antonio Napoli,
and Vittorio Curri, "Scalable and Disaggregated GGN Approximation Applied to a C+L+S Optical Network,"
J. Lightwave Technol. 40, 3499-3511 (2022)
Section III.D
"""
return self._raman_params
class FiberParams(Parameters):
@@ -258,94 +139,45 @@ class FiberParams(Parameters):
try:
self._length = convert_length(kwargs['length'], kwargs['length_units'])
# fixed attenuator for padding
self._att_in = kwargs.get('att_in', 0)
self._att_in = kwargs['att_in'] if 'att_in' in kwargs else 0
# if not defined in the network json connector loss in/out
# the None value will be updated in network.py[build_network]
# with default values from eqpt_config.json[Spans]
self._con_in = kwargs.get('con_in')
self._con_out = kwargs.get('con_out')
# Reference frequency (unique for all parameters: beta2, beta3, gamma, effective_area)
self._con_in = kwargs['con_in'] if 'con_in' in kwargs else None
self._con_out = kwargs['con_out'] if 'con_out' in kwargs else None
if 'ref_wavelength' in kwargs:
self._ref_wavelength = kwargs['ref_wavelength']
self._ref_frequency = c / self._ref_wavelength
self._ref_frequency = c / self.ref_wavelength
elif 'ref_frequency' in kwargs:
self._ref_frequency = kwargs['ref_frequency']
self._ref_wavelength = c / self._ref_frequency
self._ref_wavelength = c / self.ref_frequency
else:
self._ref_wavelength = 1550e-9 # conventional central C band wavelength [m]
self._ref_frequency = c / self._ref_wavelength
# Chromatic Dispersion
if 'dispersion_per_frequency' in kwargs:
# Frequency-dependent dispersion
self._dispersion = asarray(kwargs['dispersion_per_frequency']['value']) # s/m/m
self._f_dispersion_ref = asarray(kwargs['dispersion_per_frequency']['frequency']) # Hz
self._dispersion_slope = None
elif 'dispersion' in kwargs:
# Single value dispersion
self._dispersion = asarray(kwargs['dispersion']) # s/m/m
self._dispersion_slope = kwargs.get('dispersion_slope') # s/m/m/m
self._f_dispersion_ref = asarray(self._ref_frequency) # Hz
else:
# Default single value dispersion
self._dispersion = asarray(1.67e-05) # s/m/m
self._dispersion_slope = None
self._f_dispersion_ref = asarray(self.ref_frequency) # Hz
# Effective Area and Nonlinear Coefficient
self._effective_area = kwargs.get('effective_area') # m^2
self._n1 = 1.468
self._core_radius = 4.2e-6 # m
self._n2 = 2.6e-20 # m^2/W
if self._effective_area is not None:
default_gamma = 2 * pi * self._n2 / (self._ref_wavelength * self._effective_area)
self._gamma = kwargs.get('gamma', default_gamma) # 1/W/m
elif 'gamma' in kwargs:
self._gamma = kwargs['gamma'] # 1/W/m
self._effective_area = 2 * pi * self._n2 / (self._ref_wavelength * self._gamma) # m^2
else:
self._effective_area = 83e-12 # m^2
self._gamma = 2 * pi * self._n2 / (self._ref_wavelength * self._effective_area) # 1/W/m
self._contrast = 0.5 * (c / (2 * pi * self._ref_frequency * self._core_radius * self._n1) * exp(
pi * self._core_radius ** 2 / self._effective_area)) ** 2
# Raman Gain Coefficient
raman_coefficient = kwargs.get('raman_coefficient')
if raman_coefficient is None:
self._raman_reference_frequency = DEFAULT_RAMAN_COEFFICIENT['reference_frequency']
frequency_offset = asarray(DEFAULT_RAMAN_COEFFICIENT['frequency_offset'])
gamma_raman = asarray(DEFAULT_RAMAN_COEFFICIENT['gamma_raman'])
stokes_wave = self._raman_reference_frequency - frequency_offset
normalized_gamma_raman = gamma_raman / self._raman_reference_frequency # 1 / m / W / Hz
self._g0 = gamma_raman / self.effective_area_overlap(stokes_wave, self._raman_reference_frequency)
else:
self._raman_reference_frequency = raman_coefficient['reference_frequency']
frequency_offset = asarray(raman_coefficient['frequency_offset'])
stokes_wave = self._raman_reference_frequency - frequency_offset
self._g0 = asarray(raman_coefficient['g0'])
gamma_raman = self._g0 * self.effective_area_overlap(stokes_wave, self._raman_reference_frequency)
normalized_gamma_raman = gamma_raman / self._raman_reference_frequency # 1 / m / W / Hz
# Raman gain coefficient array of the frequency offset constructed such that positive frequency values
# represent a positive power transfer from higher frequency and vice versa
frequency_offset = append(-flip(frequency_offset[1:]), frequency_offset)
normalized_gamma_raman = append(- flip(normalized_gamma_raman[1:]), normalized_gamma_raman)
self._raman_coefficient = RamanGainCoefficient(normalized_gamma_raman, frequency_offset)
# Polarization Mode Dispersion
self._ref_wavelength = 1550e-9
self._ref_frequency = c / self.ref_wavelength
self._dispersion = kwargs['dispersion'] # s/m/m
self._dispersion_slope = kwargs['dispersion_slope'] if 'dispersion_slope' in kwargs else \
-2 * self._dispersion/self.ref_wavelength # s/m/m/m
self._beta2 = -(self.ref_wavelength ** 2) * self.dispersion / (2 * pi * c) # 1/(m * Hz^2)
# Eq. (3.23) in Abramczyk, Halina. "Dispersion phenomena in optical fibers." Virtual European University
# on Lasers. Available online: http://mitr.p.lodz.pl/evu/lectures/Abramczyk3.pdf
# (accessed on 25 March 2018) (2005).
self._beta3 = ((self.dispersion_slope - (4*pi*c/self.ref_wavelength**3) * self.beta2) /
(2*pi*c/self.ref_wavelength**2)**2)
self._gamma = kwargs['gamma'] # 1/W/m
self._pmd_coef = kwargs['pmd_coef'] # s/sqrt(m)
# Loss Coefficient
if isinstance(kwargs['loss_coef'], dict):
self._loss_coef = asarray(kwargs['loss_coef']['value']) * 1e-3 # lineic loss dB/m
self._f_loss_ref = asarray(kwargs['loss_coef']['frequency']) # Hz
if type(kwargs['loss_coef']) == dict:
self._loss_coef = squeeze(kwargs['loss_coef']['loss_coef_power']) * 1e-3 # lineic loss dB/m
self._f_loss_ref = squeeze(kwargs['loss_coef']['frequency']) # Hz
else:
self._loss_coef = asarray(kwargs['loss_coef']) * 1e-3 # lineic loss dB/m
self._f_loss_ref = asarray(self._ref_frequency) # Hz
# Lumped Losses
self._lumped_losses = kwargs['lumped_losses'] if 'lumped_losses' in kwargs else array([])
self._latency = self._length / (c / self._n1) # s
self._loss_coef = kwargs['loss_coef'] * 1e-3 # lineic loss dB/m
self._f_loss_ref = 193.5e12 # Hz
self._lin_attenuation = db2lin(self.length * self.loss_coef)
self._lin_loss_exp = self.loss_coef / (10 * log10(exp(1))) # linear power exponent loss Neper/m
self._effective_length = (1 - exp(- self.lin_loss_exp * self.length)) / self.lin_loss_exp
self._asymptotic_length = 1 / self.lin_loss_exp
# raman parameters (not compulsory)
self._raman_efficiency = kwargs['raman_efficiency'] if 'raman_efficiency' in kwargs else None
self._pumps_loss_coef = kwargs['pumps_loss_coef'] if 'pumps_loss_coef' in kwargs else None
except KeyError as e:
raise ParametersError(f'Fiber configurations json must include {e}. Configuration: {kwargs}')
@@ -378,10 +210,6 @@ class FiberParams(Parameters):
def con_out(self):
return self._con_out
@property
def lumped_losses(self):
return self._lumped_losses
@con_out.setter
def con_out(self, con_out):
self._con_out = con_out
@@ -390,10 +218,6 @@ class FiberParams(Parameters):
def dispersion(self):
return self._dispersion
@property
def f_dispersion_ref(self):
return self._f_dispersion_ref
@property
def dispersion_slope(self):
return self._dispersion_slope
@@ -402,20 +226,6 @@ class FiberParams(Parameters):
def gamma(self):
return self._gamma
def effective_area_scaling(self, frequency):
V = 2 * pi * frequency / c * self._core_radius * self._n1 * sqrt(2 * self._contrast)
w = self._core_radius / sqrt(log(V))
return asarray(pi * w ** 2)
def effective_area_overlap(self, frequency_stokes_wave, frequency_pump):
effective_area_stokes_wave = self.effective_area_scaling(frequency_stokes_wave)
effective_area_pump = self.effective_area_scaling(frequency_pump)
return squeeze(outer(effective_area_stokes_wave, ones(effective_area_pump.size)) + outer(
ones(effective_area_stokes_wave.size), effective_area_pump)) / 2
def gamma_scaling(self, frequency):
return asarray(2 * pi * self._n2 * frequency / (c * self.effective_area_scaling(frequency)))
@property
def pmd_coef(self):
return self._pmd_coef
@@ -428,6 +238,14 @@ class FiberParams(Parameters):
def ref_frequency(self):
return self._ref_frequency
@property
def beta2(self):
return self._beta2
@property
def beta3(self):
return self._beta3
@property
def loss_coef(self):
return self._loss_coef
@@ -437,180 +255,31 @@ class FiberParams(Parameters):
return self._f_loss_ref
@property
def raman_coefficient(self):
return self._raman_coefficient
def lin_loss_exp(self):
return self._lin_loss_exp
@property
def latency(self):
return self._latency
def lin_attenuation(self):
return self._lin_attenuation
@property
def effective_length(self):
return self._effective_length
@property
def asymptotic_length(self):
return self._asymptotic_length
@property
def raman_efficiency(self):
return self._raman_efficiency
@property
def pumps_loss_coef(self):
return self._pumps_loss_coef
def asdict(self):
dictionary = super().asdict()
dictionary['loss_coef'] = self.loss_coef * 1e3
dictionary['length_units'] = 'm'
if len(self.lumped_losses) == 0:
dictionary.pop('lumped_losses')
if not self.raman_coefficient:
dictionary.pop('raman_coefficient')
else:
raman_frequency_offset = \
self.raman_coefficient.frequency_offset[self.raman_coefficient.frequency_offset >= 0]
dictionary['raman_coefficient'] = {'g0': self._g0.tolist(),
'frequency_offset': raman_frequency_offset.tolist(),
'reference_frequency': self._raman_reference_frequency}
return dictionary
class EdfaParams:
default_values = {
'f_min': 191.3e12,
'f_max': 196.1e12,
'multi_band': None,
'bands': [],
'type_variety': '',
'type_def': '',
'gain_flatmax': None,
'gain_min': None,
'p_max': None,
'nf_model': None,
'dual_stage_model': None,
'preamp_variety': None,
'booster_variety': None,
'nf_min': None,
'nf_max': None,
'nf_coef': None,
'nf0': None,
'nf_fit_coeff': None,
'nf_ripple': 0,
'dgt': None,
'gain_ripple': 0,
'tilt_ripple': 0,
'f_ripple_ref': None,
'out_voa_auto': False,
'allowed_for_design': False,
'raman': False,
'pmd': 0,
'pdl': 0,
'advance_configurations_from_json': None
}
def __init__(self, **params):
try:
self.type_variety = params['type_variety']
self.type_def = params['type_def']
# Bandwidth
self.f_min = params['f_min']
self.f_max = params['f_max']
self.bandwidth = self.f_max - self.f_min
self.f_cent = (self.f_max + self.f_min) / 2
self.f_ripple_ref = params['f_ripple_ref']
# Gain
self.gain_flatmax = params['gain_flatmax']
self.gain_min = params['gain_min']
gain_ripple = params['gain_ripple']
if gain_ripple == 0:
self.gain_ripple = asarray([0, 0])
self.f_ripple_ref = asarray([self.f_min, self.f_max])
else:
self.gain_ripple = asarray(gain_ripple)
if self.f_ripple_ref is not None:
if (self.f_ripple_ref[0] != self.f_min) or (self.f_ripple_ref[-1] != self.f_max):
raise ParametersError("The reference ripple frequency maximum and minimum have to coincide "
"with the EDFA frequency maximum and minimum.")
elif self.gain_ripple.size != self.f_ripple_ref.size:
raise ParametersError("The reference ripple frequency and the gain ripple must have the same "
"size.")
else:
self.f_ripple_ref = linspace(self.f_min, self.f_max, self.gain_ripple.size)
tilt_ripple = params['tilt_ripple']
if tilt_ripple == 0:
self.tilt_ripple = full(self.gain_ripple.size, 0)
else:
self.tilt_ripple = asarray(tilt_ripple)
if self.tilt_ripple.size != self.gain_ripple.size:
raise ParametersError("The tilt ripple and the gain ripple must have the same size.")
# Power
self.p_max = params['p_max']
# Noise Figure
self.nf_model = params['nf_model']
self.nf_min = params['nf_min']
self.nf_max = params['nf_max']
self.nf_coef = params['nf_coef']
self.nf0 = params['nf0']
self.nf_fit_coeff = params['nf_fit_coeff']
nf_ripple = params['nf_ripple']
if nf_ripple == 0:
self.nf_ripple = full(self.gain_ripple.size, 0)
else:
self.nf_ripple = asarray(nf_ripple)
if self.nf_ripple.size != self.gain_ripple.size:
raise ParametersError("The noise figure ripple and the gain ripple must have the same size.")
# VOA
self.out_voa_auto = params['out_voa_auto']
# Dual Stage
self.dual_stage_model = params['dual_stage_model']
if self.dual_stage_model is not None:
# Preamp
self.preamp_variety = params['preamp_variety']
self.preamp_type_def = params['preamp_type_def']
self.preamp_nf_model = params['preamp_nf_model']
self.preamp_nf_fit_coeff = params['preamp_nf_fit_coeff']
self.preamp_gain_min = params['preamp_gain_min']
self.preamp_gain_flatmax = params['preamp_gain_flatmax']
# Booster
self.booster_variety = params['booster_variety']
self.booster_type_def = params['booster_type_def']
self.booster_nf_model = params['booster_nf_model']
self.booster_nf_fit_coeff = params['booster_nf_fit_coeff']
self.booster_gain_min = params['booster_gain_min']
self.booster_gain_flatmax = params['booster_gain_flatmax']
# Others
self.pmd = params['pmd']
self.pdl = params['pdl']
self.raman = params['raman']
self.dgt = params['dgt']
self.advance_configurations_from_json = params['advance_configurations_from_json']
# Design
self.allowed_for_design = params['allowed_for_design']
except KeyError as e:
raise ParametersError(f'Edfa configurations json must include {e}. Configuration: {params}')
def update_params(self, kwargs):
for k, v in kwargs.items():
setattr(self, k, self.update_params(**v) if isinstance(v, dict) else v)
class EdfaOperational:
default_values = {
'gain_target': None,
'delta_p': None,
'out_voa': None,
'tilt_target': 0
}
def __init__(self, **operational):
self.update_attr(operational)
def update_attr(self, kwargs):
clean_kwargs = {k: v for k, v in kwargs.items() if v != ''}
for k, v in self.default_values.items():
setattr(self, k, clean_kwargs.get(k, v))
def __repr__(self):
return (f'{type(self).__name__}('
f'gain_target={self.gain_target!r}, '
f'tilt_target={self.tilt_target!r})')

File diff suppressed because it is too large Load Diff

View File

@@ -9,9 +9,8 @@ This module contains utility functions that are used with gnpy.
"""
from csv import writer
from numpy import pi, cos, sqrt, log10, linspace, zeros, shape, where, logical_and, mean, array
from numpy import pi, cos, sqrt, log10, linspace, zeros, shape, where, logical_and
from scipy import constants
from copy import deepcopy
from gnpy.core.exceptions import ConfigurationError
@@ -107,69 +106,6 @@ def db2lin(value):
return 10**(value / 10)
def watt2dbm(value):
"""Convert Watt units to dBm
>>> round(watt2dbm(0.001), 1)
0.0
>>> round(watt2dbm(0.02), 1)
13.0
"""
return lin2db(value * 1e3)
def dbm2watt(value):
"""Convert dBm units to Watt
>>> round(dbm2watt(0), 4)
0.001
>>> round(dbm2watt(-3), 4)
0.0005
>>> round(dbm2watt(13), 4)
0.02
"""
return db2lin(value) * 1e-3
def psd2powerdbm(psd_mwperghz, baudrate_baud):
"""computes power in dBm based on baudrate in bauds and psd in mW/GHz
>>> round(psd2powerdbm(0.031176, 64e9),3)
3.0
>>> round(psd2powerdbm(0.062352, 32e9),3)
3.0
>>> round(psd2powerdbm(0.015625, 64e9),3)
0.0
"""
return lin2db(baudrate_baud * psd_mwperghz * 1e-9)
def power_dbm_to_psd_mw_ghz(power_dbm, baudrate_baud):
"""computes power spectral density in mW/GHz based on baudrate in bauds and power in dBm
>>> power_dbm_to_psd_mw_ghz(0, 64e9)
0.015625
>>> round(power_dbm_to_psd_mw_ghz(3, 64e9), 6)
0.031176
>>> round(power_dbm_to_psd_mw_ghz(3, 32e9), 6)
0.062352
"""
return db2lin(power_dbm) / (baudrate_baud * 1e-9)
def psd_mw_per_ghz(power_watt, baudrate_baud):
"""computes power spectral density in mW/GHz based on baudrate in bauds and power in W
>>> psd_mw_per_ghz(2e-3, 32e9)
0.0625
>>> psd_mw_per_ghz(1e-3, 64e9)
0.015625
>>> psd_mw_per_ghz(0.5e-3, 32e9)
0.015625
"""
return power_watt * 1e3 / (baudrate_baud * 1e-9)
def round2float(number, step):
"""Round a floating point number so that its "resolution" is not bigger than 'step'
@@ -213,39 +149,25 @@ wavelength2freq = constants.lambda2nu
freq2wavelength = constants.nu2lambda
def freq2wavelength(value):
""" Converts frequency units to wavelength units.
>>> round(freq2wavelength(191.35e12) * 1e9, 3)
1566.723
>>> round(freq2wavelength(196.1e12) * 1e9, 3)
1528.773
"""
return constants.c / value
def snr_sum(snr, bw, snr_added, bw_added=12.5e9):
snr_added = snr_added - lin2db(bw / bw_added)
snr = -lin2db(db2lin(-snr) + db2lin(-snr_added))
return snr
def per_label_average(values, labels):
"""computes the average per defined spectrum band, using labels
>>> labels = ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'D', 'D', 'D', 'D']
>>> values = [28.51, 28.23, 28.15, 28.17, 28.36, 28.53, 28.64, 28.68, 28.7, 28.71, 28.72, 28.73, 28.74, 28.91, 27.96, 27.85, 27.87, 28.02]
>>> per_label_average(values, labels)
{'A': 28.28, 'B': 28.68, 'C': 28.91, 'D': 27.92}
"""
label_set = sorted(set(labels))
summary = {}
for label in label_set:
vals = [val for val, lab in zip(values, labels) if lab == label]
summary[label] = round(mean(vals), 2)
return summary
def pretty_summary_print(summary):
"""Build a prettty string that shows the summary dict values per label with 2 digits"""
if len(summary) == 1:
return f'{list(summary.values())[0]:.2f}'
text = ', '.join([f'{label}: {value:.2f}' for label, value in summary.items()])
return text
def deltawl2deltaf(delta_wl, wavelength):
"""deltawl2deltaf(delta_wl, wavelength):
""" deltawl2deltaf(delta_wl, wavelength):
delta_wl is BW in wavelength units
wavelength is the center wl
units for delta_wl and wavelength must be same
@@ -263,9 +185,9 @@ def deltawl2deltaf(delta_wl, wavelength):
def deltaf2deltawl(delta_f, frequency):
"""convert delta frequency to delta wavelength
Units for delta_wl and wavelength must be same.
""" deltawl2deltaf(delta_f, frequency):
converts delta frequency to delta wavelength
units for delta_wl and wavelength must be same
:param delta_f: delta frequency in same units as frequency
:param frequency: frequency BW is relevant for
@@ -280,7 +202,8 @@ def deltaf2deltawl(delta_f, frequency):
def rrc(ffs, baud_rate, alpha):
"""compute the root-raised cosine filter function
""" rrc(ffs, baud_rate, alpha): computes the root-raised cosine filter
function.
:param ffs: A numpy array of frequencies
:param baud_rate: The Baud Rate of the System
@@ -306,7 +229,7 @@ def rrc(ffs, baud_rate, alpha):
def merge_amplifier_restrictions(dict1, dict2):
"""Update contents of dicts recursively
"""Updates contents of dicts recursively
>>> d1 = {'params': {'restrictions': {'preamp_variety_list': [], 'booster_variety_list': []}}}
>>> d2 = {'params': {'target_pch_out_db': -20}}
@@ -401,60 +324,3 @@ def convert_length(value, units):
return value * 1e3
else:
raise ConfigurationError(f'Cannot convert length in "{units}" into meters')
def replace_none(dictionary):
""" Replaces None with inf values in a frequency slots dict
>>> replace_none({'N': 3, 'M': None})
{'N': 3, 'M': inf}
"""
for key, val in dictionary.items():
if val is None:
dictionary[key] = float('inf')
if val == float('inf'):
dictionary[key] = None
return dictionary
def order_slots(slots):
""" Order frequency slots from larger slots to smaller ones up to None
>>> l = [{'N': 3, 'M': None}, {'N': 2, 'M': 1}, {'N': None, 'M': None},{'N': 7, 'M': 2},{'N': None, 'M': 1} , {'N': None, 'M': 0}]
>>> order_slots(l)
([7, 2, None, None, 3, None], [2, 1, 1, 0, None, None], [3, 1, 4, 5, 0, 2])
"""
slots_list = deepcopy(slots)
slots_list = [replace_none(e) for e in slots_list]
for i, e in enumerate(slots_list):
e['i'] = i
slots_list = sorted(slots_list, key=lambda x: (-x['M'], x['N']) if x['M'] != float('inf') else (x['M'], x['N']))
slots_list = [replace_none(e) for e in slots_list]
return [e['N'] for e in slots_list], [e['M'] for e in slots_list], [e['i'] for e in slots_list]
def restore_order(elements, order):
""" Use order to re-order the element of the list, and ignore None values
>>> restore_order([7, 2, None, None, 3, None], [3, 1, 4, 5, 0, 2])
[3, 2, 7]
"""
return [elements[i[0]] for i in sorted(enumerate(order), key=lambda x:x[1]) if elements[i[0]] is not None]
def calculate_absolute_min_or_zero(x: array) -> array:
"""Calculates the element-wise absolute minimum between the x and zero.
Parameters:
x (array): The first input array.
Returns:
array: The element-wise absolute minimum between x and zero.
Example:
>>> x = array([-1, 2, -3])
>>> calculate_absolute_min_or_zero(x)
array([1., 0., 3.])
"""
return (abs(x) - x) / 2

View File

@@ -0,0 +1,87 @@
# The GNPy YANG demo at OFC 2021
The demo needs one piece of YANG-formatted data which includes all settings for GNPy as well as the ONOS topology.
This is generated via:
```console-session
$ python gnpy/example-data/2021-demo/generate-demo.py
```
...which puts files into `gnpy/example-data/2021-demo/`.
```console-session
$ FLASK_APP=gnpy.tools.rest_server.app flask run
$ curl -v -X POST -H "Content-Type: application/json" -d @gnpy/example-data/2021-demo/yang.json http://localhost:5000/gnpy-experimental/topology
```
ONOS-formatted `devices.json` and `links.json` are available from the topology:
- `http://localhost:5000/gnpy-experimental/onos/devices`
- `http://localhost:5000/gnpy-experimental/onos/links`
## Misc notes
The version of ONOS I used cannot configure the TX power on our transponders:
```
19:06:08.347 INFO [GnpyManager] Configuring egress with power 0.0 for DefaultDevice{id=netconf:10.0.254.103:830, type=TERMINAL_DEVICE, manufacturer=Infinera, hwVersion=Groove, swVersion=4.0.3, serialNumber=, driver=groove}
19:06:08.348 INFO [TerminalDevicePowerConfig] Setting power <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><running/></target><config><components xmlns="http://openconfig.net/yang/platform"><component><name>OCH-1-1-L1</name><optical-channel xmlns="http://openconfig.net/yang/terminal-device"><config><target-output-power>0.0</target-output-power></config></optical-channel></component></components></config></edit-config></rpc>
19:06:08.349 DEBUG [TerminalDevicePowerConfig] Request <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<components xmlns="http://openconfig.net/yang/platform">
<component>
<name>OCH-1-1-L1</name>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
<config>
<target-output-power>0.0</target-output-power>
</config>
</optical-channel>
</component>
</components>
</config>
</edit-config>
</rpc>
19:06:08.701 DEBUG [TerminalDevicePowerConfig] Response <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="18">
<ok/>
</rpc-reply>
19:06:08.705 WARN [NetconfSessionMinaImpl] Device netconf:administrator@10.0.254.103:830 has error in reply <?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="18">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-not-supported</error-tag>
<error-severity>error</error-severity>
<error-message>Request could not be completed because the requested operation is not supported by this implementation.</error-message>
</rpc-error>
</rpc-reply>
19:06:08.706 ERROR [TerminalDevicePowerConfig] error committing channel power
org.onosproject.netconf.NetconfException: Request not successful with device netconf:administrator@10.0.254.103:830 with reply <?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="18">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-not-supported</error-tag>
<error-severity>error</error-severity>
<error-message>Request could not be completed because the requested operation is not supported by this implementation.</error-message>
</rpc-error>
</rpc-reply>
at org.onosproject.netconf.ctl.impl.NetconfSessionMinaImpl.requestSync(NetconfSessionMinaImpl.java:516) ~[?:?]
at org.onosproject.netconf.ctl.impl.NetconfSessionMinaImpl.requestSync(NetconfSessionMinaImpl.java:509) ~[?:?]
at org.onosproject.netconf.AbstractNetconfSession.commit(AbstractNetconfSession.java:336) ~[?:?]
at org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig$ComponentType.setTargetPower(TerminalDevicePowerConfig.java:401) ~[?:?]
at org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig$ComponentType$1.setTargetPower(TerminalDevicePowerConfig.java:315) ~[?:?]
at org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig.setTargetPower(TerminalDevicePowerConfig.java:222) ~[?:?]
at org.onosproject.odtn.impl.GnpyManager.setPathPower(GnpyManager.java:562) ~[?:?]
at org.onosproject.odtn.impl.GnpyManager$InternalIntentListener.lambda$event$0(GnpyManager.java:509) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
```
Filter out launch power settings.
It's not needed anyway, the very first node after a transponder is a ROADM.

View File

@@ -0,0 +1,11 @@
{
"nf_ripple": [
0.0
],
"gain_ripple": [
0.0
],
"dgt": [
1.0
]
}

View File

@@ -0,0 +1,116 @@
{ "Edfa":[
{
"type_variety": "fixed27",
"type_def": "fixed_gain",
"gain_flatmax": 27,
"gain_min": 27,
"p_max": 21,
"nf0": 5.5,
"allowed_for_design": false
},
{
"type_variety": "fixed22",
"type_def": "fixed_gain",
"gain_flatmax": 22,
"gain_min": 22,
"p_max": 21,
"nf0": 5.5,
"allowed_for_design": false
}
],
"Fiber":[{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"gamma": 0.00127,
"pmd_coef": 1.265e-15
}
],
"Span":[{
"power_mode": false,
"delta_power_range_db": [-2,3,0.5],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
"length_units": "km",
"max_loss": 28,
"padding": 10,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm":[{
"target_pch_out_db": -25,
"add_drop_osnr": 30.00,
"pmd": 0,
"restrictions": {
"preamp_variety_list":[],
"booster_variety_list":[]
}
}],
"SI":[{
"f_min": 191.6e12,
"baud_rate": 32e9,
"f_max":195.1e12,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [0,0,1],
"roll_off": 0.15,
"tx_osnr": 40,
"sys_margins": 2
}],
"Transceiver":[
{
"type_variety": "Cassini",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "dp-qpsk",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
},
{
"format": "16-qam",
"baud_rate": 66e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
]
},
{
"type_variety": "Voyager",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
}
]
}
]
}

View File

@@ -0,0 +1,291 @@
{
"result": {
"response": [
{
"path-properties": {
"path-metric": [
{
"accumulative-value": 19.38,
"metric-type": "SNR-bandwidth"
},
{
"accumulative-value": 23.46,
"metric-type": "SNR-0.1nm"
},
{
"accumulative-value": 19.38,
"metric-type": "OSNR-bandwidth"
},
{
"accumulative-value": 23.47,
"metric-type": "OSNR-0.1nm"
},
{
"accumulative-value": 100000000000,
"metric-type": "path_bandwidth"
}
],
"path-route-objects": [
{
"path-route-object": {
"index": 0,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "transceiver",
"gnpy-nodes": [
"trx-Bremen"
],
"link-tp-id": "netconf:10.0.254.103:830",
"node-id": "netconf:10.0.254.103:830",
"transponder": {
"transponder-mode": "dp-qpsk",
"transponder-type": "Cassini"
}
}
}
},
{
"path-route-object": {
"index": 1,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Bremen-AD"
],
"link-tp-id": "netconf:10.0.254.225:830",
"node-id": "netconf:10.0.254.225:830",
"target-channel-power": -12
}
}
},
{
"path-route-object": {
"index": 5,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Bremen-L2"
],
"link-tp-id": "netconf:10.0.254.102:830",
"node-id": "netconf:10.0.254.102:830",
"target-channel-power": -23
}
}
},
{
"path-route-object": {
"index": 9,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Amsterdam-L1"
],
"link-tp-id": "netconf:10.0.254.78:830",
"node-id": "netconf:10.0.254.78:830",
"target-channel-power": -12
}
}
},
{
"path-route-object": {
"index": 13,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Amsterdam-AD"
],
"link-tp-id": "netconf:10.0.254.107:830",
"node-id": "netconf:10.0.254.107:830",
"target-channel-power": -13
}
}
},
{
"path-route-object": {
"index": 14,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "transceiver",
"gnpy-nodes": [
"trx-Amsterdam"
],
"link-tp-id": "netconf:10.0.254.105:830",
"node-id": "netconf:10.0.254.105:830",
"transponder": {
"transponder-mode": "dp-qpsk",
"transponder-type": "Cassini"
}
}
}
}
],
"reversed-path-route-objects": [
{
"path-route-object": {
"index": 0,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "transceiver",
"gnpy-nodes": [
"trx-Amsterdam"
],
"link-tp-id": "netconf:10.0.254.105:830",
"node-id": "netconf:10.0.254.105:830",
"transponder": {
"transponder-mode": "dp-qpsk",
"transponder-type": "Cassini"
}
}
}
},
{
"path-route-object": {
"index": 1,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Amsterdam-AD"
],
"link-tp-id": "netconf:10.0.254.107:830",
"node-id": "netconf:10.0.254.107:830",
"target-channel-power": -12
}
}
},
{
"path-route-object": {
"index": 6,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "EDFA",
"gnpy-nodes": [
"roadm-Amsterdam-L1-booster"
],
"link-tp-id": "netconf:10.0.254.78:830",
"node-id": "netconf:10.0.254.78:830",
"target-channel-power": -1
}
}
},
{
"path-route-object": {
"index": 9,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Bremen-L2"
],
"link-tp-id": "netconf:10.0.254.102:830",
"node-id": "netconf:10.0.254.102:830",
"target-channel-power": -12
}
}
},
{
"path-route-object": {
"index": 13,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "ROADM",
"gnpy-nodes": [
"roadm-Bremen-AD"
],
"link-tp-id": "netconf:10.0.254.225:830",
"node-id": "netconf:10.0.254.225:830",
"target-channel-power": -13
}
}
},
{
"path-route-object": {
"index": 14,
"label-hop": {
"M": 4,
"N": -236
},
"num-unnum-hop": {
"gnpy-node-type": "transceiver",
"gnpy-nodes": [
"trx-Bremen"
],
"link-tp-id": "netconf:10.0.254.103:830",
"node-id": "netconf:10.0.254.103:830",
"transponder": {
"transponder-mode": "dp-qpsk",
"transponder-type": "Cassini"
}
}
}
}
],
"z-a-path-metric": [
{
"accumulative-value": 19.38,
"metric-type": "SNR-bandwidth"
},
{
"accumulative-value": 23.46,
"metric-type": "SNR-0.1nm"
},
{
"accumulative-value": 19.38,
"metric-type": "OSNR-bandwidth"
},
{
"accumulative-value": 23.47,
"metric-type": "OSNR-0.1nm"
},
{
"accumulative-value": 0.001,
"metric-type": "reference_power"
},
{
"accumulative-value": 100000000000,
"metric-type": "path_bandwidth"
}
]
},
"response-id": "onos-3"
}
]
}
}

View File

@@ -0,0 +1,447 @@
import json
from pathlib import Path
from gnpy.tools.json_io import load_equipment, load_network
from gnpy.yang.io import save_to_json
# How many nodes in the ring topology? Up to eight is supported, then I ran out of cities..
HOW_MANY = 3
# city names
ALL_CITIES = [
'Amsterdam',
'Bremen',
'Cologne',
'Dueseldorf',
'Eindhoven',
'Frankfurt',
'Ghent',
'Hague',
]
# end of configurable parameters
J = {
"elements": [],
"connections": [],
}
def unidir_join(a, b):
global J
J["connections"].append(
{"from_node": a, "to_node": b}
)
def mk_edfa(name, gain, voa=0.0):
global J
J["elements"].append(
{"uid": name, "type": "Edfa", "type_variety": f"fixed{gain}", "operational": {"gain_target": gain, "out_voa": voa}}
)
def add_att(a, b, att):
global J
if att > 0:
uid = f"att-({a})-({b})"
else:
uid = f"splice-({a})-({b})"
J["elements"].append(
{"uid": uid, "type": "Fused", "params": {"loss": att}},
)
unidir_join(a, uid)
unidir_join(uid, b)
return uid
def build_fiber(city1, city2):
global J
J["elements"].append(
{
"uid": f"fiber-{city1}-{city2}",
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 50,
"length_units": "km",
"loss_coef": 0.2,
"con_in": 1.5,
"con_out": 1.5,
}
}
)
def unidir_patch(a, b):
global J
uid = f"patch-({a})-({b})"
J["elements"].append(
{
"uid": uid,
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": 0.5,
"con_out": 0.5,
}
}
)
add_att(a, uid, 0.0)
add_att(uid, b, 0.0)
for CITY in (ALL_CITIES[x] for x in range(0, HOW_MANY)):
J["elements"].append(
{"uid": f"trx-{CITY}", "type_variety": "Cassini", "type": "Transceiver"}
)
target_pwr = {
f"trx-{CITY}": -8,
f"splice-(roadm-{CITY}-AD)-(patch-(roadm-{CITY}-AD)-(roadm-{CITY}-L1))": -12,
f"splice-(roadm-{CITY}-AD)-(patch-(roadm-{CITY}-AD)-(roadm-{CITY}-L2))": -12,
}
J["elements"].append(
{"uid": f"roadm-{CITY}-AD", "type": "Roadm", "params": {"target_pch_out_db": -2.0, "per_degree_pch_out_db": target_pwr}}
)
unidir_join(f"trx-{CITY}", f"roadm-{CITY}-AD")
unidir_join(f"roadm-{CITY}-AD", f"trx-{CITY}")
for n in (1,2):
target_pwr = {
f"roadm-{CITY}-L{n}-booster": -23,
f"splice-(roadm-{CITY}-L{n})-(patch-(roadm-{CITY}-L{n})-(roadm-{CITY}-AD))": -12,
}
for m in (1,2):
if m == n:
continue
target_pwr[f"splice-(roadm-{CITY}-L{n})-(patch-(roadm-{CITY}-L{n})-(roadm-{CITY}-L{m}))"] = -12
J["elements"].append(
{"uid": f"roadm-{CITY}-L{n}", "type": "Roadm", "params": {"target_pch_out_db": -23.0, "per_degree_pch_out_db": target_pwr}}
)
mk_edfa(f"roadm-{CITY}-L{n}-booster", 22)
mk_edfa(f"roadm-{CITY}-L{n}-preamp", 27)
unidir_join(f"roadm-{CITY}-L{n}", f"roadm-{CITY}-L{n}-booster")
unidir_join(f"roadm-{CITY}-L{n}-preamp", f"roadm-{CITY}-L{n}")
unidir_patch(f"roadm-{CITY}-AD", f"roadm-{CITY}-L{n}")
unidir_patch(f"roadm-{CITY}-L{n}", f"roadm-{CITY}-AD")
for m in (1,2):
if m == n:
continue
unidir_patch(f"roadm-{CITY}-L{n}", f"roadm-{CITY}-L{m}")
for city1, city2 in ((ALL_CITIES[i], ALL_CITIES[i + 1] if i < HOW_MANY - 1 else ALL_CITIES[0]) for i in range(0, HOW_MANY)):
build_fiber(city1, city2)
unidir_join(f"roadm-{city1}-L1-booster", f"fiber-{city1}-{city2}")
unidir_join(f"fiber-{city1}-{city2}", f"roadm-{city2}-L2-preamp")
build_fiber(city2, city1)
unidir_join(f"roadm-{city2}-L2-booster", f"fiber-{city2}-{city1}")
unidir_join(f"fiber-{city2}-{city1}", f"roadm-{city1}-L1-preamp")
for _, E in enumerate(J["elements"]):
uid = E["uid"]
if uid.startswith("roadm-") and (uid.endswith("-L1-booster") or uid.endswith("-L2-booster")):
E["operational"]["out_voa"] = 12.0
with open('gnpy/example-data/2021-demo/original-gnpy.json', 'w') as f:
json.dump(J, f, indent=2)
equipment = load_equipment('gnpy/example-data/2021-demo/equipment.json')
network = load_network(Path('gnpy/example-data/2021-demo/original-gnpy.json'), equipment)
yang_bundle = save_to_json(equipment, network)
with open('gnpy/example-data/2021-demo/yang-without-onos.json', 'w') as f:
json.dump(yang_bundle, f, indent=2)
yang_bundle['ietf-network:networks']['network'].append({
"network-id": "ONOS",
"network-types": {
"tip-onos-topology:onos-topology": {
}
},
"node": [
{
"node-id": "netconf:10.0.254.105:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "trx-Amsterdam"
}
],
"tip-onos-topology:device": {
"name": "Amsterdam TXP (g30-horni)",
"driver": "groove",
"grid-x": -150,
"grid-y": 350,
"netconf": {
"username": "administrator",
"password": "e2e!Net4u#"
}
}
},
{
"node-id": "netconf:10.0.254.78:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-L1"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-L1-preamp"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-L1-booster"
}
],
"tip-onos-topology:device": {
"name": "Amsterdam L1 to Bremen (line-QR79)",
"driver": "czechlight-roadm",
"grid-x": 225,
"grid-y": 320,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.79:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-L2"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-L2-boster"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-L2-preamp"
}
],
"tip-onos-topology:device": {
"name": "Amsterdam L2 to Cologne (line-Q7JS)",
"driver": "czechlight-roadm",
"grid-x": 225,
"grid-y": 380,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.107:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Amsterdam-AD"
}
],
"tip-onos-topology:device": {
"name": "Amsterdam Add/Drop (coh-a-d-v9u)",
"driver": "czechlight-roadm",
"grid-x": 175,
"grid-y": 350,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.99:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Cologne-L1"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Cologne-L1-preamp"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Cologne-L1-booster"
}
],
"tip-onos-topology:device": {
"name": "Cologne L1 to Amsterdam (line-TQQ)",
"driver": "czechlight-roadm",
"grid-x": 420,
"grid-y": 550,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.104:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Cologne-L2"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Cologne-L2-boster"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Cologne-L2-preamp"
}
],
"tip-onos-topology:device": {
"name": "Cologne L2 to Bremen (line-QLK6)",
"driver": "czechlight-roadm",
"grid-x": 480,
"grid-y": 550,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.100:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-L1"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-L1-preamp"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-L1-booster"
}
],
"tip-onos-topology:device": {
"name": "Bremen L1 to Cologne (line-WKP)",
"driver": "czechlight-roadm",
"grid-x": 700,
"grid-y": 380,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.102:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-L2"
},
# try removing the following section to see how a wrong power config affects the results
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-L2-booster"
},
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-L2-preamp"
}
],
"tip-onos-topology:device": {
"name": "Bremen L2 to Amsterdam (line-QCP9)",
"driver": "czechlight-roadm",
"grid-x": 700,
"grid-y": 320,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.225:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "roadm-Bremen-AD"
}
],
"tip-onos-topology:device": {
"name": "Bremen Add/Drop (add-drop-SPI)",
"driver": "czechlight-roadm",
"grid-x": 750,
"grid-y": 350,
"netconf": {
"idle-timeout": 0,
"username": "dwdm",
"password": "dwdm"
}
}
},
{
"node-id": "netconf:10.0.254.103:830",
"supporting-node": [
{
"network-ref": "GNPy",
"node-ref": "trx-Bremen"
}
],
"tip-onos-topology:device": {
"name": "Amsterdam TXP (g30-spodni)",
"driver": "groove",
"grid-x": 1050,
"grid-y": 350,
"netconf": {
"username": "administrator",
"password": "e2e!Net4u#"
}
}
}
],
"ietf-network-topology:link": [
{
"link-id": "netconf:10.0.254.105:830/10101-netconf:10.0.254.107:830/1"
},
{
"link-id": "netconf:10.0.254.107:830/100-netconf:10.0.254.78:830/1"
},
{
"link-id": "netconf:10.0.254.107:830/100-netconf:10.0.254.79:830/2"
},
{
"link-id": "netconf:10.0.254.79:830/1-netconf:10.0.254.78:830/2"
},
{
"link-id": "netconf:10.0.254.99:830/1-netconf:10.0.254.104:830/1"
},
{
"link-id": "netconf:10.0.254.79:830/100-netconf:10.0.254.99:830/100"
},
{
"link-id": "netconf:10.0.254.104:830/100-netconf:10.0.254.100:830/100"
},
{
"link-id": "netconf:10.0.254.102:830/100-netconf:10.0.254.78:830/100"
},
{
"link-id": "netconf:10.0.254.100:830/1-netconf:10.0.254.225:830/100"
},
{
"link-id": "netconf:10.0.254.102:830/2-netconf:10.0.254.225:830/100"
},
{
"link-id": "netconf:10.0.254.102:830/1-netconf:10.0.254.100:830/2"
},
{
"link-id": "netconf:10.0.254.103:830/10101-netconf:10.0.254.225:830/1"
}
]
}
)
with open('gnpy/example-data/2021-demo/yang.json', 'w') as f:
json.dump(yang_bundle, f, indent=2)

View File

@@ -0,0 +1 @@
{"path-request":[{"request-id":"onos-3","source":"netconf:10.0.254.103:830","destination":"netconf:10.0.254.105:830","src-tp-id":"netconf:10.0.254.103:830","dst-tp-id":"netconf:10.0.254.105:830","bidirectional":true,"path-constraints":{"te-bandwidth":{"technology":"flexi-grid","trx_type":"Cassini","trx_mode":null,"effective-freq-slot":[{"N":"null","M":"null"}],"spacing":5.0E10,"max-nb-of-channel":null,"output-power":null,"path_bandwidth":1.0E11}}}]}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,160 +1,160 @@
{
"nf_fit_coeff": [
0.0008,
0.0272,
-0.2249,
6.4902
],
"f_min": 191.4e12,
"f_max": 196.1e12,
"nf_ripple": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"gain_ripple": [
-0.15656302345061,
-0.22244242043552,
-0.25188965661642,
-0.23575900335007,
-0.20897508375209,
-0.19440221943049,
-0.18324644053602,
-0.18053287269681,
-0.17113588777219,
-0.15460322445561,
-0.13550774706866,
-0.10606051088777,
-0.0765630234506,
-0.04962835008375,
-0.01319618927973,
0.01027114740367,
0.03378873534338,
0.04961788107202,
0.04494451423784,
0.0399193886097,
0.01584903685091,
-0.00420121440538,
-0.01847257118928,
-0.02475397822447,
-0.01053287269681,
0.01509526800668,
0.05921587102177,
0.1191656197655,
0.18147717755444,
0.23579878559464,
0.26941687604691,
0.27836159966498,
0.26956762981574,
0.23826109715241,
0.18936662479061,
0.1204721524288,
0.0453465242881,
-0.00877407872698,
-0.02199015912898,
0.00107516750419,
0.02795958961474,
0.02740682579566,
-0.01028161641541,
-0.05982935510889,
-0.06701528475711,
0.00223094639866,
0.14157768006701,
0.15017064489112
],
"dgt": [
1.0,
1.03941448941778,
1.07773189112355,
1.11575888725852,
1.15209185089701,
1.18632744096844,
1.21911100318577,
1.24931318255134,
1.27657903892303,
1.30069883494415,
1.32210817897091,
1.3405812000038,
1.35690844654118,
1.3710092503689,
1.38430337205545,
1.3966294751726,
1.40864903907609,
1.42089447397912,
1.43476940680732,
1.44977369463316,
1.46637521309853,
1.48420288841848,
1.50335352244996,
1.5242627235492,
1.54578500307573,
1.56750088631614,
1.58973304612691,
1.61073904908309,
1.63068023161292,
1.64799163036252,
1.66286684904577,
1.6761448370895,
1.68845480656382,
1.70379790088896,
1.72461030013125,
1.75428006928365,
1.79748596476494,
1.85543800978691,
1.92915262384742,
2.01414465424155,
2.10336369905543,
2.19013043016015,
2.26678136721453,
2.33147727493671,
2.38192717604575,
2.41879254989742,
2.44342862248888,
2.4553191172498
]
"nf_fit_coeff": [
0.0008,
0.0272,
-0.2249,
6.4902
],
"f_min": 191.4e12,
"f_max": 196.1e12,
"nf_ripple": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"gain_ripple": [
-0.15656302345061,
-0.22244242043552,
-0.25188965661642,
-0.23575900335007,
-0.20897508375209,
-0.19440221943049,
-0.18324644053602,
-0.18053287269681,
-0.17113588777219,
-0.15460322445561,
-0.13550774706866,
-0.10606051088777,
-0.0765630234506,
-0.04962835008375,
-0.01319618927973,
0.01027114740367,
0.03378873534338,
0.04961788107202,
0.04494451423784,
0.0399193886097,
0.01584903685091,
-0.00420121440538,
-0.01847257118928,
-0.02475397822447,
-0.01053287269681,
0.01509526800668,
0.05921587102177,
0.1191656197655,
0.18147717755444,
0.23579878559464,
0.26941687604691,
0.27836159966498,
0.26956762981574,
0.23826109715241,
0.18936662479061,
0.1204721524288,
0.0453465242881,
-0.00877407872698,
-0.02199015912898,
0.00107516750419,
0.02795958961474,
0.02740682579566,
-0.01028161641541,
-0.05982935510889,
-0.06701528475711,
0.00223094639866,
0.14157768006701,
0.15017064489112
],
"dgt": [
1.0,
1.03941448941778,
1.07773189112355,
1.11575888725852,
1.15209185089701,
1.18632744096844,
1.21911100318577,
1.24931318255134,
1.27657903892303,
1.30069883494415,
1.32210817897091,
1.3405812000038,
1.35690844654118,
1.3710092503689,
1.38430337205545,
1.3966294751726,
1.40864903907609,
1.42089447397912,
1.43476940680732,
1.44977369463316,
1.46637521309853,
1.48420288841848,
1.50335352244996,
1.5242627235492,
1.54578500307573,
1.56750088631614,
1.58973304612691,
1.61073904908309,
1.63068023161292,
1.64799163036252,
1.66286684904577,
1.6761448370895,
1.68845480656382,
1.70379790088896,
1.72461030013125,
1.75428006928365,
1.79748596476494,
1.85543800978691,
1.92915262384742,
2.01414465424155,
2.10336369905543,
2.19013043016015,
2.26678136721453,
2.33147727493671,
2.38192717604575,
2.41879254989742,
2.44342862248888,
2.4553191172498
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,108 +1,106 @@
{
"nf_ripple": [
0.0
],
"gain_ripple": [
0.0
],
"f_min": 191.35e12,
"f_max": 196.1e12,
"dgt": [
1.0,
1.017807767853702,
1.0356155337864215,
1.0534217504465226,
1.0712204022764056,
1.0895983485572227,
1.108555289615659,
1.1280891949729075,
1.1476135933863398,
1.1672278304018044,
1.1869318618366975,
1.2067249615595257,
1.2264996957264114,
1.2428104897182262,
1.2556591482982988,
1.2650555289898042,
1.2744470198196236,
1.2838336236692311,
1.2932153453410835,
1.3040618749785347,
1.316383926863083,
1.3301807335621048,
1.3439818461440451,
1.3598972673004606,
1.3779439775587023,
1.3981208704326855,
1.418273806730323,
1.4340878115214444,
1.445565137158368,
1.45273959485914,
1.4599103316162523,
1.4670307626366115,
1.474100442252211,
1.48111939735681,
1.488134243479226,
1.495145456062699,
1.502153039909686,
1.5097346239790443,
1.5178910621476225,
1.5266220576235803,
1.5353620432989845,
1.545374152761467,
1.5566577309558969,
1.569199764184379,
1.5817353179379183,
1.5986915141218316,
1.6201194134191075,
1.6460167077689267,
1.6719047669939942,
1.6918150918099673,
1.7057507692361864,
1.7137640932265894,
1.7217732861435076,
1.7297783508684146,
1.737780757913635,
1.7459181197626403,
1.7541903672600494,
1.7625959636196327,
1.7709972329654864,
1.7793941781790852,
1.7877868031023945,
1.7961751115773796,
1.8045606557581335,
1.8139629377087627,
1.824381436842932,
1.835814081380705,
1.847275503201129,
1.862235672444246,
1.8806927939516411,
1.9026104247588487,
1.9245345552113182,
1.9482128147680253,
1.9736443063300082,
2.0008103857988204,
2.0279625371819305,
2.055100772005235,
2.082225099873648,
2.1183028432496016,
2.16337565384239,
2.2174389328192197,
2.271520771371253,
2.322373696229342,
2.3699990328716107,
2.414398437185221,
2.4587748041127506,
2.499446286796604,
2.5364027376452056,
2.5696460593920065,
2.602860350286428,
2.630396440815385,
2.6521732021128046,
2.6681935771243177,
2.6841217449620203,
2.6947834587664494,
2.705443819238505,
2.714526681131686
]
"nf_ripple": [
0.0
],
"gain_ripple": [
0.0
],
"dgt": [
1.0,
1.017807767853702,
1.0356155337864215,
1.0534217504465226,
1.0712204022764056,
1.0895983485572227,
1.108555289615659,
1.1280891949729075,
1.1476135933863398,
1.1672278304018044,
1.1869318618366975,
1.2067249615595257,
1.2264996957264114,
1.2428104897182262,
1.2556591482982988,
1.2650555289898042,
1.2744470198196236,
1.2838336236692311,
1.2932153453410835,
1.3040618749785347,
1.316383926863083,
1.3301807335621048,
1.3439818461440451,
1.3598972673004606,
1.3779439775587023,
1.3981208704326855,
1.418273806730323,
1.4340878115214444,
1.445565137158368,
1.45273959485914,
1.4599103316162523,
1.4670307626366115,
1.474100442252211,
1.48111939735681,
1.488134243479226,
1.495145456062699,
1.502153039909686,
1.5097346239790443,
1.5178910621476225,
1.5266220576235803,
1.5353620432989845,
1.545374152761467,
1.5566577309558969,
1.569199764184379,
1.5817353179379183,
1.5986915141218316,
1.6201194134191075,
1.6460167077689267,
1.6719047669939942,
1.6918150918099673,
1.7057507692361864,
1.7137640932265894,
1.7217732861435076,
1.7297783508684146,
1.737780757913635,
1.7459181197626403,
1.7541903672600494,
1.7625959636196327,
1.7709972329654864,
1.7793941781790852,
1.7877868031023945,
1.7961751115773796,
1.8045606557581335,
1.8139629377087627,
1.824381436842932,
1.835814081380705,
1.847275503201129,
1.862235672444246,
1.8806927939516411,
1.9026104247588487,
1.9245345552113182,
1.9482128147680253,
1.9736443063300082,
2.0008103857988204,
2.0279625371819305,
2.055100772005235,
2.082225099873648,
2.1183028432496016,
2.16337565384239,
2.2174389328192197,
2.271520771371253,
2.322373696229342,
2.3699990328716107,
2.414398437185221,
2.4587748041127506,
2.499446286796604,
2.5364027376452056,
2.5696460593920065,
2.602860350286428,
2.630396440815385,
2.6521732021128046,
2.6681935771243177,
2.6841217449620203,
2.6947834587664494,
2.705443819238505,
2.714526681131686
]
}

View File

@@ -1,80 +1,80 @@
{
"network_name": "EDFA Example Network - P2P",
"elements": [
{
"uid": "Site_A",
"type": "Transceiver",
"metadata": {
"location": {
"city": "Site A",
"region": "",
"latitude": 0,
"longitude": 0
"network_name": "EDFA Example Network - P2P",
"elements": [{
"uid": "Site_A",
"type": "Transceiver",
"metadata": {
"location": {
"city": "Site A",
"region": "",
"latitude": 0,
"longitude": 0
}
}
},
{
"uid": "Span1",
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80,
"loss_coef": 0.2,
"length_units": "km",
"att_in": 0,
"con_in": 0.5,
"con_out": 0.5
},
"metadata": {
"location": {
"region": "",
"latitude": 1,
"longitude": 0
}
}
},
{
"uid": "Edfa1",
"type": "Edfa",
"type_variety": "std_low_gain",
"operational": {
"gain_target": 17,
"tilt_target": 0,
"out_voa": 0
},
"metadata": {
"location": {
"region": "",
"latitude": 2,
"longitude": 0
}
}
},
{
"uid": "Site_B",
"type": "Transceiver",
"metadata": {
"location": {
"city": "Site B",
"region": "",
"latitude": 2,
"longitude": 0
}
}
}
}
},
{
"uid": "Span1",
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80,
"loss_coef": 0.2,
"length_units": "km",
"att_in": 0,
"con_in": 0.5,
"con_out": 0.5
},
"metadata": {
"location": {
"region": "",
"latitude": 1,
"longitude": 0
],
"connections": [{
"from_node": "Site_A",
"to_node": "Span1"
},
{
"from_node": "Span1",
"to_node": "Edfa1"
},
{
"from_node": "Edfa1",
"to_node": "Site_B"
}
}
},
{
"uid": "Edfa1",
"type": "Edfa",
"type_variety": "std_low_gain",
"operational": {
"gain_target": 17,
"tilt_target": 0,
"out_voa": 0
},
"metadata": {
"location": {
"region": "",
"latitude": 2,
"longitude": 0
}
}
},
{
"uid": "Site_B",
"type": "Transceiver",
"metadata": {
"location": {
"city": "Site B",
"region": "",
"latitude": 2,
"longitude": 0
}
}
}
],
"connections": [
{
"from_node": "Site_A",
"to_node": "Span1"
},
{
"from_node": "Span1",
"to_node": "Edfa1"
},
{
"from_node": "Edfa1",
"to_node": "Site_B"
}
]
]
}

View File

@@ -1,443 +1,328 @@
{
"Edfa": [
{
"type_variety": "high_detail_model_example",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
"out_voa_auto": false,
"allowed_for_design": false
},
{
"type_variety": "Juniper_BoosterHG",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 10,
"p_max": 21,
"advanced_config_from_json": "Juniper-BoosterHG.json",
"out_voa_auto": false,
"allowed_for_design": false
},
{
"type_variety": "operator_model_example",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 23,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": false
},
{
"type_variety": "openroadm_ila_low_noise",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-8.104e-4,
-6.221e-2,
-5.889e-1,
37.62
],
"allowed_for_design": false
},
{
"type_variety": "openroadm_ila_standard",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
28.99
],
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_preamp",
"type_def": "openroadm_preamp",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_preamp_typical_ver5",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
28.99
],
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_preamp_worstcase_ver5",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
27.99
],
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_booster",
"type_def": "openroadm_booster",
"gain_flatmax": 32,
"gain_min": 0,
"p_max": 22,
"allowed_for_design": false
},
{
"type_variety": "std_high_gain",
"type_def": "variable_gain",
"gain_flatmax": 35,
"gain_min": 25,
"p_max": 21,
"nf_min": 5.5,
"nf_max": 7,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 23,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "std_low_gain",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 23,
"nf_min": 6.5,
"nf_max": 11,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "high_power",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 25,
"nf_min": 9,
"nf_max": 15,
"out_voa_auto": false,
"allowed_for_design": false
},
{
"type_variety": "std_fixed_gain",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5.5,
"allowed_for_design": false
},
{
"type_variety": "4pumps_raman",
"type_def": "fixed_gain",
"gain_flatmax": 12,
"gain_min": 12,
"p_max": 21,
"nf0": -1,
"allowed_for_design": false
},
{
"type_variety": "hybrid_4pumps_lowgain",
"type_def": "dual_stage",
"raman": true,
"gain_min": 25,
"preamp_variety": "4pumps_raman",
"booster_variety": "std_low_gain",
"allowed_for_design": true
},
{
"type_variety": "hybrid_4pumps_mediumgain",
"type_def": "dual_stage",
"raman": true,
"gain_min": 25,
"preamp_variety": "4pumps_raman",
"booster_variety": "std_medium_gain",
"allowed_for_design": true
},
{
"type_variety": "medium+low_gain",
"type_def": "dual_stage",
"gain_min": 25,
"preamp_variety": "std_medium_gain",
"booster_variety": "std_low_gain",
"allowed_for_design": true
},
{
"type_variety": "medium+high_power",
"type_def": "dual_stage",
"gain_min": 25,
"preamp_variety": "std_medium_gain",
"booster_variety": "high_power",
"allowed_for_design": false
}
],
"Fiber": [
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
},
{
"type_variety": "NZDF",
"dispersion": 0.5e-05,
"effective_area": 72e-12,
"pmd_coef": 1.265e-15
},
{
"type_variety": "LOF",
"dispersion": 2.2e-05,
"effective_area": 125e-12,
"pmd_coef": 1.265e-15
}
],
"RamanFiber": [
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
}
],
"Span": [
{
"power_mode": true,
"delta_power_range_db": [
-2,
3,
0.5
],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
"length_units": "km",
"max_loss": 28,
"padding": 10,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [
{
"target_pch_out_db": -20,
"add_drop_osnr": 38,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
}
},
{
"type_variety": "roadm_type_1",
"target_pch_out_db": -18,
"add_drop_osnr": 35,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
},
"roadm-path-impairments": []
},
{
"type_variety": "detailed_impairments",
"target_pch_out_db": -20,
"add_drop_osnr": 38,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
},
"roadm-path-impairments": [
{
"roadm-path-impairments-id": 0,
"roadm-express-path": [
{ "Edfa":[{
"type_variety": "high_detail_model_example",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
"out_voa_auto": false,
"allowed_for_design": false
}, {
"type_variety": "Juniper_BoosterHG",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 10,
"p_max": 21,
"advanced_config_from_json": "Juniper-BoosterHG.json",
"out_voa_auto": false,
"allowed_for_design": false
},
{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
},
"roadm-pmd": 0,
"roadm-cd": 0,
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 16.5
}
]
},
{
"roadm-path-impairments-id": 1,
"roadm-add-path": [
"type_variety": "operator_model_example",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 23,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": false
},
{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
},
"roadm-pmd": 0,
"roadm-cd": 0,
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 11.5,
"roadm-pmax": 2.5,
"roadm-osnr": 41,
"roadm-noise-figure": 23
}
]
},
{
"roadm-path-impairments-id": 2,
"roadm-drop-path": [
"type_variety": "openroadm_ila_low_noise",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [-8.104e-4,-6.221e-2,-5.889e-1,37.62],
"allowed_for_design": false
},
{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
},
"roadm-pmd": 0,
"roadm-cd": 0,
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 11.5,
"roadm-minloss": 7.5,
"roadm-typloss": 10,
"roadm-pmin": -13.5,
"roadm-pmax": -9.5,
"roadm-ptyp": -12,
"roadm-osnr": 41,
"roadm-noise-figure": 15
}
]
}
]
}
],
"SI": [
{
"f_min": 191.3e12,
"baud_rate": 32e9,
"f_max": 195.1e12,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [
0,
0,
1
"type_variety": "openroadm_ila_standard",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [-5.952e-4,-6.250e-2,-1.071,28.99],
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_preamp",
"type_def": "openroadm_preamp",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_booster",
"type_def": "openroadm_booster",
"gain_flatmax": 32,
"gain_min": 0,
"p_max": 22,
"allowed_for_design": false
},
{
"type_variety": "std_high_gain",
"type_def": "variable_gain",
"gain_flatmax": 35,
"gain_min": 25,
"p_max": 21,
"nf_min": 5.5,
"nf_max": 7,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 23,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "std_low_gain",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 23,
"nf_min": 6.5,
"nf_max": 11,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "high_power",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 25,
"nf_min": 9,
"nf_max": 15,
"out_voa_auto": false,
"allowed_for_design": false
},
{
"type_variety": "std_fixed_gain",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5.5,
"allowed_for_design": false
},
{
"type_variety": "4pumps_raman",
"type_def": "fixed_gain",
"gain_flatmax": 12,
"gain_min": 12,
"p_max": 21,
"nf0": -1,
"allowed_for_design": false
},
{
"type_variety": "hybrid_4pumps_lowgain",
"type_def": "dual_stage",
"raman": true,
"gain_min": 25,
"preamp_variety": "4pumps_raman",
"booster_variety": "std_low_gain",
"allowed_for_design": true
},
{
"type_variety": "hybrid_4pumps_mediumgain",
"type_def": "dual_stage",
"raman": true,
"gain_min": 25,
"preamp_variety": "4pumps_raman",
"booster_variety": "std_medium_gain",
"allowed_for_design": true
},
{
"type_variety": "medium+low_gain",
"type_def": "dual_stage",
"gain_min": 25,
"preamp_variety": "std_medium_gain",
"booster_variety": "std_low_gain",
"allowed_for_design": true
},
{
"type_variety": "medium+high_power",
"type_def": "dual_stage",
"gain_min": 25,
"preamp_variety": "std_medium_gain",
"booster_variety": "high_power",
"allowed_for_design": false
}
],
"tx_power_dbm": 0,
"roll_off": 0.15,
"tx_osnr": 40,
"sys_margins": 2
}
],
"Transceiver": [
{
"type_variety": "vendorA_trx-type1",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
},
"mode": [
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost": 1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost": 1
}
"Fiber":[{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"gamma": 0.00127,
"pmd_coef": 1.265e-15
},
{
"type_variety": "NZDF",
"dispersion": 0.5e-05,
"gamma": 0.00146,
"pmd_coef": 1.265e-15
},
{
"type_variety": "LOF",
"dispersion": 2.2e-05,
"gamma": 0.000843,
"pmd_coef": 1.265e-15
}
],
"RamanFiber":[{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"gamma": 0.00127,
"pmd_coef": 1.265e-15,
"raman_efficiency": {
"cr":[
0, 9.4E-06, 2.92E-05, 4.88E-05, 6.82E-05, 8.31E-05, 9.4E-05, 0.0001014, 0.0001069, 0.0001119,
0.0001217, 0.0001268, 0.0001365, 0.000149, 0.000165, 0.000181, 0.0001977, 0.0002192, 0.0002469,
0.0002749, 0.0002999, 0.0003206, 0.0003405, 0.0003592, 0.000374, 0.0003826, 0.0003841, 0.0003826,
0.0003802, 0.0003756, 0.0003549, 0.0003795, 0.000344, 0.0002933, 0.0002024, 0.0001158, 8.46E-05,
7.14E-05, 6.86E-05, 8.5E-05, 8.93E-05, 9.01E-05, 8.15E-05, 6.67E-05, 4.37E-05, 3.28E-05, 2.96E-05,
2.65E-05, 2.57E-05, 2.81E-05, 3.08E-05, 3.67E-05, 5.85E-05, 6.63E-05, 6.36E-05, 5.5E-05, 4.06E-05,
2.77E-05, 2.42E-05, 1.87E-05, 1.6E-05, 1.4E-05, 1.13E-05, 1.05E-05, 9.8E-06, 9.8E-06, 1.13E-05,
1.64E-05, 1.95E-05, 2.38E-05, 2.26E-05, 2.03E-05, 1.48E-05, 1.09E-05, 9.8E-06, 1.05E-05, 1.17E-05,
1.25E-05, 1.21E-05, 1.09E-05, 9.8E-06, 8.2E-06, 6.6E-06, 4.7E-06, 2.7E-06, 1.9E-06, 1.2E-06, 4E-07,
2E-07, 1E-07
],
"frequency_offset":[
0, 0.5e12, 1e12, 1.5e12, 2e12, 2.5e12, 3e12, 3.5e12, 4e12, 4.5e12, 5e12, 5.5e12, 6e12, 6.5e12, 7e12,
7.5e12, 8e12, 8.5e12, 9e12, 9.5e12, 10e12, 10.5e12, 11e12, 11.5e12, 12e12, 12.5e12, 12.75e12,
13e12, 13.25e12, 13.5e12, 14e12, 14.5e12, 14.75e12, 15e12, 15.5e12, 16e12, 16.5e12, 17e12,
17.5e12, 18e12, 18.25e12, 18.5e12, 18.75e12, 19e12, 19.5e12, 20e12, 20.5e12, 21e12, 21.5e12,
22e12, 22.5e12, 23e12, 23.5e12, 24e12, 24.5e12, 25e12, 25.5e12, 26e12, 26.5e12, 27e12, 27.5e12, 28e12,
28.5e12, 29e12, 29.5e12, 30e12, 30.5e12, 31e12, 31.5e12, 32e12, 32.5e12, 33e12, 33.5e12, 34e12, 34.5e12,
35e12, 35.5e12, 36e12, 36.5e12, 37e12, 37.5e12, 38e12, 38.5e12, 39e12, 39.5e12, 40e12, 40.5e12, 41e12,
41.5e12, 42e12
]
}
}
],
"Span":[{
"power_mode":true,
"delta_power_range_db": [-2,3,0.5],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
"length_units": "km",
"max_loss": 28,
"padding": 10,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm":[{
"target_pch_out_db": -20,
"add_drop_osnr": 38,
"pmd": 0,
"restrictions": {
"preamp_variety_list":[],
"booster_variety_list":[]
}
}],
"SI":[{
"f_min": 191.3e12,
"baud_rate": 32e9,
"f_max":195.1e12,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [0,0,1],
"roll_off": 0.15,
"tx_osnr": 40,
"sys_margins": 2
}],
"Transceiver":[
{
"type_variety": "vendorA_trx-type1",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
]
},
{
"type_variety": "Voyager",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
},
{
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 62.5e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
]
}
]
},
{
"type_variety": "Voyager",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
},
"mode": [
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost": 1
},
{
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 62.5e9,
"cost": 1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost": 1
},
{
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost": 1
}
]
}
]
}

View File

@@ -0,0 +1,190 @@
{ "Edfa":[
{
"type_variety": "openroadm_ila_low_noise",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [-8.104e-4,-6.221e-2,-5.889e-1,37.62],
"allowed_for_design": true
},
{
"type_variety": "openroadm_ila_standard",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [-5.952e-4,-6.250e-2,-1.071,28.99],
"allowed_for_design": true
},
{
"type_variety": "openroadm_mw_mw_preamp",
"type_def": "openroadm_preamp",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_booster",
"type_def": "openroadm_booster",
"gain_flatmax": 32,
"gain_min": 0,
"p_max": 22,
"allowed_for_design": false
}
],
"Fiber":[
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"gamma": 0.00127,
"pmd_coef": 1.265e-15
},
{
"type_variety": "NZDF",
"dispersion": 0.5e-05,
"gamma": 0.00146,
"pmd_coef": 1.265e-15
},
{
"type_variety": "LOF",
"dispersion": 2.2e-05,
"gamma": 0.000843,
"pmd_coef": 1.265e-15
}
],
"RamanFiber":[
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"gamma": 0.00127,
"pmd_coef": 1.265e-15,
"raman_efficiency": {
"cr":[
0, 9.4E-06, 2.92E-05, 4.88E-05, 6.82E-05, 8.31E-05, 9.4E-05, 0.0001014, 0.0001069, 0.0001119,
0.0001217, 0.0001268, 0.0001365, 0.000149, 0.000165, 0.000181, 0.0001977, 0.0002192, 0.0002469,
0.0002749, 0.0002999, 0.0003206, 0.0003405, 0.0003592, 0.000374, 0.0003826, 0.0003841, 0.0003826,
0.0003802, 0.0003756, 0.0003549, 0.0003795, 0.000344, 0.0002933, 0.0002024, 0.0001158, 8.46E-05,
7.14E-05, 6.86E-05, 8.5E-05, 8.93E-05, 9.01E-05, 8.15E-05, 6.67E-05, 4.37E-05, 3.28E-05, 2.96E-05,
2.65E-05, 2.57E-05, 2.81E-05, 3.08E-05, 3.67E-05, 5.85E-05, 6.63E-05, 6.36E-05, 5.5E-05, 4.06E-05,
2.77E-05, 2.42E-05, 1.87E-05, 1.6E-05, 1.4E-05, 1.13E-05, 1.05E-05, 9.8E-06, 9.8E-06, 1.13E-05,
1.64E-05, 1.95E-05, 2.38E-05, 2.26E-05, 2.03E-05, 1.48E-05, 1.09E-05, 9.8E-06, 1.05E-05, 1.17E-05,
1.25E-05, 1.21E-05, 1.09E-05, 9.8E-06, 8.2E-06, 6.6E-06, 4.7E-06, 2.7E-06, 1.9E-06, 1.2E-06, 4E-07,
2E-07, 1E-07
],
"frequency_offset":[
0, 0.5e12, 1e12, 1.5e12, 2e12, 2.5e12, 3e12, 3.5e12, 4e12, 4.5e12, 5e12, 5.5e12, 6e12, 6.5e12, 7e12,
7.5e12, 8e12, 8.5e12, 9e12, 9.5e12, 10e12, 10.5e12, 11e12, 11.5e12, 12e12, 12.5e12, 12.75e12,
13e12, 13.25e12, 13.5e12, 14e12, 14.5e12, 14.75e12, 15e12, 15.5e12, 16e12, 16.5e12, 17e12,
17.5e12, 18e12, 18.25e12, 18.5e12, 18.75e12, 19e12, 19.5e12, 20e12, 20.5e12, 21e12, 21.5e12,
22e12, 22.5e12, 23e12, 23.5e12, 24e12, 24.5e12, 25e12, 25.5e12, 26e12, 26.5e12, 27e12, 27.5e12, 28e12,
28.5e12, 29e12, 29.5e12, 30e12, 30.5e12, 31e12, 31.5e12, 32e12, 32.5e12, 33e12, 33.5e12, 34e12, 34.5e12,
35e12, 35.5e12, 36e12, 36.5e12, 37e12, 37.5e12, 38e12, 38.5e12, 39e12, 39.5e12, 40e12, 40.5e12, 41e12,
41.5e12, 42e12
]
}
}
],
"Span":[
{
"power_mode":true,
"delta_power_range_db": [0,0,0],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 0,
"max_length": 135,
"length_units": "km",
"max_loss": 28,
"padding": 11,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm":[
{
"target_pch_out_db": -20,
"add_drop_osnr": 30,
"pmd": 0,
"restrictions": {
"preamp_variety_list":["openroadm_mw_mw_preamp"],
"booster_variety_list":["openroadm_mw_mw_booster"]
}
}
],
"SI":[
{
"f_min": 191.3e12,
"baud_rate": 31.57e9,
"f_max":196.1e12,
"spacing": 50e9,
"power_dbm": 2,
"power_range_db": [0,0,1],
"roll_off": 0.15,
"tx_osnr": 35,
"sys_margins": 2
}
],
"Transceiver":[
{
"type_variety": "OpenROADM MSA ver. 4.0",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "100 Gbit/s, 27.95 Gbaud, DP-QPSK",
"baud_rate": 27.95e9,
"OSNR": 17,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 33,
"min_spacing": 50e9,
"cost":1
},
{
"format": "100 Gbit/s, 31.57 Gbaud, DP-QPSK",
"baud_rate": 31.57e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 35,
"min_spacing": 50e9,
"cost":1
},
{
"format": "200 Gbit/s, DP-QPSK",
"baud_rate": 63.1e9,
"OSNR": 17,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 36,
"min_spacing": 87.5e9,
"cost":1
},
{
"format": "300 Gbit/s, DP-8QAM",
"baud_rate": 63.1e9,
"OSNR": 21,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 36,
"min_spacing": 87.5e9,
"cost":1
},
{
"format": "400 Gbit/s, DP-16QAM",
"baud_rate": 63.1e9,
"OSNR": 24,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 36,
"min_spacing": 87.5e9,
"cost":1
}
]
}
]
}

View File

@@ -1,371 +0,0 @@
{
"Edfa": [
{
"type_variety": "openroadm_ila_low_noise",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-8.104e-4,
-6.221e-2,
-5.889e-1,
37.62
],
"pmd": 3e-12,
"pdl": 0.7,
"allowed_for_design": true
},
{
"type_variety": "openroadm_ila_standard",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
28.99
],
"pmd": 3e-12,
"pdl": 0.7,
"allowed_for_design": true
},
{
"type_variety": "openroadm_mw_mw_preamp",
"type_def": "openroadm_preamp",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"pmd": 0,
"pdl": 0,
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_booster",
"type_def": "openroadm_booster",
"gain_flatmax": 32,
"gain_min": 0,
"p_max": 22,
"pmd": 0,
"pdl": 0,
"allowed_for_design": false
}
],
"Fiber": [
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
},
{
"type_variety": "NZDF",
"dispersion": 0.5e-05,
"effective_area": 72e-12,
"pmd_coef": 1.265e-15
},
{
"type_variety": "LOF",
"dispersion": 2.2e-05,
"effective_area": 125e-12,
"pmd_coef": 1.265e-15
}
],
"RamanFiber": [
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
}
],
"Span": [
{
"power_mode": true,
"delta_power_range_db": [
0,
0,
0
],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 0,
"max_length": 135,
"length_units": "km",
"max_loss": 28,
"padding": 11,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [
{
"target_pch_out_db": -20,
"add_drop_osnr": 30,
"pmd": 3e-12,
"pdl": 1.5,
"restrictions": {
"preamp_variety_list": [
"openroadm_mw_mw_preamp"
],
"booster_variety_list": [
"openroadm_mw_mw_booster"
]
}
}
],
"SI": [
{
"f_min": 191.3e12,
"baud_rate": 31.57e9,
"f_max": 196.1e12,
"spacing": 50e9,
"power_dbm": 2,
"power_range_db": [
0,
0,
1
],
"roll_off": 0.15,
"tx_osnr": 35,
"sys_margins": 2
}
],
"Transceiver": [
{
"type_variety": "OpenROADM MSA ver. 4.0",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
},
"mode": [
{
"format": "100 Gbit/s, 27.95 Gbaud, DP-QPSK",
"baud_rate": 27.95e9,
"OSNR": 17,
"bit_rate": 100e9,
"roll_off": null,
"tx_osnr": 33,
"penalties": [
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 18e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 30,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
},
{
"pdl": 6,
"penalty_value": 4
}
],
"min_spacing": 50e9,
"cost": 1
},
{
"format": "100 Gbit/s, 31.57 Gbaud, DP-QPSK",
"baud_rate": 31.57e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 35,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 40e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 30,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
},
{
"pdl": 6,
"penalty_value": 4
}
],
"min_spacing": 50e9,
"cost": 1
},
{
"format": "200 Gbit/s, DP-QPSK",
"baud_rate": 63.1e9,
"OSNR": 17,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 24e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 25,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
}
],
"min_spacing": 87.5e9,
"cost": 1
},
{
"format": "300 Gbit/s, DP-8QAM",
"baud_rate": 63.1e9,
"OSNR": 21,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 18e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 25,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
}
],
"min_spacing": 87.5e9,
"cost": 1
},
{
"format": "400 Gbit/s, DP-16QAM",
"baud_rate": 63.1e9,
"OSNR": 24,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 12e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 20,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
}
],
"min_spacing": 87.5e9,
"cost": 1
}
]
}
]
}

View File

@@ -1,441 +0,0 @@
{
"Edfa": [
{
"type_variety": "openroadm_ila_low_noise",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-8.104e-4,
-6.221e-2,
-5.889e-1,
37.62
],
"pmd": 3e-12,
"pdl": 0.7,
"allowed_for_design": true
},
{
"type_variety": "openroadm_ila_standard",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
28.99
],
"pmd": 3e-12,
"pdl": 0.7,
"allowed_for_design": true
},
{
"type_variety": "openroadm_mw_mw_preamp_typical_ver5",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
28.99
],
"pmd": 0,
"pdl": 0,
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_preamp_worstcase_ver5",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 0,
"p_max": 22,
"nf_coef": [
-5.952e-4,
-6.250e-2,
-1.071,
27.99
],
"pmd": 0,
"pdl": 0,
"allowed_for_design": false
},
{
"type_variety": "openroadm_mw_mw_booster",
"type_def": "openroadm_booster",
"gain_flatmax": 32,
"gain_min": 0,
"p_max": 22,
"pmd": 0,
"pdl": 0,
"allowed_for_design": false
}
],
"Fiber": [
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
},
{
"type_variety": "NZDF",
"dispersion": 0.5e-05,
"effective_area": 72e-12,
"pmd_coef": 1.265e-15
},
{
"type_variety": "LOF",
"dispersion": 2.2e-05,
"effective_area": 125e-12,
"pmd_coef": 1.265e-15
}
],
"RamanFiber": [
{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
}
],
"Span": [
{
"power_mode": true,
"delta_power_range_db": [
0,
0,
0
],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 0,
"max_length": 135,
"length_units": "km",
"max_loss": 28,
"padding": 11,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [
{
"target_pch_out_db": -20,
"add_drop_osnr": 33,
"pmd": 3e-12,
"pdl": 1.5,
"restrictions": {
"preamp_variety_list": [
"openroadm_mw_mw_preamp_worstcase_ver5"
],
"booster_variety_list": [
"openroadm_mw_mw_booster"
]
}
}
],
"SI": [
{
"f_min": 191.3e12,
"baud_rate": 31.57e9,
"f_max": 196.1e12,
"spacing": 50e9,
"power_dbm": 2,
"power_range_db": [
0,
0,
1
],
"roll_off": 0.15,
"tx_osnr": 35,
"sys_margins": 2
}
],
"Transceiver": [
{
"type_variety": "OpenROADM MSA ver. 5.0",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
},
"mode": [
{
"format": "100 Gbit/s, 27.95 Gbaud, DP-QPSK",
"baud_rate": 27.95e9,
"OSNR": 17,
"bit_rate": 100e9,
"roll_off": null,
"tx_osnr": 33,
"penalties": [
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 18e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 30,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
},
{
"pdl": 6,
"penalty_value": 4
}
],
"min_spacing": 50e9,
"cost": 1
},
{
"format": "100 Gbit/s, 31.57 Gbaud, DP-QPSK",
"baud_rate": 31.57e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 48e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 30,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
},
{
"pdl": 6,
"penalty_value": 4
}
],
"min_spacing": 50e9,
"cost": 1
},
{
"format": "200 Gbit/s, 31.57 Gbaud, DP-16QAM",
"baud_rate": 31.57e9,
"OSNR": 20.5,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 24e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 30,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
},
{
"pdl": 6,
"penalty_value": 4
}
],
"min_spacing": 50e9,
"cost": 1
},
{
"format": "200 Gbit/s, DP-QPSK",
"baud_rate": 63.1e9,
"OSNR": 17,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 24e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 25,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
}
],
"min_spacing": 87.5e9,
"cost": 1
},
{
"format": "300 Gbit/s, DP-8QAM",
"baud_rate": 63.1e9,
"OSNR": 21,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 18e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 25,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
}
],
"min_spacing": 87.5e9,
"cost": 1
},
{
"format": "400 Gbit/s, DP-16QAM",
"baud_rate": 63.1e9,
"OSNR": 24,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 36,
"penalties": [
{
"chromatic_dispersion": -1e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 4e3,
"penalty_value": 0
},
{
"chromatic_dispersion": 12e3,
"penalty_value": 0.5
},
{
"pmd": 10,
"penalty_value": 0
},
{
"pmd": 20,
"penalty_value": 0.5
},
{
"pdl": 1,
"penalty_value": 0.5
},
{
"pdl": 2,
"penalty_value": 1
},
{
"pdl": 4,
"penalty_value": 2.5
}
],
"min_spacing": 87.5e9,
"cost": 1
}
]
}
]
}

View File

@@ -1,12 +0,0 @@
{
"spectrum": [
{
"f_min": 191.35e12,
"f_max": 195.1e12,
"baud_rate": 32e9,
"slot_width": 50e9,
"roll_off": 0.15,
"tx_osnr": 40
}
]
}

View File

@@ -1,23 +0,0 @@
{
"spectrum": [
{
"f_min": 191.4e12,
"f_max": 193.1e12,
"baud_rate": 32e9,
"slot_width": 50e9,
"delta_pdb": 0,
"roll_off": 0.15,
"tx_osnr": 40,
"label": "mode_1"
},
{
"f_min": 193.1625e12,
"f_max": 195e12,
"baud_rate": 64e9,
"slot_width": 75e9,
"roll_off": 0.15,
"tx_osnr": 40,
"label": "mode_2"
}
]
}

View File

@@ -14,8 +14,8 @@
"trx_mode": null,
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -39,8 +39,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -104,8 +104,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -129,8 +129,8 @@
"trx_mode": null,
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 75000000000.0,
@@ -154,8 +154,8 @@
"trx_mode": "mode 2",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 75000000000.0,
@@ -179,8 +179,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -204,8 +204,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -229,8 +229,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 75000000000.0,

View File

@@ -20,12 +20,12 @@
"temperature": 283,
"raman_pumps": [
{
"power": 224.403e-3,
"power": 200e-3,
"frequency": 205e12,
"propagation_direction": "counterprop"
},
{
"power": 231.135e-3,
"power": 206e-3,
"frequency": 201e12,
"propagation_direction": "counterprop"
}
@@ -49,21 +49,6 @@
}
}
},
{
"uid": "Fused1",
"type": "Fused",
"params": {
"loss": 0
},
"metadata": {
"location": {
"latitude": 1.5,
"longitude": 0,
"city": null,
"region": ""
}
}
},
{
"uid": "Edfa1",
"type": "Edfa",
@@ -103,10 +88,6 @@
},
{
"from_node": "Span1",
"to_node": "Fused1"
},
{
"from_node": "Fused1",
"to_node": "Edfa1"
},
{

View File

@@ -1,19 +1,14 @@
{
"raman_params": {
"flag": true,
"result_spatial_resolution": 10e3,
"solver_spatial_resolution": 50
"raman_parameters": {
"flag_raman": true,
"space_resolution": 10e3,
"tolerance": 1e-8
},
"nli_params": {
"method": "ggn_spectrally_separated",
"dispersion_tolerance": 1,
"phase_shift_tolerance": 0.1,
"computed_channels": [
1,
18,
37,
56,
75
]
"nli_parameters": {
"nli_method_name": "ggn_spectrally_separated",
"wdm_grid_size": 50e9,
"dispersion_tolerance": 1,
"phase_shift_tolerance": 0.1,
"computed_channels": [1, 18, 37, 56, 75]
}
}
}

View File

@@ -1,304 +1,304 @@
{
"nf_fit_coeff": [
0.000168241,
0.0469961,
0.0359549,
5.82851
],
"f_min": 191.35e12,
"f_max": 196.1e12,
"nf_ripple": [
0.4372876328262819,
0.4372876328262819,
0.41270842850729195,
0.38814205928193013,
0.36358851509924695,
0.3390191214858807,
0.30474360397422756,
0.27048596623174515,
0.23624619427167134,
0.202035284929368,
0.1694483010211072,
0.13687829834471027,
0.1043252636301016,
0.07184040799914815,
0.061288823415841555,
0.050742731588695494,
0.04020212822983975,
0.029667009055877668,
0.01913736978785662,
0.00861320615127981,
-0.010157321677553965,
-0.028982516728038848,
-0.04779792991567815,
-0.06660356886269536,
-0.06256260169582961,
-0.05832916277634124,
-0.05409792133358102,
-0.04990610405914272,
-0.05078533294804249,
-0.05166410580536087,
-0.05254242298580185,
-0.05342028484370278,
-0.051742390657545205,
-0.050039429413028365,
-0.048337350303318156,
-0.04663615264317309,
-0.04493583574805963,
-0.043236398934156144,
-0.035622012697103154,
-0.027999803010447587,
-0.02038153550619876,
-0.012779471908040341,
-0.006436207679519103,
-9.622162373026585e-05,
0.006240488799898697,
0.012573926129294415,
0.021418708618354456,
0.030289222542492025,
0.03915515813685565,
0.047899419704645264,
0.04256372893215024,
0.03723078993416436,
0.03190060058247842,
0.02657315875107553,
0.021248462316134083,
0.01605877647020772,
0.02326948274513522,
0.03047647598902483,
0.037679759069084225,
0.044883315610536455,
0.052470799141237305,
0.06005437964543287,
0.0676340601339394,
0.07521193198077789,
0.08415906712621996,
0.09310160456603413,
0.1020395478432815,
0.11079585523492333,
0.1018180306253394,
0.09284481475528361,
0.0838762040768461,
0.07482015390297145,
0.05670549786742816,
0.03860013139908377,
0.020504047353947653,
0.0024172385953583004,
-0.015660302006048,
-0.03372858157230583,
-0.07037375788020579,
-0.10709599992470213,
-0.14379944379052215,
-0.18048410390821285,
-0.20911178784023846,
-0.23772399031437283,
-0.26632156113294336,
-0.2949045115165272,
-0.30206775396360075,
-0.30915729645781326,
-0.31624321721895354,
-0.3233255190215882,
-0.32037911876162584,
-0.3172854168606314,
-0.31419329378173544,
-0.31110274831665313,
-0.3110761646066259,
-0.3110761646066259
],
"dgt": [
1.0,
1.017807767853702,
1.0356155337864215,
1.0534217504465226,
1.0712204022764056,
1.0895983485572227,
1.108555289615659,
1.1280891949729075,
1.1476135933863398,
1.1672278304018044,
1.1869318618366975,
1.2067249615595257,
1.2264996957264114,
1.2428104897182262,
1.2556591482982988,
1.2650555289898042,
1.2744470198196236,
1.2838336236692311,
1.2932153453410835,
1.3040618749785347,
1.316383926863083,
1.3301807335621048,
1.3439818461440451,
1.3598972673004606,
1.3779439775587023,
1.3981208704326855,
1.418273806730323,
1.4340878115214444,
1.445565137158368,
1.45273959485914,
1.4599103316162523,
1.4670307626366115,
1.474100442252211,
1.48111939735681,
1.488134243479226,
1.495145456062699,
1.502153039909686,
1.5097346239790443,
1.5178910621476225,
1.5266220576235803,
1.5353620432989845,
1.545374152761467,
1.5566577309558969,
1.569199764184379,
1.5817353179379183,
1.5986915141218316,
1.6201194134191075,
1.6460167077689267,
1.6719047669939942,
1.6918150918099673,
1.7057507692361864,
1.7137640932265894,
1.7217732861435076,
1.7297783508684146,
1.737780757913635,
1.7459181197626403,
1.7541903672600494,
1.7625959636196327,
1.7709972329654864,
1.7793941781790852,
1.7877868031023945,
1.7961751115773796,
1.8045606557581335,
1.8139629377087627,
1.824381436842932,
1.835814081380705,
1.847275503201129,
1.862235672444246,
1.8806927939516411,
1.9026104247588487,
1.9245345552113182,
1.9482128147680253,
1.9736443063300082,
2.0008103857988204,
2.0279625371819305,
2.055100772005235,
2.082225099873648,
2.1183028432496016,
2.16337565384239,
2.2174389328192197,
2.271520771371253,
2.322373696229342,
2.3699990328716107,
2.414398437185221,
2.4587748041127506,
2.499446286796604,
2.5364027376452056,
2.5696460593920065,
2.602860350286428,
2.630396440815385,
2.6521732021128046,
2.6681935771243177,
2.6841217449620203,
2.6947834587664494,
2.705443819238505,
2.714526681131686
],
"gain_ripple": [
0.07704745697916238,
0.06479749697916048,
0.05257029697916238,
0.040326236979161934,
0.028098946979159933,
0.01393231697916164,
-0.0021726530208390216,
-0.01819858302084043,
-0.03218106302083967,
-0.042428283020839785,
-0.05095282302083959,
-0.05947139302083926,
-0.06968090302083851,
-0.07844600302084004,
-0.08407607302083875,
-0.0865687230208394,
-0.08906007302083907,
-0.0913487130208388,
-0.09343261302083761,
-0.09717347302083823,
-0.1027863830208382,
-0.11089282302084058,
-0.11963431302083904,
-0.1279646530208396,
-0.13525493302083902,
-0.1409032730208395,
-0.14591937302083835,
-0.14823350302084037,
-0.1484450830208388,
-0.1455411330208385,
-0.14160178302083892,
-0.1353792530208402,
-0.12789859302083784,
-0.11916081302083725,
-0.11041488302083735,
-0.10103437302083762,
-0.09101254302083817,
-0.07868024302083754,
-0.06468462302083822,
-0.051112303020840244,
-0.039618433020837784,
-0.028748483020837767,
-0.016475303020840215,
-0.006936193020838033,
-0.0015763130208377163,
0.0007104669791608842,
0.0040435869791615175,
0.006965146979162284,
0.00842583697916055,
0.00874012697916271,
0.00936596697916059,
0.01030063697916006,
0.011234826979162449,
0.013321846979160057,
0.01659282697915998,
0.023488786979161347,
0.03285456697916089,
0.04072968697916224,
0.04467697697916151,
0.04551704697916037,
0.04717897697916129,
0.04946107697915991,
0.05154489697916276,
0.05447361697916264,
0.05848224697916038,
0.06916723697916183,
0.08548825697916129,
0.10802383697916085,
0.13114358697916018,
0.15216302697916007,
0.17037189697916233,
0.1767381569791624,
0.1739275269791598,
0.15945681697916214,
0.14239527697916188,
0.12276252697916235,
0.10313984697916112,
0.08731066697916035,
0.07533675697916209,
0.07114372697916238,
0.07094413697916124,
0.07091459697916136,
0.0670723869791594,
0.054956336979159914,
0.038328296979159404,
0.017572956979162058,
-0.0028138630208403015,
-0.016792253020838643,
-0.0246928330208398,
-0.018326963020840026,
-0.0036199830208403228,
0.02602813697916062,
0.06245819697916133,
0.09542181697916163,
0.11822862697916037,
0.1359703369791596
]
"nf_fit_coeff": [
0.000168241,
0.0469961,
0.0359549,
5.82851
],
"f_min": 191.35e12,
"f_max": 196.1e12,
"nf_ripple": [
0.4372876328262819,
0.4372876328262819,
0.41270842850729195,
0.38814205928193013,
0.36358851509924695,
0.3390191214858807,
0.30474360397422756,
0.27048596623174515,
0.23624619427167134,
0.202035284929368,
0.1694483010211072,
0.13687829834471027,
0.1043252636301016,
0.07184040799914815,
0.061288823415841555,
0.050742731588695494,
0.04020212822983975,
0.029667009055877668,
0.01913736978785662,
0.00861320615127981,
-0.010157321677553965,
-0.028982516728038848,
-0.04779792991567815,
-0.06660356886269536,
-0.06256260169582961,
-0.05832916277634124,
-0.05409792133358102,
-0.04990610405914272,
-0.05078533294804249,
-0.05166410580536087,
-0.05254242298580185,
-0.05342028484370278,
-0.051742390657545205,
-0.050039429413028365,
-0.048337350303318156,
-0.04663615264317309,
-0.04493583574805963,
-0.043236398934156144,
-0.035622012697103154,
-0.027999803010447587,
-0.02038153550619876,
-0.012779471908040341,
-0.006436207679519103,
-9.622162373026585e-05,
0.006240488799898697,
0.012573926129294415,
0.021418708618354456,
0.030289222542492025,
0.03915515813685565,
0.047899419704645264,
0.04256372893215024,
0.03723078993416436,
0.03190060058247842,
0.02657315875107553,
0.021248462316134083,
0.01605877647020772,
0.02326948274513522,
0.03047647598902483,
0.037679759069084225,
0.044883315610536455,
0.052470799141237305,
0.06005437964543287,
0.0676340601339394,
0.07521193198077789,
0.08415906712621996,
0.09310160456603413,
0.1020395478432815,
0.11079585523492333,
0.1018180306253394,
0.09284481475528361,
0.0838762040768461,
0.07482015390297145,
0.05670549786742816,
0.03860013139908377,
0.020504047353947653,
0.0024172385953583004,
-0.015660302006048,
-0.03372858157230583,
-0.07037375788020579,
-0.10709599992470213,
-0.14379944379052215,
-0.18048410390821285,
-0.20911178784023846,
-0.23772399031437283,
-0.26632156113294336,
-0.2949045115165272,
-0.30206775396360075,
-0.30915729645781326,
-0.31624321721895354,
-0.3233255190215882,
-0.32037911876162584,
-0.3172854168606314,
-0.31419329378173544,
-0.31110274831665313,
-0.3110761646066259,
-0.3110761646066259
],
"dgt": [
1.0,
1.017807767853702,
1.0356155337864215,
1.0534217504465226,
1.0712204022764056,
1.0895983485572227,
1.108555289615659,
1.1280891949729075,
1.1476135933863398,
1.1672278304018044,
1.1869318618366975,
1.2067249615595257,
1.2264996957264114,
1.2428104897182262,
1.2556591482982988,
1.2650555289898042,
1.2744470198196236,
1.2838336236692311,
1.2932153453410835,
1.3040618749785347,
1.316383926863083,
1.3301807335621048,
1.3439818461440451,
1.3598972673004606,
1.3779439775587023,
1.3981208704326855,
1.418273806730323,
1.4340878115214444,
1.445565137158368,
1.45273959485914,
1.4599103316162523,
1.4670307626366115,
1.474100442252211,
1.48111939735681,
1.488134243479226,
1.495145456062699,
1.502153039909686,
1.5097346239790443,
1.5178910621476225,
1.5266220576235803,
1.5353620432989845,
1.545374152761467,
1.5566577309558969,
1.569199764184379,
1.5817353179379183,
1.5986915141218316,
1.6201194134191075,
1.6460167077689267,
1.6719047669939942,
1.6918150918099673,
1.7057507692361864,
1.7137640932265894,
1.7217732861435076,
1.7297783508684146,
1.737780757913635,
1.7459181197626403,
1.7541903672600494,
1.7625959636196327,
1.7709972329654864,
1.7793941781790852,
1.7877868031023945,
1.7961751115773796,
1.8045606557581335,
1.8139629377087627,
1.824381436842932,
1.835814081380705,
1.847275503201129,
1.862235672444246,
1.8806927939516411,
1.9026104247588487,
1.9245345552113182,
1.9482128147680253,
1.9736443063300082,
2.0008103857988204,
2.0279625371819305,
2.055100772005235,
2.082225099873648,
2.1183028432496016,
2.16337565384239,
2.2174389328192197,
2.271520771371253,
2.322373696229342,
2.3699990328716107,
2.414398437185221,
2.4587748041127506,
2.499446286796604,
2.5364027376452056,
2.5696460593920065,
2.602860350286428,
2.630396440815385,
2.6521732021128046,
2.6681935771243177,
2.6841217449620203,
2.6947834587664494,
2.705443819238505,
2.714526681131686
],
"gain_ripple": [
0.07704745697916238,
0.06479749697916048,
0.05257029697916238,
0.040326236979161934,
0.028098946979159933,
0.01393231697916164,
-0.0021726530208390216,
-0.01819858302084043,
-0.03218106302083967,
-0.042428283020839785,
-0.05095282302083959,
-0.05947139302083926,
-0.06968090302083851,
-0.07844600302084004,
-0.08407607302083875,
-0.0865687230208394,
-0.08906007302083907,
-0.0913487130208388,
-0.09343261302083761,
-0.09717347302083823,
-0.1027863830208382,
-0.11089282302084058,
-0.11963431302083904,
-0.1279646530208396,
-0.13525493302083902,
-0.1409032730208395,
-0.14591937302083835,
-0.14823350302084037,
-0.1484450830208388,
-0.1455411330208385,
-0.14160178302083892,
-0.1353792530208402,
-0.12789859302083784,
-0.11916081302083725,
-0.11041488302083735,
-0.10103437302083762,
-0.09101254302083817,
-0.07868024302083754,
-0.06468462302083822,
-0.051112303020840244,
-0.039618433020837784,
-0.028748483020837767,
-0.016475303020840215,
-0.006936193020838033,
-0.0015763130208377163,
0.0007104669791608842,
0.0040435869791615175,
0.006965146979162284,
0.00842583697916055,
0.00874012697916271,
0.00936596697916059,
0.01030063697916006,
0.011234826979162449,
0.013321846979160057,
0.01659282697915998,
0.023488786979161347,
0.03285456697916089,
0.04072968697916224,
0.04467697697916151,
0.04551704697916037,
0.04717897697916129,
0.04946107697915991,
0.05154489697916276,
0.05447361697916264,
0.05848224697916038,
0.06916723697916183,
0.08548825697916129,
0.10802383697916085,
0.13114358697916018,
0.15216302697916007,
0.17037189697916233,
0.1767381569791624,
0.1739275269791598,
0.15945681697916214,
0.14239527697916188,
0.12276252697916235,
0.10313984697916112,
0.08731066697916035,
0.07533675697916209,
0.07114372697916238,
0.07094413697916124,
0.07091459697916136,
0.0670723869791594,
0.054956336979159914,
0.038328296979159404,
0.017572956979162058,
-0.0028138630208403015,
-0.016792253020838643,
-0.0246928330208398,
-0.018326963020840026,
-0.0036199830208403228,
0.02602813697916062,
0.06245819697916133,
0.09542181697916163,
0.11822862697916037,
0.1359703369791596
]
}

View File

@@ -18,9 +18,9 @@ from gnpy.tools.json_io import load_equipment
from gnpy.topology.request import jsontocsv
parser = ArgumentParser(description='Converting JSON path results into a CSV')
parser.add_argument('filename', type=Path)
parser.add_argument('output_filename', type=Path)
parser = ArgumentParser(description='A function that writes json path results in an excel sheet.')
parser.add_argument('filename', nargs='?', type=Path)
parser.add_argument('output_filename', nargs='?', type=Path)
parser.add_argument('eqpt_filename', nargs='?', type=Path, default=Path(__file__).parent / 'eqpt_config.json')
if __name__ == '__main__':

View File

@@ -1,5 +1,5 @@
"""
'''
Processing of data via :py:mod:`.json_io`.
Utilities for Excel conversion in :py:mod:`.convert` and :py:mod:`.service_sheet`.
Example code in :py:mod:`.cli_examples` and :py:mod:`.plots`.
"""
'''

View File

@@ -1,35 +1,38 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
'''
gnpy.tools.cli_examples
=======================
Common code for CLI examples
"""
'''
import argparse
import json
import logging
import os.path
import sys
from math import ceil
from numpy import linspace, mean
from pathlib import Path
import gnpy.core.ansi_escapes as ansi_escapes
from gnpy.core.elements import Transceiver, Fiber, RamanFiber
from gnpy.core.equipment import trx_mode_params
import gnpy.core.exceptions as exceptions
from gnpy.core.network import add_missing_elements_in_network, design_network
from gnpy.core.network import build_network
from gnpy.core.parameters import SimParams
from gnpy.core.utils import db2lin, lin2db, automatic_nch, watt2dbm, dbm2watt
from gnpy.core.science_utils import Simulation
from gnpy.core.utils import db2lin, lin2db, automatic_nch
from gnpy.topology.request import (ResultElement, jsontocsv, compute_path_dsjctn, requests_aggregation,
BLOCKING_NOPATH, correct_json_route_list,
deduplicate_disjunctions, compute_path_with_disjunction,
PathRequest, compute_constrained_path, propagate)
from gnpy.topology.spectrum_assignment import build_oms_list, pth_assign_spectrum
from gnpy.tools.json_io import (load_equipment, load_network, load_json, load_requests, save_network,
requests_from_json, disjunctions_from_json, save_json, load_initial_spectrum)
from gnpy.tools.json_io import load_equipment, load_network, load_json, load_requests, save_network, \
requests_from_json, disjunctions_from_json, save_json
from gnpy.tools.plots import plot_baseline, plot_results
from gnpy.yang.io import load_from_yang, save_to_json
_logger = logging.getLogger(__name__)
_examples_dir = Path(__file__).parent.parent / 'example-data'
@@ -41,30 +44,35 @@ Learn more at https://gnpy.readthedocs.io/
'''
_help_fname_json = 'FILE.json'
_help_fname_json_csv = 'FILE.(json|csv)'
_help_fname_yangjson = 'FILE-with-YANG.json'
def show_example_data_dir():
print(f'{_examples_dir}/')
def _load_network_legacy(topology_filename, equipment, save_raw_network_filename):
network = load_network(topology_filename, equipment)
if save_raw_network_filename is not None:
save_network(network, save_raw_network_filename)
print(f'{ansi_escapes.blue}Raw network (no optimizations) saved to {save_raw_network_filename}{ansi_escapes.reset}')
return network
def load_common_data(equipment_filename, topology_filename, simulation_filename, save_raw_network_filename):
"""Load common configuration from JSON files"""
'''Load common configuration from JSON files'''
try:
equipment = load_equipment(equipment_filename)
network = load_network(topology_filename, equipment)
if save_raw_network_filename is not None:
save_network(network, save_raw_network_filename)
print(f'{ansi_escapes.blue}Raw network (no optimizations) saved to {save_raw_network_filename}{ansi_escapes.reset}')
if not simulation_filename:
sim_params = {}
sim_params = SimParams(**load_json(simulation_filename)) if simulation_filename is not None else None
network = _load_network_legacy(topology_filename, equipment, save_raw_network_filename)
if not sim_params:
if next((node for node in network if isinstance(node, RamanFiber)), None) is not None:
print(f'{ansi_escapes.red}Invocation error:{ansi_escapes.reset} '
f'RamanFiber requires passing simulation params via --sim-params')
sys.exit(1)
else:
sim_params = load_json(simulation_filename)
SimParams.set_params(sim_params)
Simulation.set_params(sim_params)
except exceptions.EquipmentConfigError as e:
print(f'{ansi_escapes.red}Configuration error in the equipment library:{ansi_escapes.reset} {e}')
sys.exit(1)
@@ -85,17 +93,20 @@ def load_common_data(equipment_filename, topology_filename, simulation_filename,
def _setup_logging(args):
logging.basicConfig(level={2: logging.DEBUG, 1: logging.INFO, 0: logging.WARNING}.get(args.verbose, logging.DEBUG))
logging.basicConfig(level={2: logging.DEBUG, 1: logging.INFO, 0: logging.CRITICAL}.get(args.verbose, logging.DEBUG))
def _parser_add_equipment(parser: argparse.ArgumentParser):
parser.add_argument('-e', '--equipment', type=Path, metavar=_help_fname_json,
default=_examples_dir / 'eqpt_config.json', help='Equipment library')
def _add_common_options(parser: argparse.ArgumentParser, network_default: Path):
parser.add_argument('topology', nargs='?', type=Path, metavar='NETWORK-TOPOLOGY.(json|xls|xlsx)',
default=network_default,
help='Input network topology')
parser.add_argument('-v', '--verbose', action='count', default=0,
help='Increase verbosity (can be specified several times)')
parser.add_argument('-e', '--equipment', type=Path, metavar=_help_fname_json,
default=_examples_dir / 'eqpt_config.json', help='Equipment library')
_parser_add_equipment(parser)
parser.add_argument('--sim-params', type=Path, metavar=_help_fname_json,
default=None, help='Path to the JSON containing simulation parameters (required for Raman). '
f'Example: {_examples_dir / "sim_params.json"}')
@@ -103,9 +114,8 @@ def _add_common_options(parser: argparse.ArgumentParser, network_default: Path):
help='Save the final network as a JSON file')
parser.add_argument('--save-network-before-autodesign', type=Path, metavar=_help_fname_json,
help='Dump the network into a JSON file prior to autodesign')
parser.add_argument('--no-insert-edfas', action='store_true',
help='Disable insertion of EDFAs after ROADMs and fibers '
'as well as splitting of fibers by auto-design.')
parser.add_argument('--from-yang', type=Path, metavar=_help_fname_yangjson,
help='Load equipment, (in future also topology) and simulation parameters from a YANG-formatted JSON file')
def transmission_main_example(args=None):
@@ -119,14 +129,21 @@ def transmission_main_example(args=None):
parser.add_argument('-pl', '--plot', action='store_true')
parser.add_argument('-l', '--list-nodes', action='store_true', help='list all transceiver nodes')
parser.add_argument('-po', '--power', default=0, help='channel ref power in dBm')
parser.add_argument('--spectrum', type=Path, help='user defined mixed rate spectrum JSON file')
parser.add_argument('source', nargs='?', help='source node')
parser.add_argument('destination', nargs='?', help='destination node')
args = parser.parse_args(args if args is not None else sys.argv[1:])
_setup_logging(args)
(equipment, network) = load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
if args.from_yang:
# FIXME: move this into a better place, it does not belong to a CLI frontend
with open(args.from_yang, 'r') as f:
raw_json = json.load(f)
(equipment, network) = load_from_yang(raw_json)
if args.save_network_before_autodesign is not None:
save_network(network, args.save_network_before_autodesign)
else:
(equipment, network) = load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
if args.plot:
plot_baseline(network)
@@ -191,46 +208,33 @@ def transmission_main_example(args=None):
params['loose_list'] = ['strict']
params['format'] = ''
params['path_bandwidth'] = 0
params['effective_freq_slot'] = None
trx_params = trx_mode_params(equipment)
trx_params['power'] = dbm2watt(equipment['SI']['default'].power_dbm)
trx_params['tx_power'] = dbm2watt(equipment['SI']['default'].power_dbm)
if args.power:
trx_params['power'] = dbm2watt(float(args.power))
trx_params['tx_power'] = dbm2watt(float(args.power))
trx_params['power'] = db2lin(float(args.power)) * 1e-3
params.update(trx_params)
initial_spectrum = None
params['nb_channel'] = automatic_nch(trx_params['f_min'], trx_params['f_max'], trx_params['spacing'])
# use ref_req to hold reference channel used for design and req for the propagation
# and req to hold channels to be propagated
# apply power sweep on the design and on the channels
ref_req = PathRequest(**params)
pref_ch_db = watt2dbm(ref_req.power)
if args.spectrum:
# use the spectrum defined by user for the propagation.
# the nb of channel for design remains the one of the reference channel
initial_spectrum = load_initial_spectrum(args.spectrum)
params['nb_channel'] = len(initial_spectrum)
print('User input for spectrum used for propagation instead of SI')
req = PathRequest(**params)
p_ch_db = watt2dbm(req.power)
req.initial_spectrum = initial_spectrum
print(f'There are {req.nb_channel} channels propagating')
power_mode = equipment['Span']['default'].power_mode
print('\n'.join([f'Power mode is set to {power_mode}',
'=> it can be modified in eqpt_config.json - Span']))
if not args.no_insert_edfas:
try:
add_missing_elements_in_network(network, equipment)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
f'=> it can be modified in eqpt_config.json - Span']))
pref_ch_db = lin2db(req.power * 1e3) # reference channel power / span (SL=20dB)
pref_total_db = pref_ch_db + lin2db(req.nb_channel) # reference total power / span (SL=20dB)
try:
build_network(network, equipment, pref_ch_db, pref_total_db)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
path = compute_constrained_path(network, req)
spans = [s.params.length for s in path if isinstance(s, RamanFiber) or isinstance(s, Fiber)]
print(f'\nThere are {len(spans)} fiber spans over {sum(spans)/1000:.0f} km between {source.uid} '
f'and {destination.uid}')
print(f'\nNow propagating between {source.uid} and {destination.uid}:')
power_range = [0]
if power_mode:
# power cannot be changed in gain mode
@@ -240,32 +244,11 @@ def transmission_main_example(args=None):
power_range = list(linspace(p_start, p_stop, p_num))
except TypeError:
print('invalid power range definition in eqpt_config, should be power_range_db: [lower, upper, step]')
# initial network is designed using req.power. that is that any missing information (amp gain or delta_p) is filled
# using this req.power, previous to any sweep requested later on.
try:
design_network(ref_req, network, equipment, set_connector_losses=True, verbose=True)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
print(f'\nThere are {len(spans)} fiber spans over {sum(spans)/1000:.0f} km between {source.uid} '
f'and {destination.uid}')
print(f'\nNow propagating between {source.uid} and {destination.uid}:')
for dp_db in power_range:
ref_req.power = dbm2watt(pref_ch_db + dp_db)
req.power = dbm2watt(p_ch_db + dp_db)
design_network(ref_req, network, equipment, set_connector_losses=False, verbose=False)
# if initial spectrum did not contain any power, now we need to use this one.
# note the initial power defines a differential wrt req.power so that if req.power is set to 2mW (3dBm)
# and initial spectrum was set to 0, this sets a initial per channel delta power to -3dB, so that
# whatever the equalization, -3 dB is applied on all channels (ie initial power in initial spectrum pre-empts
# "--power" option)
req.power = db2lin(pref_ch_db + dp_db) * 1e-3
if power_mode:
print(f'\nPropagating with input power = {ansi_escapes.cyan}{watt2dbm(req.power):.2f} '
+ f'dBm{ansi_escapes.reset}:')
print(f'\nPropagating with input power = {ansi_escapes.cyan}{lin2db(req.power*1e3):.2f} dBm{ansi_escapes.reset}:')
else:
print(f'\nPropagating in {ansi_escapes.cyan}gain mode{ansi_escapes.reset}: power cannot be set manually')
infos = propagate(path, req, equipment)
@@ -299,9 +282,9 @@ def transmission_main_example(args=None):
ch_freq = final_carrier.frequency * 1e-12
ch_power = lin2db(final_carrier.power.signal * 1e3)
print(
'{:5}{:26.5f}{:26.2f}{:28.2f}{:28.2f}{:28.2f}' .format(
'{:5}{:26.2f}{:26.2f}{:28.2f}{:28.2f}{:28.2f}' .format(
final_carrier.channel_number, round(
ch_freq, 5), round(
ch_freq, 2), round(
ch_power, 2), round(
ch_osnr, 2), round(
ch_snr_nl, 2), round(
@@ -343,52 +326,26 @@ def path_requests_run(args=None):
args = parser.parse_args(args if args is not None else sys.argv[1:])
_setup_logging(args)
_logger.info(f'Computing path requests {args.service_filename.name} into JSON format')
_logger.info(f'Computing path requests {args.service_filename} into JSON format')
print(f'{ansi_escapes.blue}Computing path requests {os.path.relpath(args.service_filename)} into JSON format{ansi_escapes.reset}')
(equipment, network) = load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
# Build the network once using the default power defined in SI in eqpt config
# TODO power density: db2linp(ower_dbm": 0)/power_dbm": 0 * nb channels as defined by
# spacing, f_min and f_max
if not args.no_insert_edfas:
try:
add_missing_elements_in_network(network, equipment)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
p_db = equipment['SI']['default'].power_dbm
params = {
'request_id': 'reference',
'trx_type': '',
'trx_mode': '',
'source': None,
'destination': None,
'bidir': False,
'nodes_list': [],
'loose_list': [],
'format': '',
'path_bandwidth': 0,
'effective_freq_slot': None,
'nb_channel': automatic_nch(equipment['SI']['default'].f_min, equipment['SI']['default'].f_max,
equipment['SI']['default'].spacing),
'power': dbm2watt(equipment['SI']['default'].power_dbm),
'tx_power': dbm2watt(equipment['SI']['default'].power_dbm)
}
trx_params = trx_mode_params(equipment)
params.update(trx_params)
reference_channel = PathRequest(**params)
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,
equipment['SI']['default'].f_max, equipment['SI']['default'].spacing))
try:
design_network(reference_channel, network, equipment, verbose=True)
build_network(network, equipment, p_db, p_total_db)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
if args.save_network is not None:
save_network(network, args.save_network)
print(f'{ansi_escapes.blue}Network (after autodesign) saved to {args.save_network}{ansi_escapes.reset}')
@@ -503,3 +460,22 @@ def path_requests_run(args=None):
else:
print(f'{ansi_escapes.red}Cannot save output: neither JSON nor CSV file{ansi_escapes.reset}')
sys.exit(1)
def convert_to_yang(args=None):
parser = argparse.ArgumentParser(
description='Convert data to the YANG+JSON data format',
epilog=_help_footer,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
_parser_add_equipment(parser)
parser.add_argument('--topology', type=Path, metavar='NETWORK-TOPOLOGY.(json|xls|xlsx)',
help='Input network topology')
args = parser.parse_args(args if args is not None else sys.argv[1:])
equipment = load_equipment(args.equipment)
network = load_network(args.topology, equipment) if args.topology is not None else None
data = save_to_json(equipment, network)
print(json.dumps(data, indent=2))

View File

@@ -21,22 +21,18 @@ the "east" information so that it is possible to input undirected data.
"""
from xlrd import open_workbook
from logging import getLogger
from argparse import ArgumentParser
from collections import namedtuple, Counter, defaultdict
from itertools import chain
from json import dumps
from pathlib import Path
from copy import copy
from gnpy.core import ansi_escapes
from gnpy.core.utils import silent_remove
from gnpy.core.exceptions import NetworkTopologyError
from gnpy.core.elements import Edfa, Fused, Fiber
_logger = getLogger(__name__)
def all_rows(sh, start=0):
return (sh.row(x) for x in range(start, sh.nrows))
@@ -122,7 +118,7 @@ class Eqpt(object):
'east_att_in': 0,
'east_amp_gain': None,
'east_amp_dp': None,
'east_tilt_vs_wavelength': 0,
'east_tilt': 0,
'east_att_out': None
}
@@ -187,18 +183,18 @@ def parse_headers(my_sheet, input_headers_dict, headers, start_line, slice_in):
slice_out = read_slice(my_sheet, start_line + iteration, slice_in, h0)
iteration += 1
if slice_out == (-1, -1):
msg = f'missing header {h0}'
if h0 in ('east', 'Node A', 'Node Z', 'City'):
raise NetworkTopologyError(msg)
print(f'{ansi_escapes.red}CRITICAL{ansi_escapes.reset}: missing _{h0}_ header: EXECUTION ENDS')
raise NetworkTopologyError(f'Missing _{h0}_ header')
else:
_logger.warning(msg)
print(f'missing header {h0}')
elif not isinstance(input_headers_dict[h0], dict):
headers[slice_out[0]] = input_headers_dict[h0]
else:
headers = parse_headers(my_sheet, input_headers_dict[h0], headers, start_line + 1, slice_out)
if headers == {}:
msg = 'CRITICAL ERROR: could not find any header to read _ ABORT'
raise NetworkTopologyError(msg)
print(f'{ansi_escapes.red}CRITICAL ERROR{ansi_escapes.reset}: could not find any header to read _ ABORT')
raise NetworkTopologyError('Could not find any header to read')
return headers
@@ -223,76 +219,40 @@ def sanity_check(nodes, links, nodes_by_city, links_by_city, eqpts_by_city):
for l1 in links:
for l2 in links:
if l1 is not l2 and l1 == l2 and l2 not in duplicate_links:
_logger.warning(f'\nWARNING\n \
print(f'\nWARNING\n \
link {l1.from_city}-{l1.to_city} is duplicate \
\nthe 1st duplicate link will be removed but you should check Links sheet input')
duplicate_links.append(l1)
if duplicate_links:
msg = 'XLS error: ' \
+ f'links {_format_items([(d.from_city, d.to_city) for d in duplicate_links])} are duplicate'
raise NetworkTopologyError(msg)
for l in duplicate_links:
links.remove(l)
links_by_city[l.from_city].remove(l)
links_by_city[l.to_city].remove(l)
unreferenced_nodes = [n for n in nodes_by_city if n not in links_by_city]
if unreferenced_nodes:
msg = 'XLS error: The following nodes are not ' \
+ 'referenced from the Links sheet. ' \
+ 'If unused, remove them from the Nodes sheet:\n' \
+ _format_items(unreferenced_nodes)
raise NetworkTopologyError(msg)
raise NetworkTopologyError(f'{ansi_escapes.red}XLS error:{ansi_escapes.reset} The following nodes are not '
f'referenced from the {ansi_escapes.cyan}Links{ansi_escapes.reset} sheet. '
f'If unused, remove them from the {ansi_escapes.cyan}Nodes{ansi_escapes.reset} '
f'sheet:\n'
+ _format_items(unreferenced_nodes))
# no need to check "Links" for invalid nodes because that's already in parse_excel()
wrong_eqpt_from = [n for n in eqpts_by_city if n not in nodes_by_city]
wrong_eqpt_to = [n.to_city for destinations in eqpts_by_city.values()
for n in destinations if n.to_city not in nodes_by_city]
wrong_eqpt = wrong_eqpt_from + wrong_eqpt_to
if wrong_eqpt:
msg = 'XLS error: ' \
+ 'The Eqpt sheet refers to nodes that ' \
+ 'are not defined in the Nodes sheet:\n'\
+ _format_items(wrong_eqpt)
raise NetworkTopologyError(msg)
# Now check links that are not listed in Links sheet, and duplicates
bad_eqpt = []
possible_links = [f'{e.from_city}|{e.to_city}' for e in links] + [f'{e.to_city}|{e.from_city}' for e in links]
possible_eqpt = []
duplicate_eqpt = []
duplicate_ila = []
for city, eqpts in eqpts_by_city.items():
for eqpt in eqpts:
# Check that each node_A-node_Z exists in links
nodea_nodez = f'{eqpt.from_city}|{eqpt.to_city}'
nodez_nodea = f'{eqpt.to_city}|{eqpt.from_city}'
if nodea_nodez not in possible_links \
or nodez_nodea not in possible_links:
bad_eqpt.append([eqpt.from_city, eqpt.to_city])
else:
# Check that there are no duplicate lines in the Eqpt sheet
if nodea_nodez in possible_eqpt:
duplicate_eqpt.append([eqpt.from_city, eqpt.to_city])
else:
possible_eqpt.append(nodea_nodez)
# check that there are no two lines defining an ILA with different directions
if nodes_by_city[city].node_type == 'ILA' and len(eqpts) > 1:
duplicate_ila.append(city)
if bad_eqpt:
msg = 'XLS error: ' \
+ 'The Eqpt sheet references links that ' \
+ 'are not defined in the Links sheet:\n' \
+ _format_items(f'{item[0]} -> {item[1]}' for item in bad_eqpt)
raise NetworkTopologyError(msg)
if duplicate_eqpt:
msg = 'XLS error: Duplicate lines in Eqpt sheet:' \
+ _format_items(f'{item[0]} -> {item[1]}' for item in duplicate_eqpt)
raise NetworkTopologyError(msg)
if duplicate_ila:
msg = 'XLS error: Duplicate ILA eqpt definition in Eqpt sheet:' \
+ _format_items(duplicate_ila)
raise NetworkTopologyError(msg)
raise NetworkTopologyError(f'{ansi_escapes.red}XLS error:{ansi_escapes.reset} '
f'The {ansi_escapes.cyan}Eqpt{ansi_escapes.reset} sheet refers to nodes that '
f'are not defined in the {ansi_escapes.cyan}Nodes{ansi_escapes.reset} sheet:\n'
+ _format_items(wrong_eqpt))
for city, link in links_by_city.items():
if nodes_by_city[city].node_type.lower() == 'ila' and len(link) != 2:
# wrong input: ILA sites can only be Degree 2
# => correct to make it a ROADM and remove entry in links_by_city
_logger.warning(f'invalid node type ({nodes_by_city[city].node_type}) '
+ f'specified in {city}, replaced by ROADM')
# TODO: put in log rather than print
print(f'invalid node type ({nodes_by_city[city].node_type})\
specified in {city}, replaced by ROADM')
nodes_by_city[city].node_type = 'ROADM'
for n in nodes:
if n.city == city:
@@ -345,13 +305,13 @@ def create_east_eqpt_element(node):
eqpt['type_variety'] = f'{node.east_amp_type}'
eqpt['operational'] = {'gain_target': node.east_amp_gain,
'delta_p': node.east_amp_dp,
'tilt_target': node.east_tilt_vs_wavelength,
'tilt_target': node.east_tilt,
'out_voa': node.east_att_out}
elif node.east_amp_type.lower() == '':
eqpt['type'] = 'Edfa'
eqpt['operational'] = {'gain_target': node.east_amp_gain,
'delta_p': node.east_amp_dp,
'tilt_target': node.east_tilt_vs_wavelength,
'tilt_target': node.east_tilt,
'out_voa': node.east_att_out}
elif node.east_amp_type.lower() == 'fused':
# fused edfa variety is a hack to indicate that there should not be
@@ -378,12 +338,12 @@ def create_west_eqpt_element(node):
eqpt['type_variety'] = f'{node.west_amp_type}'
eqpt['operational'] = {'gain_target': node.west_amp_gain,
'delta_p': node.west_amp_dp,
'tilt_target': node.west_tilt_vs_wavelength,
'tilt_target': node.west_tilt,
'out_voa': node.west_att_out}
elif node.west_amp_type.lower() == '':
eqpt['operational'] = {'gain_target': node.west_amp_gain,
'delta_p': node.west_amp_dp,
'tilt_target': node.west_tilt_vs_wavelength,
'tilt_target': node.west_tilt,
'out_voa': node.west_att_out}
elif node.west_amp_type.lower() == 'fused':
eqpt['type'] = 'Fused'
@@ -682,19 +642,17 @@ def parse_excel(input_filename):
# sanity check
all_cities = Counter(n.city for n in nodes)
if len(all_cities) != len(nodes):
msg = f'Duplicate city: {all_cities}'
raise NetworkTopologyError(msg)
raise ValueError(f'Duplicate city: {all_cities}')
bad_links = []
for lnk in links:
if lnk.from_city not in all_cities or lnk.to_city not in all_cities:
bad_links.append([lnk.from_city, lnk.to_city])
if bad_links:
msg = 'XLS error: ' \
+ 'The Links sheet references nodes that ' \
+ 'are not defined in the Nodes sheet:\n' \
+ _format_items(f'{item[0]} -> {item[1]}' for item in bad_links)
raise NetworkTopologyError(msg)
raise NetworkTopologyError(f'{ansi_escapes.red}XLS error:{ansi_escapes.reset} '
f'The {ansi_escapes.cyan}Links{ansi_escapes.reset} sheet references nodes that '
f'are not defined in the {ansi_escapes.cyan}Nodes{ansi_escapes.reset} sheet:\n'
+ _format_items(f'{item[0]} -> {item[1]}' for item in bad_links))
return nodes, links, eqpts, roadms

View File

@@ -1,29 +1,24 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
'''
gnpy.tools.json_io
==================
Loading and saving data from JSON files in GNPy's internal data format
"""
'''
from networkx import DiGraph
from logging import getLogger
from pathlib import Path
import json
from collections import namedtuple
from numpy import arange
from gnpy.core import elements
from gnpy.core import ansi_escapes, elements
from gnpy.core.equipment import trx_mode_params
from gnpy.core.exceptions import ConfigurationError, EquipmentConfigError, NetworkTopologyError, ServiceError
from gnpy.core.science_utils import estimate_nf_model
from gnpy.core.info import Carrier
from gnpy.core.utils import automatic_nch, automatic_fmax, merge_amplifier_restrictions, dbm2watt
from gnpy.core.parameters import DEFAULT_RAMAN_COEFFICIENT, EdfaParams
from gnpy.topology.request import PathRequest, Disjunction, compute_spectrum_slot_vs_bandwidth
from gnpy.topology.spectrum_assignment import mvalue_to_slots
from gnpy.core.utils import automatic_nch, automatic_fmax, merge_amplifier_restrictions
from gnpy.topology.request import PathRequest, Disjunction
from gnpy.tools.convert import xls_to_json_data
from gnpy.tools.service_sheet import read_service_sheet
@@ -51,11 +46,11 @@ class _JsonThing:
clean_kwargs = {k: v for k, v in kwargs.items() if v != ''}
for k, v in default_values.items():
setattr(self, k, clean_kwargs.get(k, v))
if k not in clean_kwargs and name != 'Amp' and v is not None and v != []:
# do not show this warning if the default value is None
msg = f'\n\tWARNING missing {k} attribute in eqpt_config.json[{name}]' \
+ f'\n\tdefault value is {k} = {v}\n'
_logger.warning(msg)
if k not in clean_kwargs and name != 'Amp':
print(ansi_escapes.red +
f'\n WARNING missing {k} attribute in eqpt_config.json[{name}]' +
f'\n default value is {k} = {v}' +
ansi_escapes.reset)
class SI(_JsonThing):
@@ -68,8 +63,7 @@ class SI(_JsonThing):
"power_range_db": [0, 0, 0.5],
"roll_off": 0.15,
"tx_osnr": 45,
"sys_margins": 0,
"tx_power_dbm": None # optional value in SI
"sys_margins": 0
}
def __init__(self, **kwargs):
@@ -97,33 +91,16 @@ class Span(_JsonThing):
class Roadm(_JsonThing):
default_values = {
'type_variety': 'default',
'target_pch_out_db': -17,
'add_drop_osnr': 100,
'pmd': 0,
'pdl': 0,
'restrictions': {
'preamp_variety_list': [],
'booster_variety_list': []
},
'roadm-path-impairments': []
}
}
def __init__(self, **kwargs):
# If equalization is not defined in equipment, then raise an error.
# Only one type of equalization must be defined.
allowed_equalisations = ['target_pch_out_db', 'target_psd_out_mWperGHz', 'target_out_mWperSlotWidth']
requested_eq_mask = [eq in kwargs for eq in allowed_equalisations]
if sum(requested_eq_mask) > 1:
msg = 'Only one equalization type should be set in ROADM, found: ' \
+ ', '.join(eq for eq in allowed_equalisations if eq in kwargs)
raise EquipmentConfigError(msg)
if not any(requested_eq_mask):
msg = 'No equalization type set in ROADM'
raise EquipmentConfigError(msg)
for key in allowed_equalisations:
if key in kwargs:
setattr(self, key, kwargs[key])
break
self.update_attr(self.default_values, kwargs, 'Roadm')
@@ -136,55 +113,57 @@ class Transceiver(_JsonThing):
def __init__(self, **kwargs):
self.update_attr(self.default_values, kwargs, 'Transceiver')
for mode_params in self.mode:
penalties = mode_params.get('penalties')
mode_params['penalties'] = {}
mode_params['equalization_offset_db'] = mode_params.get('equalization_offset_db', 0)
if not penalties:
continue
for impairment in ('chromatic_dispersion', 'pmd', 'pdl'):
imp_penalties = [p for p in penalties if impairment in p]
if not imp_penalties:
continue
if all(p[impairment] > 0 for p in imp_penalties):
# make sure the list of penalty values include a proper lower boundary
# (we assume 0 penalty for 0 impairment)
imp_penalties.insert(0, {impairment: 0, 'penalty_value': 0})
# make sure the list of penalty values are sorted by impairment value
imp_penalties.sort(key=lambda i: i[impairment])
# rearrange as dict of lists instead of list of dicts
mode_params['penalties'][impairment] = {
'up_to_boundary': [p[impairment] for p in imp_penalties],
'penalty_value': [p['penalty_value'] for p in imp_penalties]
}
class Fiber(_JsonThing):
default_values = {
'type_variety': '',
'dispersion': None,
'effective_area': None,
'gamma': 0,
'pmd_coef': 0
}
def __init__(self, **kwargs):
self.update_attr(self.default_values, kwargs, self.__class__.__name__)
if 'gamma' in kwargs:
setattr(self, 'gamma', kwargs['gamma'])
if 'raman_efficiency' in kwargs:
raman_coefficient = kwargs['raman_efficiency']
cr = raman_coefficient.pop('cr')
raman_coefficient['g0'] = cr
raman_coefficient['reference_frequency'] = DEFAULT_RAMAN_COEFFICIENT['reference_frequency']
setattr(self, 'raman_coefficient', raman_coefficient)
self.update_attr(self.default_values, kwargs, 'Fiber')
class RamanFiber(Fiber):
pass
class RamanFiber(_JsonThing):
default_values = {
'type_variety': '',
'dispersion': None,
'gamma': 0,
'pmd_coef': 0,
'raman_efficiency': None
}
def __init__(self, **kwargs):
self.update_attr(self.default_values, kwargs, 'RamanFiber')
for param in ('cr', 'frequency_offset'):
if param not in self.raman_efficiency:
raise EquipmentConfigError(f'RamanFiber.raman_efficiency: missing "{param}" parameter')
if self.raman_efficiency['frequency_offset'] != sorted(self.raman_efficiency['frequency_offset']):
raise EquipmentConfigError(f'RamanFiber.raman_efficiency.frequency_offset is not sorted')
class Amp(_JsonThing):
default_values = EdfaParams.default_values
default_values = {
'f_min': 191.35e12,
'f_max': 196.1e12,
'type_variety': '',
'type_def': '',
'gain_flatmax': None,
'gain_min': None,
'p_max': None,
'nf_model': None,
'dual_stage_model': None,
'nf_fit_coeff': None,
'nf_ripple': None,
'dgt': None,
'gain_ripple': None,
'out_voa_auto': False,
'allowed_for_design': False,
'raman': False
}
def __init__(self, **kwargs):
self.update_attr(self.default_values, kwargs, 'Amp')
@@ -202,8 +181,7 @@ class Amp(_JsonThing):
try:
nf0 = kwargs.pop('nf0')
except KeyError: # nf0 is expected for a fixed gain amp
msg = f'missing nf0 value input for amplifier: {type_variety} in equipment config'
raise EquipmentConfigError(msg)
raise EquipmentConfigError(f'missing nf0 value input for amplifier: {type_variety} in equipment config')
for k in ('nf_min', 'nf_max'):
try:
del kwargs[k]
@@ -218,8 +196,7 @@ class Amp(_JsonThing):
nf_min = kwargs.pop('nf_min')
nf_max = kwargs.pop('nf_max')
except KeyError:
msg = f'missing nf_min or nf_max value input for amplifier: {type_variety} in equipment config'
raise EquipmentConfigError(msg)
raise EquipmentConfigError(f'missing nf_min or nf_max value input for amplifier: {type_variety} in equipment config')
try: # remove all remaining nf inputs
del kwargs['nf0']
except KeyError:
@@ -241,8 +218,7 @@ class Amp(_JsonThing):
preamp_variety = kwargs.pop('preamp_variety')
booster_variety = kwargs.pop('booster_variety')
except KeyError:
msg = f'missing preamp/booster variety input for amplifier: {type_variety} in equipment config'
raise EquipmentConfigError(msg)
raise EquipmentConfigError(f'missing preamp/booster variety input for amplifier: {type_variety} in equipment config')
dual_stage_def = Model_dual_stage(preamp_variety, booster_variety)
else:
raise EquipmentConfigError(f'Edfa type_def {type_def} does not exist')
@@ -261,93 +237,11 @@ def _automatic_spacing(baud_rate):
return min((s[1] for s in spacing_list if s[0] > baud_rate), default=baud_rate * 1.2)
def _spectrum_from_json(json_data):
"""JSON_data is a list of spectrum partitions each with
{f_min, f_max, baud_rate, roll_off, delta_pdb, slot_width, tx_osnr, label}
Creates the per freq Carrier's dict.
f_min, f_max, baud_rate, slot_width and roll_off are mandatory
label, tx_osnr and delta_pdb are created if not present
label should be different for each partition
>>> json_data = {'spectrum': \
[{'f_min': 193.2e12, 'f_max': 193.4e12, 'slot_width': 50e9, 'baud_rate': 32e9, 'roll_off': 0.15, \
'delta_pdb': 1, 'tx_osnr': 45, 'tx_power_dbm': -7},\
{'f_min': 193.4625e12, 'f_max': 193.9875e12, 'slot_width': 75e9, 'baud_rate': 64e9, 'roll_off': 0.15},\
{'f_min': 194.075e12, 'f_max': 194.075e12, 'slot_width': 100e9, 'baud_rate': 90e9, 'roll_off': 0.15},\
{'f_min': 194.2e12, 'f_max': 194.35e12, 'slot_width': 50e9, 'baud_rate': 32e9, 'roll_off': 0.15}]}
>>> spectrum = _spectrum_from_json(json_data['spectrum'])
>>> for k, v in spectrum.items():
... print(f'{k}: {v}')
...
193200000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label='0-32.00G')
193250000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label='0-32.00G')
193300000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label='0-32.00G')
193350000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label='0-32.00G')
193400000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label='0-32.00G')
193462500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193537500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193612500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193687500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193762500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193837500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193912500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
193987500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='1-64.00G')
194075000000000.0: Carrier(delta_pdb=0, baud_rate=90000000000.0, slot_width=100000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='2-90.00G')
194200000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='3-32.00G')
194250000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='3-32.00G')
194300000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='3-32.00G')
194350000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label='3-32.00G')
"""
spectrum = {}
json_data = sorted(json_data, key=lambda x: x['f_min'])
# min freq of occupation is f_min - slot_width/2 (numbering starts at 0)
previous_part_max_freq = 0.0
for index, part in enumerate(json_data):
# default delta_pdb is 0 dB
if 'delta_pdb' not in part:
part['delta_pdb'] = 0
# add a label to the partition for the printings
if 'label' not in part:
part['label'] = f'{index}-{part["baud_rate"] * 1e-9 :.2f}G'
# default tx_osnr is set to 40 dB
if 'tx_osnr' not in part:
part['tx_osnr'] = 40
# default tx_power_dbm is set to 0 dBn
if 'tx_power_dbm' not in part:
part['tx_power_dbm'] = 0
# starting freq is exactly f_min to be consistent with utils.automatic_nch
# first partition min occupation is f_min - slot_width / 2 (central_frequency is f_min)
# supposes that carriers are centered on frequency
if previous_part_max_freq > (part['f_min'] - part['slot_width'] / 2):
# check that previous part last channel does not overlap on next part first channel
# max center of the part should be below part['f_max'] and aligned on the slot_width
msg = 'Not a valid initial spectrum definition:\nprevious spectrum last carrier max occupation ' +\
f'{previous_part_max_freq * 1e-12 :.5f}GHz ' +\
'overlaps on next spectrum first carrier occupation ' +\
f'{(part["f_min"] - part["slot_width"] / 2) * 1e-12 :.5f}GHz'
raise ValueError(msg)
max_range = ((part['f_max'] - part['f_min']) // part['slot_width'] + 1) * part['slot_width']
for current_freq in arange(part['f_min'],
part['f_min'] + max_range,
part['slot_width']):
spectrum[current_freq] = Carrier(delta_pdb=part['delta_pdb'], baud_rate=part['baud_rate'],
slot_width=part['slot_width'], roll_off=part['roll_off'],
tx_osnr=part['tx_osnr'], tx_power=dbm2watt(part['tx_power_dbm']),
label=part['label'])
previous_part_max_freq = current_freq + part['slot_width'] / 2
return spectrum
def load_equipment(filename):
json_data = load_json(filename)
return _equipment_from_json(json_data, filename)
def load_initial_spectrum(filename):
json_data = load_json(filename)
return _spectrum_from_json(json_data['spectrum'])
def _update_dual_stage(equipment):
edfa_dict = equipment['Edfa']
for edfa in edfa_dict.values():
@@ -368,14 +262,14 @@ def _update_dual_stage(equipment):
def _roadm_restrictions_sanity_check(equipment):
"""verifies that booster and preamp restrictions specified in roadm equipment are listed in the edfa."""
for roadm_type, roadm_eqpt in equipment['Roadm'].items():
restrictions = roadm_eqpt.restrictions['booster_variety_list'] + \
roadm_eqpt.restrictions['preamp_variety_list']
for amp_name in restrictions:
if amp_name not in equipment['Edfa']:
raise EquipmentConfigError(f'ROADM {roadm_type} restriction {amp_name} does not refer to a '
+ 'defined EDFA name')
""" verifies that booster and preamp restrictions specified in roadm equipment are listed
in the edfa.
"""
restrictions = equipment['Roadm']['default'].restrictions['booster_variety_list'] + \
equipment['Roadm']['default'].restrictions['preamp_variety_list']
for amp_name in restrictions:
if amp_name not in equipment['Edfa']:
raise EquipmentConfigError(f'ROADM restriction {amp_name} does not refer to a defined EDFA name')
def _check_fiber_vs_raman_fiber(equipment):
@@ -383,7 +277,7 @@ def _check_fiber_vs_raman_fiber(equipment):
if 'RamanFiber' not in equipment:
return
for fiber_type in set(equipment['Fiber'].keys()) & set(equipment['RamanFiber'].keys()):
for attr in ('dispersion', 'dispersion-slope', 'effective_area', 'gamma', 'pmd-coefficient'):
for attr in ('dispersion', 'dispersion-slope', 'gamma', 'pmd-coefficient'):
fiber = equipment['Fiber'][fiber_type]
raman = equipment['RamanFiber'][fiber_type]
a = getattr(fiber, attr, None)
@@ -416,9 +310,6 @@ def _equipment_from_json(json_data, filename):
elif key == 'Roadm':
equipment[key][subkey] = Roadm(**entry)
elif key == 'SI':
# use power_dbm value for tx_power_dbm if the key is not in 'SI'
# if 'tx_power_dbm' not in entry.keys():
# entry['tx_power_dbm'] = entry['power_dbm']
equipment[key][subkey] = SI(**entry)
elif key == 'Transceiver':
equipment[key][subkey] = Transceiver(**entry)
@@ -443,11 +334,11 @@ def load_network(filename, equipment):
def save_network(network: DiGraph, filename: str):
"""Dump the network into a JSON file
'''Dump the network into a JSON file
:param network: network to work on
:param filename: file to write to
"""
'''
save_json(network_to_json(network), filename)
@@ -481,28 +372,14 @@ def network_from_json(json_data, equipment):
# well, there's no variety for the 'Fused' node type
pass
elif variety in equipment[typ]:
extra_params = equipment[typ][variety].__dict__
extra_params = equipment[typ][variety]
temp = el_config.setdefault('params', {})
if typ == 'Roadm':
# if equalization is defined, remove default equalization from the extra_params
# If equalisation is not defined in the element config, then use the default one from equipment
# if more than one equalization was defined in element config, then raise an error
extra_params = merge_equalization(temp, extra_params)
if not extra_params:
msg = f'ROADM {el_config["uid"]}: invalid equalization settings'
raise ConfigurationError(msg)
temp = merge_amplifier_restrictions(temp, extra_params)
temp = merge_amplifier_restrictions(temp, extra_params.__dict__)
el_config['params'] = temp
el_config['type_variety'] = variety
elif (typ in ['Fiber', 'RamanFiber', 'Roadm']):
elif (typ in ['Fiber', 'RamanFiber']) or (typ == 'Edfa' and variety not in ['default', '']):
raise ConfigurationError(f'The {typ} of variety type {variety} was not recognized:'
'\nplease check it is properly defined in the eqpt_config json file')
elif typ == 'Edfa':
if variety in ['default', '']:
el_config['params'] = Amp.default_values
else:
raise ConfigurationError(f'The Edfa of variety type {variety} was not recognized:'
'\nplease check it is properly defined in the eqpt_config json file')
el = cls(**el_config)
g.add_node(el)
@@ -517,8 +394,7 @@ def network_from_json(json_data, equipment):
edge_length = 0.01
g.add_edge(nodes[from_node], nodes[to_node], weight=edge_length)
except KeyError:
msg = f'can not find {from_node} or {to_node} defined in {cx}'
raise NetworkTopologyError(msg)
raise NetworkTopologyError(f'can not find {from_node} or {to_node} defined in {cx}')
return g
@@ -549,13 +425,15 @@ def save_json(obj, filename):
def load_requests(filename, eqpt, bidir, network, network_filename):
"""loads the requests from a json or an excel file into a data string"""
""" loads the requests from a json or an excel file into a data string
"""
if filename.suffix.lower() in ('.xls', '.xlsx'):
_logger.info('Automatically converting requests from XLS to JSON')
try:
return convert_service_sheet(filename, eqpt, network, network_filename=network_filename, bidir=bidir)
except ServiceError as this_e:
raise ServiceError(f'Service error: {this_e}')
print(f'{ansi_escapes.red}Service error:{ansi_escapes.reset} {this_e}')
exit(1)
else:
return load_json(filename)
@@ -567,36 +445,33 @@ def requests_from_json(json_data, equipment):
for req in json_data['path-request']:
# init all params from request
params = {}
params['request_id'] = f'{req["request-id"]}'
params['request_id'] = req['request-id']
params['source'] = req['source']
params['bidir'] = req['bidirectional']
params['destination'] = req['destination']
params['trx_type'] = req['path-constraints']['te-bandwidth']['trx_type']
if params['trx_type'] is None:
msg = f'Request {req["request-id"]} has no transceiver type defined.'
raise ServiceError(msg)
params['trx_mode'] = req['path-constraints']['te-bandwidth'].get('trx_mode', None)
params['trx_mode'] = req['path-constraints']['te-bandwidth']['trx_mode']
params['format'] = params['trx_mode']
params['spacing'] = req['path-constraints']['te-bandwidth']['spacing']
try:
nd_list = sorted(req['explicit-route-objects']['route-object-include-exclude'], key=lambda x: x['index'])
nd_list = req['explicit-route-objects']['route-object-include-exclude']
except KeyError:
nd_list = []
params['nodes_list'] = [n['num-unnum-hop']['node-id'] for n in nd_list]
params['loose_list'] = [n['num-unnum-hop']['hop-type'] for n in nd_list]
# recover trx physical param (baudrate, ...) from type and mode
# in trx_mode_params optical power is read from equipment['SI']['default'] and
# nb_channel is computed based on min max frequency and spacing
try:
trx_params = trx_mode_params(equipment, params['trx_type'], params['trx_mode'], True)
except EquipmentConfigError as e:
msg = f'Equipment Config error in {req["request-id"]}: {e}'
raise EquipmentConfigError(msg) from e
trx_params = trx_mode_params(equipment, params['trx_type'], params['trx_mode'], True)
params.update(trx_params)
params['power'] = req['path-constraints']['te-bandwidth'].get('output-power')
# params must not be None, but user can set to None: catch this case
if params['power'] is None:
params['power'] = dbm2watt(equipment['SI']['default'].power_dbm)
# print(trx_params['min_spacing'])
# optical power might be set differently in the request. if it is indicated then the
# params['power'] is updated
try:
if req['path-constraints']['te-bandwidth']['output-power']:
params['power'] = req['path-constraints']['te-bandwidth']['output-power']
except KeyError:
pass
# same process for nb-channel
f_min = params['f_min']
f_max_from_si = params['f_max']
@@ -610,21 +485,12 @@ def requests_from_json(json_data, equipment):
params['nb_channel'] = automatic_nch(f_min, f_max_from_si, params['spacing'])
except KeyError:
params['nb_channel'] = automatic_nch(f_min, f_max_from_si, params['spacing'])
params['effective_freq_slot'] = \
req['path-constraints']['te-bandwidth'].get('effective-freq-slot', [{'N': None, 'M': None}])
_check_one_request(params, f_max_from_si)
try:
params['path_bandwidth'] = req['path-constraints']['te-bandwidth']['path_bandwidth']
except KeyError:
pass
params['tx_power'] = req['path-constraints']['te-bandwidth'].get('tx_power')
default_tx_power_dbm = equipment['SI']['default'].tx_power_dbm
if params['tx_power'] is None:
# use request's input power in span instead
params['tx_power'] = params['power']
if default_tx_power_dbm is not None:
# use default tx power
params['tx_power'] = dbm2watt(default_tx_power_dbm)
_check_one_request(params, f_max_from_si)
requests_list.append(PathRequest(**params))
return requests_list
@@ -633,66 +499,28 @@ def _check_one_request(params, f_max_from_si):
"""Checks that the requested parameters are consistant (spacing vs nb channel vs transponder mode...)"""
f_min = params['f_min']
f_max = params['f_max']
max_recommanded_nb_channels = automatic_nch(f_min, f_max_from_si, params['spacing'])
max_recommanded_nb_channels = automatic_nch(f_min, f_max, params['spacing'])
if params['baud_rate'] is not None:
# implicitly means that a mode is defined with min_spacing
if params['min_spacing'] > params['spacing']:
msg = f'Request {params["request_id"]} has spacing below transponder ' +\
f'{params["trx_type"]} {params["trx_mode"]} min spacing value ' +\
f'{params["min_spacing"]*1e-9}GHz.\nComputation stopped'
print(msg)
_logger.critical(msg)
raise ServiceError(msg)
if f_max > f_max_from_si:
msg = f'Requested channel number {params["nb_channel"]}, baud rate {params["baud_rate"] * 1e-9} GHz' \
+ f' and requested spacing {params["spacing"]*1e-9}GHz is not consistent with frequency range' \
+ f' {f_min*1e-12} THz, {f_max_from_si*1e-12} THz.' \
+ f' Max recommanded nb of channels is {max_recommanded_nb_channels}.'
msg = f'''Requested channel number {params["nb_channel"]}, baud rate {params["baud_rate"]} GHz
and requested spacing {params["spacing"]*1e-9}GHz is not consistent with frequency range
{f_min*1e-12} THz, {f_max*1e-12} THz, min recommanded spacing {params["min_spacing"]*1e-9}GHz.
max recommanded nb of channels is {max_recommanded_nb_channels}.'''
_logger.critical(msg)
raise ServiceError(msg)
# Transponder mode already selected; will it fit to the requested bandwidth?
if params['trx_mode'] is not None and params['effective_freq_slot'] is not None:
required_nb_of_channels, requested_m = compute_spectrum_slot_vs_bandwidth(params['path_bandwidth'],
params['spacing'],
params['bit_rate'])
_, per_channel_m = compute_spectrum_slot_vs_bandwidth(params['bit_rate'],
params['spacing'],
params['bit_rate'])
# each M should fit one or more channels if it is not None
# spectrum slots should not overlap
# resulting nb of channels should be bigger than the nb computed with path_bandwidth
# without being splitted
# TODO: elaborate a more accurate estimate with nb_wl * tx_osnr + possibly guardbands in case of
# superchannel closed packing.
nb_of_channels = 0
# order slots
slots = sorted(params['effective_freq_slot'], key=lambda x: float('inf') if x['N'] is None else x['N'])
for slot in slots:
nb_of_channels = nb_of_channels + slot['M'] // per_channel_m if slot['M'] is not None \
and nb_of_channels is not None else None
if slot['M'] is not None and slot['M'] < per_channel_m:
msg = f'Requested M {slot} number of slots for request' +\
f' {params["request_id"]} should be greater than {per_channel_m} to support request' +\
f'with {params["trx_type"]} {params["trx_mode"]}'
_logger.critical(msg)
if nb_of_channels is not None and nb_of_channels < required_nb_of_channels:
msg = f'Requested M {slots} number of slots for request {params["request_id"]} support {nb_of_channels}' +\
f' nb of channels while {required_nb_of_channels} are required to support request' +\
f' {params["path_bandwidth"] * 1e-9} Gbit/s with {params["trx_type"]} {params["trx_mode"]}'
raise ServiceError(msg)
if nb_of_channels is not None:
_, stop0n = mvalue_to_slots(slots[0]['N'], slots[0]['M'])
i = 1
while i < len(slots):
slot = slots[i]
startn, stopn = mvalue_to_slots(slot['N'], slot['M'])
if startn <= stop0n:
msg = f'Requested M {slots} for request {params["request_id"]} overlap'
raise ServiceError(msg)
_, stop0n = startn, stopn
i += 1
def disjunctions_from_json(json_data):
"""reads the disjunction requests from the json dict and create the list
of requested disjunctions for this set of requests
""" reads the disjunction requests from the json dict and create the list
of requested disjunctions for this set of requests
"""
disjunctions_list = []
if 'synchronization' in json_data:
@@ -720,42 +548,3 @@ def convert_service_sheet(
data = read_service_sheet(input_filename, eqpt, network, network_filename, bidir)
save_json(data, output_filename)
return data
def find_equalisation(params, equalization_types):
"""Find the equalization(s) defined in params. params can be a dict or a Roadm object.
>>> roadm = {'add_drop_osnr': 100, 'pmd': 1, 'pdl': 0.5,
... 'restrictions': {'preamp_variety_list': ['a'], 'booster_variety_list': ['b']},
... 'target_psd_out_mWperGHz': 4e-4}
>>> equalization_types = ['target_pch_out_db', 'target_psd_out_mWperGHz']
>>> find_equalisation(roadm, equalization_types)
{'target_pch_out_db': False, 'target_psd_out_mWperGHz': True}
"""
equalization = {e: False for e in equalization_types}
for equ in equalization_types:
if equ in params:
equalization[equ] = True
return equalization
def merge_equalization(params, extra_params):
"""params contains ROADM element config and extra_params default values from equipment library.
If equalization is not defined in ROADM element use the one defined in equipment library.
Only one type of equalization must be defined: power (target_pch_out_db) or PSD (target_psd_out_mWperGHz)
or PSW (target_out_mWperSlotWidth)
params and extra_params are dict
"""
equalization_types = ['target_pch_out_db', 'target_psd_out_mWperGHz', 'target_out_mWperSlotWidth']
roadm_equalizations = find_equalisation(params, equalization_types)
if sum(roadm_equalizations.values()) > 1:
# if ROADM config contains more than one equalization type then this is an error
return None
if sum(roadm_equalizations.values()) == 1:
# if ROADM config contains one equalization
# don't use the default equalization
return {k: v for k, v in extra_params.items() if k not in equalization_types}
if sum(roadm_equalizations.values()) == 0:
# If ROADM config doesn't contain any equalization type, keep the default one
return extra_params
return None

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
'''
gnpy.tools.plots
================
Graphs and plots usable from a CLI application
"""
'''
from matplotlib.pyplot import show, axis, figure, title, text
from networkx import draw_networkx

View File

@@ -0,0 +1,198 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2021 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
#
from gnpy.yang.io import load_from_yang
from gnpy.core.network import build_network
from gnpy.core.utils import lin2db, automatic_nch
from gnpy.topology.request import deduplicate_disjunctions, requests_aggregation, \
compute_path_dsjctn, compute_path_with_disjunction, ResultElement
from gnpy.topology.spectrum_assignment import build_oms_list, pth_assign_spectrum
from gnpy.tools.json_io import disjunctions_from_json, requests_from_json
from flask import Flask, request, abort, Response
import copy
class YangRunner:
def __init__(self):
self.equipment = None
self.network = None
self.onos_devices = {}
self.onos_links = {}
mapping = {}
def parse_onos_network(self, data):
gnpy_network_name = None
for network in data['ietf-network:networks']['network']:
if 'tip-photonic-topology:photonic-topology' in network['network-types']:
gnpy_network_name = network['network-id']
break
if gnpy_network_name is None:
raise Exception('Cannot find that GNPy topology')
for network in data['ietf-network:networks']['network']:
if 'tip-onos-topology:onos-topology' not in network['network-types']:
continue
for node in network['node']:
device_id = node['node-id']
proto, ip, port = device_id.split(':') # no clue about IPv6
if port != '830':
raise Exception(f'Fishy DeviceID in ONOS topology: {device_id}')
for supporting_node in node['supporting-node']:
if supporting_node['network-ref'] != gnpy_network_name:
continue
self.mapping[supporting_node['node-ref']] = ip
if 'tip-onos-topology:device' not in node:
continue
onos_dev = node['tip-onos-topology:device']
dev = {
'basic': {
'name': onos_dev['name'],
'driver': onos_dev['driver'],
'gridX': onos_dev['grid-x'],
'gridY': onos_dev['grid-y'],
},
'netconf': {
'username': onos_dev['netconf']['username'],
'password': onos_dev['netconf']['password'],
},
}
if 'idle-timeout' in onos_dev['netconf']:
dev['netconf']['idle-timeout'] = onos_dev['netconf']['idle-timeout']
self.onos_devices[device_id] = dev
for link in network['ietf-network-topology:link']:
link_id = link['link-id']
a, b = link_id.split('-')
for device_id in a, b:
proto, ip, port = device_id.split(':') # no clue about IPv6
if ip not in self.mapping.values():
raise Exception(f'Link {link_id} refers to an undefiend device address: {ip}')
self.onos_links[link_id] = {
'basic': {
'type': 'OPTICAL',
'durable': True,
'bidirectional': True,
}
}
def upload_equipment_and_network(self, data):
self.parse_onos_network(data)
self.equipment, self.network = load_from_yang(data)
p_db = self.equipment['SI']['default'].power_dbm
p_total_db = p_db + lin2db(automatic_nch(self.equipment['SI']['default'].f_min,
self.equipment['SI']['default'].f_max,
self.equipment['SI']['default'].spacing))
build_network(self.network, self.equipment, p_db, p_total_db)
self.oms_list = build_oms_list(self.network, self.equipment)
def handle_request(self, incoming):
backup_net = copy.deepcopy(self.network)
backup_oms_list = copy.deepcopy(self.oms_list)
try:
if self.equipment is None or self.network is None:
raise Exception('Missing equipment library or the network topology')
requests = requests_from_json(incoming, self.equipment)
disjunctions = disjunctions_from_json(requests)
disjunctions = deduplicate_disjunctions(disjunctions)
requests, disjunctions = requests_aggregation(requests, disjunctions)
paths = compute_path_dsjctn(self.network, self.equipment, requests, disjunctions)
propagated_paths, reversed_paths, reversed_propagated_paths = \
compute_path_with_disjunction(self.network, self.equipment, requests, paths)
pth_assign_spectrum(paths, requests, self.oms_list, reversed_paths)
return [ResultElement(requests[i], path, reversed_propagated_paths[i]).json
for i, path in enumerate(propagated_paths)]
finally:
self.network = backup_net
self.oms_list = backup_oms_list
def handle_request_with_translation(self, incoming):
fixed_input = {'path-request': []}
for item in incoming['path-request']:
for k in ('source', 'destination', 'src-tp-id', 'dst-tp-id'):
item[k] = self.incoming_name_for(item[k])
fixed_input['path-request'].append(item)
responses = self.handle_request(fixed_input)
for response in responses:
# Filter out 'reference_power' because ONOS uses that for TXP launch power and that's broken on my TXPs
response['path-properties']['path-metric'] = [
metric for metric in response['path-properties']['path-metric']
if metric['metric-type'] != 'reference_power'
]
# Filter GNPy-level NEs which do not apply to ONOS, and translate their names
for direction in ('path-route-objects', 'reversed-path-route-objects'):
i = 0
objects = response['path-properties'][direction]
resulting_pro = []
last_name = None
squashed_names = []
while i < len(objects):
orig_name = objects[i]['path-route-object']['num-unnum-hop']['node-id']
translated_name = self.name_for(orig_name)
if translated_name is None:
# not an ONOS-level element
i += 1
continue
squashed_names.append(orig_name)
if translated_name == last_name:
resulting_pro.pop()
last_name = translated_name
resulting_pro.append(objects[i])
resulting_pro[-1]['path-route-object']['num-unnum-hop']['gnpy-nodes'] = copy.copy(squashed_names)
resulting_pro[-1]['path-route-object']['num-unnum-hop']['node-id'] = translated_name
resulting_pro[-1]['path-route-object']['num-unnum-hop']['link-tp-id'] = translated_name
if len(squashed_names) > 1:
resulting_pro[-1]['path-route-object']['num-unnum-hop']['gnpy-node-type'] = 'ROADM'
i += 1
squashed_names.clear()
response['path-properties'][direction] = resulting_pro
return responses
def name_for(self, node_id):
return f'netconf:{self.mapping[node_id]}:830' if node_id in self.mapping else None
def incoming_name_for(self, onos_name):
onos_name = onos_name[len('netconf:'):]
onos_name = onos_name[:-len(':830')]
return next(k for k, v in self.mapping.items() if v == onos_name)
server = YangRunner()
app = Flask('GNPy')
@app.route('/gnpy-experimental/topology', methods=['POST'])
def upload_yang():
server.upload_equipment_and_network(request.json)
abort(Response(status=200))
@app.route('/gnpy-experimental', methods=['GET', 'POST'])
def simulation():
if server.network is None:
abort(Response(status=400, response='not provisioned yet'))
elif request.method == 'POST':
return {'result': {'response': server.handle_request_with_translation(request.json)}}
else:
return {'ping': True}
@app.route('/gnpy-experimental/onos/devices')
def show_onos_devices():
if server.network is None:
abort(Response(status=400, response='not provisioned yet'))
return {'devices': server.onos_devices}
@app.route('/gnpy-experimental/onos/links')
def show_onos_links():
if server.network is None:
abort(Response(status=400, response='not provisioned yet'))
return {'links': server.onos_links}

View File

@@ -18,6 +18,7 @@ from copy import deepcopy
from gnpy.core.utils import db2lin
from gnpy.core.exceptions import ServiceError
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fiber
import gnpy.core.ansi_escapes as ansi_escapes
from gnpy.tools.convert import corresp_names, corresp_next_node
SERVICES_COLUMN = 12
@@ -67,21 +68,24 @@ class Request_element(Element):
if [mode for mode in equipment['Transceiver'][Request.trx_type].mode if mode['format'] == Requestmode]:
self.mode = Requestmode
else:
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' ' \
+ f'with mode: \'{Requestmode}\' in eqpt library \nComputation stopped.'
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' with mode: \'{Requestmode}\' in eqpt library \nComputation stopped.'
# print(msg)
logger.critical(msg)
raise ServiceError(msg)
else:
Requestmode = None
self.mode = Request.mode
except KeyError:
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' ' \
+ f'with mode: \'{Request.mode}\' in eqpt library \nComputation stopped.'
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' with mode: \'{Request.mode}\' in eqpt library \nComputation stopped.'
# print(msg)
logger.critical(msg)
raise ServiceError(msg)
# excel input are in GHz and dBm
if Request.spacing is not None:
self.spacing = Request.spacing * 1e9
else:
msg = f'Request {self.request_id} missing spacing: spacing is mandatory.\ncomputation stopped'
logger.critical(msg)
raise ServiceError(msg)
if Request.power is not None:
self.power = db2lin(Request.power) * 1e-3
@@ -123,7 +127,7 @@ class Request_element(Element):
'technology': 'flexi-grid',
'trx_type': self.trx_type,
'trx_mode': self.mode,
'effective-freq-slot': [{'N': None, 'M': None}],
'effective-freq-slot': [{'N': 'null', 'M': 'null'}],
'spacing': self.spacing,
'max-nb-of-channel': self.nb_channel,
'output-power': self.power
@@ -221,7 +225,7 @@ def parse_excel(input_filename):
def parse_service_sheet(service_sheet):
""" reads each column according to authorized fieldnames. order is not important.
"""
logger.debug(f'Validating headers on {service_sheet.name!r}')
logger.info(f'Validating headers on {service_sheet.name!r}')
# add a test on field to enable the '' field case that arises when columns on the
# right hand side are used as comments or drawing in the excel sheet
header = [x.value.strip() for x in service_sheet.row(4)[0:SERVICES_COLUMN]
@@ -241,6 +245,7 @@ def parse_service_sheet(service_sheet):
service_fieldnames = [authorized_fieldnames[e] for e in header]
except KeyError:
msg = f'Malformed header on Service sheet: {header} field not in {authorized_fieldnames}'
logger.critical(msg)
raise ValueError(msg)
for row in all_rows(service_sheet, start=5):
yield Request(**parse_row(row[0:SERVICES_COLUMN], service_fieldnames))
@@ -268,13 +273,15 @@ def correct_xls_route_list(network_filename, network, pathreqlist):
for pathreq in pathreqlist:
# first check that source and dest are transceivers
if pathreq.source not in transponders:
msg = f'Request: {pathreq.request_id}: could not find' +\
f' transponder source : {pathreq.source}.'
msg = f'{ansi_escapes.red}Request: {pathreq.request_id}: could not find' +\
f' transponder source : {pathreq.source}.{ansi_escapes.reset}'
logger.critical(msg)
raise ServiceError(msg)
if pathreq.destination not in transponders:
msg = f'Request: {pathreq.request_id}: could not find' +\
f' transponder destination: {pathreq.destination}.'
msg = f'{ansi_escapes.red}Request: {pathreq.request_id}: could not find' +\
f' transponder destination: {pathreq.destination}.{ansi_escapes.reset}'
logger.critical(msg)
raise ServiceError(msg)
# silently pop source and dest nodes from the list if they were added by the user as first
# and last elem in the constraints respectively. Other positions must lead to an error
@@ -326,16 +333,17 @@ def correct_xls_route_list(network_filename, network, pathreqlist):
# too much ambiguity, 'b' is an ila, its name can be:
# Edfa0_fiber (a → b)-xx if next node is c or
# Edfa0_fiber (c → b)-xx if next node is a
msg = f'Request {pathreq.request_id}: Invalid route node specified:' \
+ f'\n\t\'{n_id}\', replaced with \'{new_n}\''
logger.warning(msg)
msg = f'{ansi_escapes.yellow}Invalid route node specified:' +\
f'\n\t\'{n_id}\', replaced with \'{new_n}\'{ansi_escapes.reset}'
logger.info(msg)
pathreq.nodes_list[pathreq.nodes_list.index(n_id)] = new_n
except StopIteration:
# shall not come in this case, unless requested direction does not exist
msg = f'Request {pathreq.request_id}: Invalid route specified {n_id}: could' \
+ ' not decide on direction, skipped!.\nPlease add a valid' \
+ ' direction in constraints (next neighbour node)'
logger.warning(msg)
msg = f'{ansi_escapes.yellow}Invalid route specified {n_id}: could' +\
f' not decide on direction, skipped!.\nPlease add a valid' +\
f' direction in constraints (next neighbour node){ansi_escapes.reset}'
print(msg)
logger.info(msg)
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
pathreq.nodes_list.remove(n_id)
else:
@@ -343,24 +351,28 @@ def correct_xls_route_list(network_filename, network, pathreqlist):
# if no matching can be found in the network just ignore this constraint
# if it is a loose constraint
# warns the user that this node is not part of the topology
msg = f'Request {pathreq.request_id}: Invalid node specified:\n\t\'{n_id}\'' \
+ ', could not use it as constraint, skipped!'
logger.warning(msg)
msg = f'{ansi_escapes.yellow}Invalid node specified:\n\t\'{n_id}\'' +\
f', could not use it as constraint, skipped!{ansi_escapes.reset}'
print(msg)
logger.info(msg)
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
pathreq.nodes_list.remove(n_id)
else:
msg = f'Request {pathreq.request_id}: Could not find node:\n\t\'{n_id}\' in network' \
+ ' topology. Strict constraint can not be applied.'
msg = f'{ansi_escapes.red}Could not find node:\n\t\'{n_id}\' in network' +\
f' topology. Strict constraint can not be applied.{ansi_escapes.reset}'
logger.critical(msg)
raise ServiceError(msg)
else:
if temp.loose_list[i] == 'LOOSE':
logger.warning(f'Request {pathreq.request_id}: Invalid route node specified:\n\t\'{n_id}\''
+ ' type is not supported as constraint with xls network input, skipped!')
print(f'{ansi_escapes.yellow}Invalid route node specified:\n\t\'{n_id}\'' +
f' type is not supported as constraint with xls network input,' +
f' skipped!{ansi_escapes.reset}')
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
pathreq.nodes_list.remove(n_id)
else:
msg = f'Invalid route node specified \n\t\'{n_id}\'' \
+ ' type is not supported as constraint with xls network input,' \
+ ', Strict constraint can not be applied.'
msg = f'{ansi_escapes.red}Invalid route node specified \n\t\'{n_id}\'' +\
f' type is not supported as constraint with xls network input,' +\
f', Strict constraint can not be applied.{ansi_escapes.reset}'
logger.critical(msg)
raise ServiceError(msg)
return pathreqlist

View File

@@ -1,3 +1,3 @@
"""
'''
Tracking :py:mod:`.request` for spectrum and their :py:mod:`.spectrum_assignment`.
"""
'''

View File

@@ -20,29 +20,30 @@ from logging import getLogger
from networkx import (dijkstra_path, NetworkXNoPath,
all_simple_paths, shortest_simple_paths)
from networkx.utils import pairwise
from numpy import mean, argmin
from gnpy.core.elements import Transceiver, Roadm
from numpy import mean
from gnpy.core.elements import Transceiver, Roadm, Edfa
from gnpy.core.utils import lin2db
from gnpy.core.info import create_input_spectral_information, carriers_to_spectral_information
from gnpy.core import network as network_module
from gnpy.core.info import create_input_spectral_information
from gnpy.core.exceptions import ServiceError, DisjunctionError
import gnpy.core.ansi_escapes as ansi_escapes
from copy import deepcopy
from csv import writer
from math import ceil
LOGGER = getLogger(__name__)
RequestParams = namedtuple('RequestParams', 'request_id source destination bidir trx_type'
' trx_mode nodes_list loose_list spacing power nb_channel f_min'
' f_max format baud_rate OSNR penalties bit_rate'
' roll_off tx_osnr min_spacing cost path_bandwidth effective_freq_slot'
' equalization_offset_db, tx_power')
DisjunctionParams = namedtuple('DisjunctionParams', 'disjunction_id relaxable link_diverse'
' node_diverse disjunctions_req')
RequestParams = namedtuple('RequestParams', 'request_id source destination bidir trx_type' +
' trx_mode nodes_list loose_list spacing power nb_channel f_min' +
' f_max format baud_rate OSNR bit_rate roll_off tx_osnr' +
' min_spacing cost path_bandwidth')
DisjunctionParams = namedtuple('DisjunctionParams', 'disjunction_id relaxable link' +
'_diverse node_diverse disjunctions_req')
class PathRequest:
"""the class that contains all attributes related to a request"""
""" the class that contains all attributes related to a request
"""
def __init__(self, *args, **params):
params = RequestParams(**params)
self.request_id = params.request_id
@@ -61,19 +62,12 @@ class PathRequest:
self.f_max = params.f_max
self.format = params.format
self.OSNR = params.OSNR
self.penalties = params.penalties
self.bit_rate = params.bit_rate
self.roll_off = params.roll_off
self.tx_osnr = params.tx_osnr
self.tx_power = params.tx_power
self.min_spacing = params.min_spacing
self.cost = params.cost
self.path_bandwidth = params.path_bandwidth
if params.effective_freq_slot is not None:
self.N = [s['N'] for s in params.effective_freq_slot]
self.M = [s['M'] for s in params.effective_freq_slot]
self.initial_spectrum = None
self.offset_db = params.equalization_offset_db
def __str__(self):
return '\n\t'.join([f'{type(self).__name__} {self.request_id}',
@@ -81,7 +75,7 @@ class PathRequest:
f'destination: {self.destination}'])
def __repr__(self):
if self.baud_rate is not None and self.bit_rate is not None:
if self.baud_rate is not None:
temp = self.baud_rate * 1e-9
temp2 = self.bit_rate * 1e-9
else:
@@ -96,8 +90,7 @@ class PathRequest:
f'baud_rate:\t{temp} Gbaud',
f'bit_rate:\t{temp2} Gb/s',
f'spacing:\t{self.spacing * 1e-9} GHz',
f'power: \t{round(lin2db(self.power) + 30, 2)} dBm',
f'tx_power_dbm: \t{round(lin2db(self.tx_power) + 30, 2)} dBm',
f'power: \t{round(lin2db(self.power)+30, 2)} dBm',
f'nb channels: \t{self.nb_channel}',
f'path_bandwidth: \t{round(self.path_bandwidth * 1e-9, 2)} Gbit/s',
f'nodes-list:\t{self.nodes_list}',
@@ -106,7 +99,8 @@ class PathRequest:
class Disjunction:
"""the class that contains all attributes related to disjunction constraints"""
""" the class that contains all attributes related to disjunction constraints
"""
def __init__(self, *args, **params):
params = DisjunctionParams(**params)
@@ -135,7 +129,7 @@ BLOCKING_NOPATH = ['NO_PATH', 'NO_PATH_WITH_CONSTRAINT',
'NO_FEASIBLE_BAUDRATE_WITH_SPACING',
'NO_COMPUTED_SNR']
BLOCKING_NOMODE = ['NO_FEASIBLE_MODE', 'MODE_NOT_FEASIBLE']
BLOCKING_NOSPECTRUM = ['NO_SPECTRUM', 'NOT_ENOUGH_RESERVED_SPECTRUM']
BLOCKING_NOSPECTRUM = 'NO_SPECTRUM'
class ResultElement:
@@ -151,65 +145,64 @@ class ResultElement:
@property
def detailed_path_json(self):
"""a function that builds path object for normal and blocking cases"""
index = 0
return self.detailed_json_for_path(self.computed_path)
@property
def detailed_reversed_path_json(self):
return self.detailed_json_for_path(self.reversed_computed_path)
def detailed_json_for_path(self, path):
""" a function that builds path object for normal and blocking cases
"""
pro_list = []
for element in self.computed_path:
for index, element in enumerate(path):
temp = {
'path-route-object': {
'index': index,
'num-unnum-hop': {
'node-id': element.uid,
'link-tp-id': element.uid,
# TODO change index in order to insert transponder attribute
}
}
}
pro_list.append(temp)
index += 1
if not hasattr(self.path_request, 'blocking_reason'):
# M and N values should not be None at this point
if self.path_request.M is None or self.path_request.N is None:
raise ServiceError('request {self.path_id} should have positive non null n and m values.')
temp = {
'path-route-object': {
'index': index,
"label-hop": [{
"N": n,
"M": m
} for n, m in zip(self.path_request.N, self.path_request.M)],
}
if self.path_request.M > 0:
temp['path-route-object']["label-hop"] = {
"N": self.path_request.N,
"M": self.path_request.M
}
pro_list.append(temp)
index += 1
elif self.path_request.M == 0 and hasattr(self.path_request, 'blocking_reason'):
# if the path is blocked due to spectrum, no label object is created, but
# the json response includes a detailed path for user infromation.
pass
else:
# if the path is blocked, no label object is created, but
# the json response includes a detailed path for user information.
# M and N values should be None at this point
if self.path_request.M is not None or self.path_request.N is not None:
raise ServiceError('request {self.path_id} should not have label M and N values at this point.')
raise ServiceError('request {self.path_id} should have positive path bandwidth value.')
if isinstance(element, Transceiver):
temp = {
'path-route-object': {
'index': index,
'transponder': {
'transponder-type': self.path_request.tsp,
'transponder-mode': self.path_request.tsp_mode
}
}
temp['path-route-object']['num-unnum-hop']['gnpy-node-type'] = 'transceiver'
temp['path-route-object']['num-unnum-hop']['transponder'] = {
'transponder-type': self.path_request.tsp,
'transponder-mode': self.path_request.tsp_mode
}
pro_list.append(temp)
index += 1
if isinstance(element, Edfa):
temp['path-route-object']['num-unnum-hop']['gnpy-node-type'] = 'EDFA'
temp['path-route-object']['num-unnum-hop']['target-channel-power'] = element.effective_pch_out_db
temp['path-route-object']['output-voa']: element.out_voa
if isinstance(element, Roadm):
temp['path-route-object']['num-unnum-hop']['gnpy-node-type'] = 'ROADM'
temp['path-route-object']['num-unnum-hop']['target-channel-power'] = element.effective_pch_out_db
pro_list.append(temp)
return pro_list
@property
def path_properties(self):
"""a function that returns the path properties (metrics, crossed elements) into a dict"""
""" a function that returns the path properties (metrics, crossed elements) into a dict
"""
def path_metric(pth, req):
"""creates the metrics dictionary"""
""" creates the metrics dictionary
"""
return [
{
'metric-type': 'SNR-bandwidth',
@@ -240,7 +233,8 @@ class ResultElement:
path_properties = {
'path-metric': path_metric(self.computed_path, self.path_request),
'z-a-path-metric': path_metric(self.reversed_computed_path, self.path_request),
'path-route-objects': self.detailed_path_json
'path-route-objects': self.detailed_path_json,
'reversed-path-route-objects': self.detailed_reversed_path_json,
}
else:
path_properties = {
@@ -251,7 +245,8 @@ class ResultElement:
@property
def pathresult(self):
"""create the result dictionnary (response for a request)"""
""" create the result dictionnary (response for a request)
"""
try:
if self.path_request.blocking_reason in BLOCKING_NOPATH:
response = {
@@ -289,6 +284,7 @@ def compute_constrained_path(network, req):
# been corrected and harmonized before
msg = (f'Request {req.request_id} malformed list of nodes: last node should '
'be destination trx')
LOGGER.critical(msg)
raise ValueError()
trx = [n for n in network if isinstance(n, Transceiver)]
@@ -303,9 +299,10 @@ def compute_constrained_path(network, req):
path_generator = shortest_simple_paths(network, source, destination, weight='weight')
total_path = next(path for path in path_generator if ispart(nodes_list, path))
except NetworkXNoPath:
msg = (f'Request {req.request_id} could not find a path from'
f' {source.uid} to node: {destination.uid} in network topology')
msg = (f'{ansi_escapes.yellow}Request {req.request_id} could not find a path from'
f' {source.uid} to node: {destination.uid} in network topology{ansi_escapes.reset}')
LOGGER.critical(msg)
print(msg)
req.blocking_reason = 'NO_PATH'
total_path = []
except StopIteration:
@@ -314,94 +311,80 @@ def compute_constrained_path(network, req):
# last node which is the transceiver)
# if all nodes i n node_list are LOOSE constraint, skip the constraints and find
# a path w/o constraints, else there is no possible path
LOGGER.warning(f'Request {req.request_id} could not find a path crossing '
f'{[el.uid for el in nodes_list[:-1]]} in network topology')
print(f'{ansi_escapes.yellow}Request {req.request_id} could not find a path crossing '
f'{[el.uid for el in nodes_list[:-1]]} in network topology{ansi_escapes.reset}')
if 'STRICT' not in req.loose_list[:-1]:
msg = (f'Request {req.request_id} could not find a path with user_'
f'include node constraints. Constraint ignored')
LOGGER.warning(msg)
msg = (f'{ansi_escapes.yellow}Request {req.request_id} could not find a path with user_'
f'include node constraints{ansi_escapes.reset}')
LOGGER.info(msg)
print(f'constraint ignored')
total_path = dijkstra_path(network, source, destination, weight='weight')
else:
# one STRICT makes the whole list STRICT
msg = (f'Request {req.request_id} could not find a path with user '
f'include node constraints.\nNo path computed')
msg = (f'{ansi_escapes.yellow}Request {req.request_id} could not find a path with user '
f'include node constraints.\nNo path computed{ansi_escapes.reset}')
LOGGER.critical(msg)
print(msg)
req.blocking_reason = 'NO_PATH_WITH_CONSTRAINT'
total_path = []
return total_path
def propagate(path, req, equipment):
"""propagates signals in each element according to initial spectrum set by user"""
if req.initial_spectrum is not None:
si = carriers_to_spectral_information(initial_spectrum=req.initial_spectrum, power=req.power)
else:
si = create_input_spectral_information(
f_min=req.f_min, f_max=req.f_max, roll_off=req.roll_off, baud_rate=req.baud_rate,
spacing=req.spacing, tx_osnr=req.tx_osnr, tx_power=req.tx_power, delta_pdb=req.offset_db)
roadm_osnr = []
si = create_input_spectral_information(
req.f_min, req.f_max, req.roll_off, req.baud_rate,
req.power, req.spacing)
for i, el in enumerate(path):
if isinstance(el, Roadm):
si = el(si, degree=path[i + 1].uid, from_degree=path[i - 1].uid)
roadm_osnr.append(el.get_roadm_path(from_degree=path[i - 1].uid, to_degree=path[i + 1].uid).impairment.osnr)
si = el(si, degree=path[i+1].uid)
else:
si = el(si)
path[0].update_snr(si.tx_osnr)
path[0].calc_penalties(req.penalties)
roadm_osnr.append(si.tx_osnr)
path[-1].update_snr(*roadm_osnr)
path[-1].calc_penalties(req.penalties)
path[0].update_snr(req.tx_osnr)
if any(isinstance(el, Roadm) for el in path):
path[-1].update_snr(req.tx_osnr, equipment['Roadm']['default'].add_drop_osnr)
else:
path[-1].update_snr(req.tx_osnr)
return si
def propagate_and_optimize_mode(path, req, equipment):
# if mode is unknown : loops on the modes starting from the highest baudrate fiting in the
# step 1: create an ordered list of modes based on baudrate and power offset
# order higher baudrate with higher power offset first
baudrate_offset_to_explore = list(set([(this_mode['baud_rate'], this_mode['equalization_offset_db'])
for this_mode in equipment['Transceiver'][req.tsp].mode
if float(this_mode['min_spacing']) <= req.spacing]))
# step 1: create an ordered list of modes based on baudrate
baudrate_to_explore = list(set([this_mode['baud_rate']
for this_mode in equipment['Transceiver'][req.tsp].mode
if float(this_mode['min_spacing']) <= req.spacing]))
# TODO be carefull on limits cases if spacing very close to req spacing eg 50.001 50.000
baudrate_offset_to_explore = sorted(baudrate_offset_to_explore, reverse=True)
if baudrate_offset_to_explore:
baudrate_to_explore = sorted(baudrate_to_explore, reverse=True)
if baudrate_to_explore:
# at least 1 baudrate can be tested wrt spacing
for (this_br, this_offset) in baudrate_offset_to_explore:
for this_br in baudrate_to_explore:
modes_to_explore = [this_mode for this_mode in equipment['Transceiver'][req.tsp].mode
if this_mode['baud_rate'] == this_br
and float(this_mode['min_spacing']) <= req.spacing]
if this_mode['baud_rate'] == this_br and
float(this_mode['min_spacing']) <= req.spacing]
modes_to_explore = sorted(modes_to_explore,
key=lambda x: (x['bit_rate'], x['equalization_offset_db']), reverse=True)
key=lambda x: x['bit_rate'], reverse=True)
# print(modes_to_explore)
# step2: computes propagation for each baudrate: stop and select the first that passes
# TODO: the case of roll off is not included: for now use SI one
# TODO: the case of roll of is not included: for now use SI one
# TODO: if the loop in mode optimization does not have a feasible path, then bugs
if req.initial_spectrum is not None:
# this case is not yet handled: spectrum can not be defined for the path-request-run function
# and this function is only called in this case. so coming here should not be considered yet.
msg = f'Request: {req.request_id} contains a unexpected initial_spectrum.'
raise ServiceError(msg)
spc_info = create_input_spectral_information(f_min=req.f_min, f_max=req.f_max,
roll_off=equipment['SI']['default'].roll_off,
baud_rate=this_br, spacing=req.spacing,
delta_pdb=this_offset, tx_osnr=req.tx_osnr,
tx_power=req.tx_power)
roadm_osnr = []
spc_info = create_input_spectral_information(req.f_min, req.f_max,
equipment['SI']['default'].roll_off,
this_br, req.power, req.spacing)
for i, el in enumerate(path):
if isinstance(el, Roadm):
spc_info = el(spc_info, degree=path[i + 1].uid, from_degree=path[i - 1].uid)
roadm_osnr.append(el.get_roadm_path(from_degree=path[i - 1].uid, to_degree=path[i + 1].uid).impairment.osnr)
spc_info = el(spc_info, degree=path[i+1].uid)
else:
spc_info = el(spc_info)
for this_mode in modes_to_explore:
if path[-1].snr is not None:
path[0].update_snr(this_mode['tx_osnr'])
path[0].calc_penalties(this_mode['penalties'])
roadm_osnr.append(this_mode['tx_osnr'])
path[-1].update_snr(*roadm_osnr)
# remove the tx_osnr from roadm_osnr list for the next iteration
del roadm_osnr[-1]
path[-1].calc_penalties(this_mode['penalties'])
if round(min(path[-1].snr_01nm - path[-1].total_penalty), 2) \
if any(isinstance(el, Roadm) for el in path):
path[-1].update_snr(this_mode['tx_osnr'], equipment['Roadm']['default'].add_drop_osnr)
else:
path[-1].update_snr(this_mode['tx_osnr'])
if round(min(path[-1].snr + lin2db(this_br / (12.5e9))), 2) \
> this_mode['OSNR'] + equipment['SI']['default'].sys_margins:
return path, this_mode
else:
@@ -409,23 +392,27 @@ def propagate_and_optimize_mode(path, req, equipment):
else:
req.blocking_reason = 'NO_COMPUTED_SNR'
return path, None
# only get to this point if no baudrate/mode satisfies OSNR requirement
# returns the last propagated path and mode
msg = f'\tWarning! Request {req.request_id}: no mode satisfies path SNR requirement.\n'
LOGGER.warning(msg)
print(msg)
LOGGER.info(msg)
req.blocking_reason = 'NO_FEASIBLE_MODE'
return path, last_explored_mode
else:
# no baudrate satisfying spacing
msg = f'\tWarning! Request {req.request_id}: no baudrate satisfies spacing requirement.\n'
LOGGER.warning(msg)
print(msg)
LOGGER.info(msg)
req.blocking_reason = 'NO_FEASIBLE_BAUDRATE_WITH_SPACING'
return [], None
def jsontopath_metric(path_metric):
"""a functions that reads resulting metric from json string"""
""" a functions that reads resulting metric from json string
"""
output_snr = next(e['accumulative-value']
for e in path_metric if e['metric-type'] == 'SNR-0.1nm')
output_snrbandwidth = next(e['accumulative-value']
@@ -443,7 +430,9 @@ def jsontopath_metric(path_metric):
def jsontoparams(my_p, tsp, mode, equipment):
"""a function that derives optical params from transponder type and mode supports the no mode case"""
""" a function that derives optical params from transponder type and mode
supports the no mode case
"""
temp = []
for elem in my_p['path-properties']['path-route-objects']:
if 'num-unnum-hop' in elem['path-route-object']:
@@ -453,8 +442,8 @@ def jsontoparams(my_p, tsp, mode, equipment):
temp2 = []
for elem in my_p['path-properties']['path-route-objects']:
if 'label-hop' in elem['path-route-object'].keys():
temp2.append(f'{[e["N"] for e in elem["path-route-object"]["label-hop"]]}, '
+ f'{[e["M"] for e in elem["path-route-object"]["label-hop"]]}')
temp2.append(f'{elem["path-route-object"]["label-hop"]["N"]}, ' +
f'{elem["path-route-object"]["label-hop"]["M"]}')
# OrderedDict.fromkeys returns the unique set of strings.
# TODO: if spectrum changes along the path, we should be able to give the segments
# eg for regeneration case
@@ -478,10 +467,10 @@ def jsontoparams(my_p, tsp, mode, equipment):
def jsontocsv(json_data, equipment, fileout):
"""reads json path result file in accordance with:
Yang model for requesting Path Computation
draft-ietf-teas-yang-path-computation-01.txt.
and write results in an CSV file
""" reads json path result file in accordance with:
Yang model for requesting Path Computation
draft-ietf-teas-yang-path-computation-01.txt.
and write results in an CSV file
"""
mywriter = writer(fileout)
mywriter.writerow(('response-id', 'source', 'destination', 'path_bandwidth', 'Pass?',
@@ -710,8 +699,8 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
# in each loop, dpath is updated with a path for rq that satisfies
# disjunction with each path in dpath
# for example, assume set of requests in the vector (disjunction_list) is {rq1,rq2, rq3}
# rq1 p1: aefhg
# p2: abfhg
# rq1 p1: abfhg
# p2: aefhg
# p3: abcg
# rq2 p8: bf
# rq3 p4: abcgh
@@ -728,7 +717,6 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
# after second loop:
# dpath = [ p3 p8 p6 ]
# since p1 and p4 are not disjoint
# p1 and p6 are not disjoint
# p1 and p7 are not disjoint
# p3 and p4 are not disjoint
# p3 and p7 are not disjoint
@@ -752,6 +740,7 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
temp.append(temp2)
# print(f' coucou {elem1}: \t{temp}')
dpath = temp
# print(dpath)
candidates[dis.disjunction_id] = dpath
# for i in disjunctions_list:
@@ -792,9 +781,9 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
if pth in cndt:
candidates[this_id].remove(cndt)
# for i in disjunctions_list:
# print(i.disjunction_id)
# print(f'\n{candidates[i.disjunction_id]}')
# for i in disjunctions_list:
# print(i.disjunction_id)
# print(f'\n{candidates[i.disjunction_id]}')
# step 4 apply route constraints: remove candidate path that do not satisfy
# the constraint only in the case of disjounction: the simple path is processed in
@@ -802,34 +791,33 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
# TODO: keep a version without the loose constraint
for this_d in disjunctions_list:
temp = []
alternatetemp = []
for j, sol in enumerate(candidates[this_d.disjunction_id]):
testispartok = True
testispartnokloose = True
for pth in sol:
# print(f'test {allpaths[id(pth)].req.request_id}')
# print(f'length of route {len(allpaths[id(pth)].req.nodes_list)}')
if allpaths[id(pth)].req.nodes_list:
# if any pth from sol does not contain the ordered list node,
# remove sol from the candidate, except if constraint was loose:
# then keep sol as an alternate solution
# if pth does not containt the ordered list node, remove sol from the candidate
# except if this was the last solution: then check if the constraint is loose
# or not
if not ispart(allpaths[id(pth)].req.nodes_list, pth):
testispartok = False
if 'STRICT' in allpaths[id(pth)].req.loose_list:
LOGGER.debug(f'removing solution from candidate paths\n{pth}')
testispartnokloose = False
break
# print(f'nb of solutions {len(temp)}')
if j < len(candidates[this_d.disjunction_id]) - 1:
msg = f'removing {sol}'
LOGGER.info(msg)
testispartok = False
# break
else:
if 'LOOSE' in allpaths[id(pth)].req.loose_list:
LOGGER.info(f'Could not apply route constraint' +
f'{allpaths[id(pth)].req.nodes_list} on request' +
f' {allpaths[id(pth)].req.request_id}')
else:
LOGGER.info(f'removing last solution from candidate paths\n{sol}')
testispartok = False
if testispartok:
temp.append(sol)
elif testispartnokloose:
LOGGER.debug(f'Adding solution as alternate solution not satisfying constraint\n{pth}')
alternatetemp.append(sol)
if temp:
candidates[this_d.disjunction_id] = temp
elif alternatetemp:
candidates[this_d.disjunction_id] = alternatetemp
else:
candidates[this_d.disjunction_id] = []
candidates[this_d.disjunction_id] = temp
# step 5 select the first combination that works
pathreslist_disjoint = {}
@@ -844,7 +832,9 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
# remove duplicated candidates
candidates = remove_candidate(candidates, allpaths, allpaths[id(pth)].req, pth)
else:
msg = 'No disjoint path found with added constraint\nComputation stopped.'
msg = f'No disjoint path found with added constraint'
LOGGER.critical(msg)
print(f'{msg}\nComputation stopped.')
# TODO in this case: replay step 5 with the candidate without constraints
raise DisjunctionError(msg)
@@ -865,7 +855,8 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
def isdisjoint(pth1, pth2):
"""returns 0 if disjoint"""
""" returns 0 if disjoint
"""
edge1 = list(pairwise(pth1))
edge2 = list(pairwise(pth2))
for edge in edge1:
@@ -875,9 +866,9 @@ def isdisjoint(pth1, pth2):
def find_reversed_path(pth):
"""select of intermediate roadms and find the path between them
note that this function may not give an exact result in case of multiple
links between two adjacent nodes.
""" select of intermediate roadms and find the path between them
note that this function may not give an exact result in case of multiple
links between two adjacent nodes.
"""
# TODO add some indication on elements to indicate from which other they
# are the reversed direction. This is partly done with oms indication
@@ -900,8 +891,9 @@ def find_reversed_path(pth):
# concatenation should be [roadma el1 el2 roadmb el3 el4 roadmc]
reversed_path = list(OrderedDict.fromkeys(reversed_path))
else:
msg = f'Error while handling reversed path {pth[-1].uid} to {pth[0].uid}:' \
+ ' can not handle unidir topology. TO DO.'
msg = f'Error while handling reversed path {pth[-1].uid} to {pth[0].uid}:' +\
' can not handle unidir topology. TO DO.'
LOGGER.critical(msg)
raise ValueError(msg)
reversed_path.append(pth[0])
@@ -909,7 +901,9 @@ def find_reversed_path(pth):
def ispart(ptha, pthb):
"""the functions takes two paths a and b and retrns True if all a elements are part of b and in the same order"""
""" the functions takes two paths a and b and retrns True
if all a elements are part of b and in the same order
"""
j = 0
for elem in ptha:
if elem in pthb:
@@ -923,7 +917,8 @@ def ispart(ptha, pthb):
def remove_candidate(candidates, allpaths, rqst, pth):
"""filter duplicate candidates"""
""" filter duplicate candidates
"""
# print(f'coucou {rqst.request_id}')
for key, candidate in candidates.items():
temp = candidate.copy()
@@ -938,7 +933,8 @@ def remove_candidate(candidates, allpaths, rqst, pth):
def compare_reqs(req1, req2, disjlist):
"""compare two requests: returns True or False"""
""" compare two requests: returns True or False
"""
dis1 = [d for d in disjlist if req1.request_id in d.disjunctions_req]
dis2 = [d for d in disjlist if req2.request_id in d.disjunctions_req]
same_disj = False
@@ -971,7 +967,6 @@ def compare_reqs(req1, req2, disjlist):
req1.format == req2.format and \
req1.OSNR == req2.OSNR and \
req1.roll_off == req2.roll_off and \
req1.tx_power == req2.tx_power and \
same_disj:
return True
else:
@@ -979,24 +974,19 @@ def compare_reqs(req1, req2, disjlist):
def requests_aggregation(pathreqlist, disjlist):
"""this function aggregates requests so that if several requests
exist between same source and destination and with same transponder type
If transponder mode is defined and identical, then also agregates demands.
""" this function aggregates requests so that if several requests
exist between same source and destination and with same transponder type
"""
# todo maybe add conditions on mode ??, spacing ...
# currently if undefined takes the default values
local_list = pathreqlist.copy()
for req in pathreqlist:
for this_r in local_list:
if req.request_id != this_r.request_id and compare_reqs(req, this_r, disjlist) and\
this_r.tsp_mode is not None:
if req.request_id != this_r.request_id and compare_reqs(req, this_r, disjlist):
# aggregate
this_r.path_bandwidth += req.path_bandwidth
this_r.N = this_r.N + req.N
this_r.M = this_r.M + req.M
temp_r_id = this_r.request_id
this_r.request_id = ' | '.join((this_r.request_id, req.request_id))
# remove request from list
local_list.remove(req)
# todo change also disjunction req with new demand
@@ -1013,22 +1003,23 @@ def requests_aggregation(pathreqlist, disjlist):
def correct_json_route_list(network, pathreqlist):
"""all names in list should be exact name in the network, and there is no ambiguity
This function only checks that list is correct, warns user if the name is incorrect and
suppresses the constraint it it is loose or raises an error if it is strict
""" all names in list should be exact name in the network, and there is no ambiguity
This function only checks that list is correct, warns user if the name is incorrect and
suppresses the constraint it it is loose or raises an error if it is strict
"""
all_uid = [n.uid for n in network.nodes()]
transponders = [n.uid for n in network.nodes() if isinstance(n, Transceiver)]
for pathreq in pathreqlist:
if pathreq.source not in transponders:
msg = f'Request: {pathreq.request_id}: could not find transponder' \
+ f' source : {pathreq.source}.'
msg = f'{ansi_escapes.red}Request: {pathreq.request_id}: could not find transponder' +\
f' source : {pathreq.source}.{ansi_escapes.reset}'
LOGGER.critical(msg)
raise ServiceError(msg)
if pathreq.destination not in transponders:
msg = f'Request: {pathreq.request_id}: could not find transponder' \
+ f' destination : {pathreq.destination}.'
msg = f'{ansi_escapes.red}Request: {pathreq.request_id}: could not find transponder' +\
f' destination : {pathreq.destination}.{ansi_escapes.reset}'
LOGGER.critical(msg)
raise ServiceError(msg)
# silently remove source and dest nodes from the list
@@ -1047,21 +1038,24 @@ def correct_json_route_list(network, pathreqlist):
# if no matching can be found in the network just ignore this constraint
# if it is a loose constraint
# warns the user that this node is not part of the topology
msg = f'invalid route node specified:\n\t\'{n_id}\',' \
+ ' could not use it as constraint, skipped!'
LOGGER.warning(msg)
msg = f'{ansi_escapes.yellow}invalid route node specified:\n\t\'{n_id}\',' +\
f' could not use it as constraint, skipped!{ansi_escapes.reset}'
print(msg)
LOGGER.info(msg)
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
pathreq.nodes_list.remove(n_id)
else:
msg = f'could not find node:\n\t \'{n_id}\' in network' \
+ ' topology. Strict constraint can not be applied.'
msg = f'{ansi_escapes.red}could not find node:\n\t \'{n_id}\' in network' +\
f' topology. Strict constraint can not be applied.{ansi_escapes.reset}'
LOGGER.critical(msg)
raise ServiceError(msg)
return pathreqlist
def deduplicate_disjunctions(disjn):
"""clean disjunctions to remove possible repetition"""
""" clean disjunctions to remove possible repetition
"""
local_disjn = disjn.copy()
for elem in local_disjn:
for dis_elem in local_disjn:
@@ -1072,9 +1066,8 @@ def deduplicate_disjunctions(disjn):
def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
"""use a list but a dictionnary might be helpful to find path based on request_id
TODO change all these req, dsjct, res lists into dict !
""" use a list but a dictionnary might be helpful to find path based on request_id
TODO change all these req, dsjct, res lists into dict !
"""
path_res_list = []
reversed_path_res_list = []
@@ -1085,10 +1078,10 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
# use the power specified in requests but might be different from the one
# specified for design the power is an optional parameter for requests
# definition if optional, use the one defines in eqt_config.json
msg = f'\n\trequest {pathreq.request_id}\n' \
+ f'\tComputing path from {pathreq.source} to {pathreq.destination}\n' \
+ f'\twith path constraint: {[pathreq.source] + pathreq.nodes_list}'
# # adding first node to be clearer on the output
print(f'request {pathreq.request_id}')
print(f'Computing path from {pathreq.source} to {pathreq.destination}')
# adding first node to be clearer on the output
print(f'with path constraint: {[pathreq.source] + pathreq.nodes_list}')
# pathlist[i] contains the whole path information for request i
# last element is a transciver and where the result of the propagation is
@@ -1097,10 +1090,8 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
# elements to simulate performance, several demands having the same destination
# may use the same transponder for the performance simulation. This is why
# we use deepcopy: to ensure that each propagation is recorded and not overwritten
network_module.design_network(pathreq, network, equipment, set_connector_losses=False, verbose=False)
total_path = deepcopy(pathlist[i])
msg = msg + f'\n\tComputed path (roadms):{[e.uid for e in total_path if isinstance(e, Roadm)]}'
LOGGER.info(msg)
print(f'Computed path (roadms):{[e.uid for e in total_path if isinstance(e, Roadm)]}')
# for debug
# print(f'{pathreq.baud_rate} {pathreq.power} {pathreq.spacing} {pathreq.nb_channel}')
if total_path:
@@ -1108,15 +1099,13 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
# means that at this point the mode was entered/forced by user and thus a
# baud_rate was defined
propagate(total_path, pathreq, equipment)
snr01nm_with_penalty = total_path[-1].snr_01nm - total_path[-1].total_penalty
min_ind = argmin(snr01nm_with_penalty)
if round(snr01nm_with_penalty[min_ind], 2) < pathreq.OSNR + equipment['SI']['default'].sys_margins:
msg = f'\tWarning! Request {pathreq.request_id} computed path from' \
+ f' {pathreq.source} to {pathreq.destination} does not pass with {pathreq.tsp_mode}' \
+ f'\n\tcomputed SNR in 0.1nm = {round(total_path[-1].snr_01nm[min_ind], 2)}'
msg = _penalty_msg(total_path, msg, min_ind) \
+ f'\n\trequired osnr = {pathreq.OSNR}' \
+ f'\n\tsystem margin = {equipment["SI"]["default"].sys_margins}'
temp_snr01nm = round(mean(total_path[-1].snr+lin2db(pathreq.baud_rate/(12.5e9))), 2)
if temp_snr01nm < pathreq.OSNR + equipment['SI']['default'].sys_margins:
msg = f'\tWarning! Request {pathreq.request_id} computed path from' +\
f' {pathreq.source} to {pathreq.destination} does not pass with' +\
f' {pathreq.tsp_mode}\n\tcomputedSNR in 0.1nm = {temp_snr01nm} ' +\
f'- required osnr {pathreq.OSNR} + {equipment["SI"]["default"].sys_margins} margin'
print(msg)
LOGGER.warning(msg)
pathreq.blocking_reason = 'MODE_NOT_FEASIBLE'
else:
@@ -1136,7 +1125,6 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
pathreq.OSNR = mode['OSNR']
pathreq.tx_osnr = mode['tx_osnr']
pathreq.bit_rate = mode['bit_rate']
pathreq.penalties = mode['penalties']
# other blocking reason should not appear at this point
except AttributeError:
pathreq.baud_rate = mode['baud_rate']
@@ -1145,36 +1133,35 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
pathreq.OSNR = mode['OSNR']
pathreq.tx_osnr = mode['tx_osnr']
pathreq.bit_rate = mode['bit_rate']
pathreq.penalties = mode['penalties']
# reversed path is needed for correct spectrum assignment
reversed_path = find_reversed_path(pathlist[i])
if pathreq.bidir and pathreq.baud_rate is not None:
# Both directions requested, and a feasible mode was found
rev_p = deepcopy(reversed_path)
msg = f'\n\tPropagating Z to A direction {pathreq.destination} to {pathreq.source}\n' \
+ f'\tPath (roadms) {[r.uid for r in rev_p if isinstance(r,Roadm)]}\n'
LOGGER.info(msg)
print(f'\n\tPropagating Z to A direction {pathreq.destination} to {pathreq.source}')
print(f'\tPath (roadsm) {[r.uid for r in rev_p if isinstance(r,Roadm)]}\n')
propagate(rev_p, pathreq, equipment)
propagated_reversed_path = rev_p
snr01nm_with_penalty = rev_p[-1].snr_01nm - rev_p[-1].total_penalty
min_ind = argmin(snr01nm_with_penalty)
if round(snr01nm_with_penalty[min_ind], 2) < pathreq.OSNR + equipment['SI']['default'].sys_margins:
msg = f'\tWarning! Request {pathreq.request_id} computed path from' \
+ f' {pathreq.destination} to {pathreq.source} does not pass with {pathreq.tsp_mode}' \
+ f'\n\tcomputed SNR in 0.1nm = {round(rev_p[-1].snr_01nm[min_ind], 2)}'
msg = _penalty_msg(rev_p, msg, min_ind) \
+ f'\n\trequired osnr = {pathreq.OSNR}' \
+ f'\n\tsystem margin = {equipment["SI"]["default"].sys_margins}'
temp_snr01nm = round(mean(propagated_reversed_path[-1].snr +\
lin2db(pathreq.baud_rate/(12.5e9))), 2)
if temp_snr01nm < pathreq.OSNR + equipment['SI']['default'].sys_margins:
msg = f'\tWarning! Request {pathreq.request_id} computed path from' +\
f' {pathreq.source} to {pathreq.destination} does not pass with' +\
f' {pathreq.tsp_mode}\n' +\
f'\tcomputedSNR in 0.1nm = {temp_snr01nm} -' \
f' required osnr {pathreq.OSNR} + {equipment["SI"]["default"].sys_margins} margin'
print(msg)
LOGGER.warning(msg)
# TODO selection of mode should also be on reversed direction !!
if not hasattr(pathreq, 'blocking_reason'):
pathreq.blocking_reason = 'MODE_NOT_FEASIBLE'
pathreq.blocking_reason = 'MODE_NOT_FEASIBLE'
else:
propagated_reversed_path = []
else:
msg = f'Request {pathreq.request_id}: Total path is empty. No propagation'
LOGGER.warning(msg)
msg = 'Total path is empty. No propagation'
print(msg)
LOGGER.info(msg)
reversed_path = []
propagated_reversed_path = []
@@ -1182,33 +1169,5 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
reversed_path_res_list.append(reversed_path)
propagated_reversed_path_res_list.append(propagated_reversed_path)
# print to have a nice output
print('')
return path_res_list, reversed_path_res_list, propagated_reversed_path_res_list
def compute_spectrum_slot_vs_bandwidth(bandwidth, spacing, bit_rate, slot_width=0.0125e12):
"""Compute the number of required wavelengths and the M value (number of consumed slots)
Each wavelength consumes one `spacing`, and the result is rounded up to consume a natural number of slots.
>>> compute_spectrum_slot_vs_bandwidth(400e9, 50e9, 200e9)
(2, 8)
"""
number_of_wavelengths = ceil(bandwidth / bit_rate)
total_number_of_slots = ceil(spacing / slot_width) * number_of_wavelengths
return number_of_wavelengths, total_number_of_slots
def _penalty_msg(total_path, msg, min_ind):
"""formatting helper for reporting unfeasible paths
The penalty info are optional, so this checks that penalty exists before creating a message."""
penalty_dict = {
'pdl': 'PDL',
'chromatic_dispersion': 'CD',
'pmd': 'PMD'}
for key, pretty in penalty_dict.items():
if key in total_path[-1].penalties:
msg += f'\n\t{pretty} penalty = {round(total_path[-1].penalties[key][min_ind], 2)}'
else:
msg += f'\n\t{pretty} penalty not evaluated'
return msg

View File

@@ -15,16 +15,16 @@ element/oms correspondace
from collections import namedtuple
from logging import getLogger
from math import ceil
from gnpy.core.elements import Roadm, Transceiver
from gnpy.core.exceptions import ServiceError, SpectrumError
from gnpy.core.utils import order_slots, restore_order
from gnpy.topology.request import compute_spectrum_slot_vs_bandwidth
LOGGER = getLogger(__name__)
class Bitmap:
"""records the spectrum occupation"""
""" records the spectrum occupation
"""
def __init__(self, f_min, f_max, grid, guardband=0.15e12, bitmap=None):
# n is the min index including guardband. Guardband is require to be sure
@@ -45,22 +45,26 @@ class Bitmap:
raise SpectrumError(f'bitmap is not consistant with f_min{f_min} - n: {n_min} and f_max{f_max}- n :{n_max}')
def getn(self, i):
"""converts the n (itu grid) into a local index"""
""" converts the n (itu grid) into a local index
"""
return self.freq_index[i]
def geti(self, nvalue):
"""converts the local index into n (itu grid)"""
""" converts the local index into n (itu grid)
"""
return self.freq_index.index(nvalue)
def insert_left(self, newbitmap):
"""insert bitmap on the left to align oms bitmaps if their start frequencies are different"""
""" insert bitmap on the left to align oms bitmaps if their start frequencies are different
"""
self.bitmap = newbitmap + self.bitmap
temp = list(range(self.n_min - len(newbitmap), self.n_min))
self.freq_index = temp + self.freq_index
self.n_min = self.freq_index[0]
def insert_right(self, newbitmap):
"""insert bitmap on the right to align oms bitmaps if their stop frequencies are different"""
""" insert bitmap on the right to align oms bitmaps if their stop frequencies are different
"""
self.bitmap = self.bitmap + newbitmap
self.freq_index = self.freq_index + list(range(self.n_max, self.n_max + len(newbitmap)))
self.n_max = self.freq_index[-1]
@@ -71,8 +75,8 @@ OMSParams = namedtuple('OMSParams', 'oms_id el_id_list el_list')
class OMS:
"""OMS class is the logical container that represent a link between two adjacent ROADMs and
records the crossed elements and the occupied spectrum
""" OMS class is the logical container that represent a link between two adjacent ROADMs and
records the crossed elements and the occupied spectrum
"""
def __init__(self, *args, **params):
@@ -94,28 +98,36 @@ class OMS:
f'{self.el_id_list[0]} - {self.el_id_list[-1]}', '\n'])
def add_element(self, elem):
"""records oms elements"""
""" records oms elements
"""
self.el_id_list.append(elem.uid)
self.el_list.append(elem)
def update_spectrum(self, f_min, f_max, guardband=0.15e12, existing_spectrum=None, grid=0.00625e12):
"""Frequencies expressed in Hz.
Add 150 GHz margin to enable a center channel on f_min
Use ITU-T G694.1 Flexible DWDM grid definition
For the flexible DWDM grid, the allowed frequency slots have a nominal central frequency (in THz) defined by:
193.1 + n × 0.00625 where n is a positive or negative integer including 0
and 0.00625 is the nominal central frequency granularity in THz
and a slot width defined by:
12.5 × m where m is a positive integer and 12.5 is the slot width granularity in GHz.
Any combination of frequency slots is allowed as long as no two frequency slots overlap.
If bitmap is not None, then use it: Bitmap checks its consistency with f_min f_max
else a brand new bitmap is created
def update_spectrum(self, f_min, f_max, guardband=0.15e12, existing_spectrum=None,
grid=0.00625e12):
""" frequencies expressed in Hz
"""
self.spectrum_bitmap = Bitmap(f_min=f_min, f_max=f_max, grid=grid, guardband=guardband,
bitmap=existing_spectrum)
if existing_spectrum is None:
# add some 150 GHz margin to enable a center channel on f_min
# use ITU-T G694.1
# Flexible DWDM grid definition
# For the flexible DWDM grid, the allowed frequency slots have a nominal
# central frequency (in THz) defined by:
# 193.1 + n × 0.00625 where n is a positive or negative integer including 0
# and 0.00625 is the nominal central frequency granularity in THz
# and a slot width defined by:
# 12.5 × m where m is a positive integer and 12.5 is the slot width granularity in
# GHz.
# Any combination of frequency slots is allowed as long as no two frequency
# slots overlap.
# TODO : add explaination on that / parametrize ....
self.spectrum_bitmap = Bitmap(f_min, f_max, grid, guardband)
# print(len(self.spectrum_bitmap.bitmap))
def assign_spectrum(self, nvalue, mvalue):
"""change oms spectrum to mark spectrum assigned"""
""" change oms spectrum to mark spectrum assigned
"""
if not isinstance(nvalue, int):
raise SpectrumError(f'N must be a signed integer, got {nvalue}')
if not isinstance(mvalue, int):
@@ -134,16 +146,16 @@ class OMS:
self.spectrum_bitmap.bitmap[self.spectrum_bitmap.geti(startn):self.spectrum_bitmap.geti(stopn) + 1] = [0] * (stopn - startn + 1)
def add_service(self, service_id, nb_wl):
"""record service and mark spectrum as occupied"""
""" record service and mark spectrum as occupied
"""
self.service_list.append(service_id)
self.nb_channels += nb_wl
def frequency_to_n(freq, grid=0.00625e12):
"""converts frequency into the n value (ITU grid)
reference to Recommendation G.694.1 (02/12), Figure I.3
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
""" converts frequency into the n value (ITU grid)
reference to Recommendation G.694.1 (02/12), Figure I.3
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
>>> frequency_to_n(193.1375e12)
6
@@ -155,10 +167,9 @@ def frequency_to_n(freq, grid=0.00625e12):
def nvalue_to_frequency(nvalue, grid=0.00625e12):
"""converts n value into a frequency
reference to Recommendation G.694.1 (02/12), Table 1
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
""" converts n value into a frequency
reference to Recommendation G.694.1 (02/12), Table 1
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
>>> nvalue_to_frequency(6)
193137500000000.0
@@ -170,17 +181,17 @@ def nvalue_to_frequency(nvalue, grid=0.00625e12):
def mvalue_to_slots(nvalue, mvalue):
"""convert center n an m into start and stop n"""
""" convert center n an m into start and stop n
"""
startn = nvalue - mvalue
stopn = nvalue + mvalue - 1
return startn, stopn
def slots_to_m(startn, stopn):
"""converts the start and stop n values to the center n and m value
reference to Recommendation G.694.1 (02/12), Figure I.3
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
""" converts the start and stop n values to the center n and m value
reference to Recommendation G.694.1 (02/12), Figure I.3
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
>>> nval, mval = slots_to_m(6, 20)
>>> nval
@@ -195,11 +206,10 @@ def slots_to_m(startn, stopn):
def m_to_freq(nvalue, mvalue, grid=0.00625e12):
"""converts m into frequency range
spectrum(13,7) is (193137500000000.0, 193225000000000.0)
reference to Recommendation G.694.1 (02/12), Figure I.3
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
""" converts m into frequency range
spectrum(13,7) is (193137500000000.0, 193225000000000.0)
reference to Recommendation G.694.1 (02/12), Figure I.3
https://www.itu.int/rec/T-REC-G.694.1-201202-I/en
>>> fstart, fstop = m_to_freq(13, 7)
>>> fstart
@@ -215,7 +225,9 @@ def m_to_freq(nvalue, mvalue, grid=0.00625e12):
def align_grids(oms_list):
"""Used to apply same grid to all oms : same starting n, stop n and slot size. Out of grid slots are set to 0."""
""" used to apply same grid to all oms : same starting n, stop n and slot size
out of grid slots are set to 0
"""
n_min = min([o.spectrum_bitmap.n_min for o in oms_list])
n_max = max([o.spectrum_bitmap.n_max for o in oms_list])
for this_o in oms_list:
@@ -227,13 +239,12 @@ def align_grids(oms_list):
def build_oms_list(network, equipment):
"""initialization of OMS list in the network
an oms is build reading all intermediate nodes between two adjacent ROADMs
each element within the list is being added an oms and oms_id to record the
oms it belongs to.
the function supports different spectrum width and supposes that the whole network
works with the min range among OMSs
""" initialization of OMS list in the network
an oms is build reading all intermediate nodes between two adjacent ROADMs
each element within the list is being added an oms and oms_id to record the
oms it belongs to.
the function supports different spectrum width and supposes that the whole network
works with the min range among OMSs
"""
oms_id = 0
oms_list = []
@@ -285,9 +296,8 @@ def build_oms_list(network, equipment):
def reversed_oms(oms_list):
"""identifies reversed OMS
only applicable for non parallel OMS
""" identifies reversed OMS
only applicable for non parallel OMS
"""
for oms in oms_list:
has_reversed = False
@@ -312,41 +322,28 @@ def bitmap_sum(band1, band2):
return res
def build_path_oms_id_list(pth):
def spectrum_selection(pth, oms_list, requested_m, requested_n=None):
"""Collects spectrum availability and call the select_candidate function"""
# use indexes instead of ITU-T n values
path_oms = []
for elem in pth:
if not isinstance(elem, Roadm) and not isinstance(elem, Transceiver):
# only edfa, fused and fibers have oms_id attribute
path_oms.append(elem.oms_id)
# remove duplicate oms_id, order is not important
return list(set(path_oms))
path_oms = list(set(path_oms))
# assuming all oms have same freq index
if not path_oms:
candidate = (None, None, None)
return candidate, path_oms
freq_index = oms_list[path_oms[0]].spectrum_bitmap.freq_index
freq_index_min = oms_list[path_oms[0]].spectrum_bitmap.freq_index_min
freq_index_max = oms_list[path_oms[0]].spectrum_bitmap.freq_index_max
def aggregate_oms_bitmap(path_oms, oms_list):
spectrum = oms_list[path_oms[0]].spectrum_bitmap
bitmap = spectrum.bitmap
# assuming all oms have same freq indices
freq_availability = oms_list[path_oms[0]].spectrum_bitmap.bitmap
for oms in path_oms[1:]:
bitmap = bitmap_sum(oms_list[oms].spectrum_bitmap.bitmap, bitmap)
params = {
'oms_id': 0,
'el_id_list': 0,
'el_list': []
}
freq_min = nvalue_to_frequency(spectrum.freq_index_min)
freq_max = nvalue_to_frequency(spectrum.freq_index_max)
aggregate_oms = OMS(**params)
aggregate_oms.update_spectrum(freq_min, freq_max, grid=0.00625e12, existing_spectrum=bitmap)
return aggregate_oms
def spectrum_selection(test_oms, requested_m, requested_n=None):
"""Collects spectrum availability and call the select_candidate function"""
freq_index = test_oms.spectrum_bitmap.freq_index
freq_index_min = test_oms.spectrum_bitmap.freq_index_min
freq_index_max = test_oms.spectrum_bitmap.freq_index_max
freq_availability = test_oms.spectrum_bitmap.bitmap
freq_availability = bitmap_sum(oms_list[oms].spectrum_bitmap.bitmap, freq_availability)
if requested_n is None:
# avoid slots reserved on the edge 0.15e-12 on both sides -> 24
candidates = [(freq_index[i] + requested_m, freq_index[i], freq_index[i] + 2 * requested_m - 1)
@@ -357,36 +354,29 @@ def spectrum_selection(test_oms, requested_m, requested_n=None):
candidate = select_candidate(candidates, policy='first_fit')
else:
i = test_oms.spectrum_bitmap.geti(requested_n)
if (freq_availability[i - requested_m:i + requested_m] == [1] * (2 * requested_m)
and freq_index[i - requested_m] >= freq_index_min
i = oms_list[path_oms[0]].spectrum_bitmap.geti(requested_n)
# print(f'N {requested_n} i {i}')
# print(freq_availability[i-m:i+m] )
# print(freq_index[i-m:i+m])
if (freq_availability[i - requested_m:i + requested_m] == [1] * (2 * requested_m) and
freq_index[i - requested_m] >= freq_index_min
and freq_index[i + requested_m - 1] <= freq_index_max):
# candidate is the triplet center_n, startn and stopn
candidate = (requested_n, requested_n - requested_m, requested_n + requested_m - 1)
else:
candidate = (None, None, None)
return candidate
def determine_slot_numbers(test_oms, requested_n, required_m, per_channel_m):
"""determines max availability around requested_n. requested_n should not be None"""
bitmap = test_oms.spectrum_bitmap
freq_index = bitmap.freq_index
freq_index_min = bitmap.freq_index_min
freq_index_max = bitmap.freq_index_max
freq_availability = bitmap.bitmap
center_i = bitmap.geti(requested_n)
i = per_channel_m
while (freq_availability[center_i - i:center_i + i] == [1] * (2 * i)
and freq_index[center_i - i] >= freq_index_min
and freq_index[center_i + i - 1] <= freq_index_max
and i <= required_m):
i += per_channel_m
return i - per_channel_m
# print("coucou11")
# print(candidate)
# print(freq_availability[321:321+2*m])
# a = [i+321 for i in range(2*m)]
# print(a)
# print(candidate)
return candidate, path_oms
def select_candidate(candidates, policy):
"""selects a candidate among all available spectrum"""
""" selects a candidate among all available spectrum
"""
if policy == 'first_fit':
if candidates:
return candidates[0]
@@ -396,112 +386,46 @@ def select_candidate(candidates, policy):
raise ServiceError('Only first_fit spectrum assignment policy is implemented.')
def compute_n_m(required_m, rq, path_oms, oms_list, per_channel_m, policy='first_fit'):
""" based on requested path_bandwidth fill in M=None values with uint values, using per_channel_m
and center frequency, with first fit strategy. The function checks the available spectrum but check
consistencies among M values of the request, but not with other requests.
For example, if request is for 32 slots corresponding to 8 x 4 slots of 32Gbauds channels,
the following frequency slots will result in the following assignment
N = 0, 8, 16, 32 -> 0, 8, 16, 32
M = 8, None, 8, None -> 8, 8, 8, 8
N = 0, 8, 16, 32 -> 0, , 16
M = None, None, 8, None -> 24, , 8
"""
selected_m = []
selected_n = []
remaining_slots_to_serve = required_m
# order slots for the computation: assign biggest m first
rq_N, rq_M, order = order_slots([{'N': n, 'M': m} for n, m in zip(rq.N, rq.M)])
# Create an oms that represents current assignments of all oms listed in path_oms, and test N and M on it.
# If M is defined, checks that proposed N, M is free
test_oms = aggregate_oms_bitmap(path_oms, oms_list)
for n, m in zip(rq_N, rq_M):
if m is not None and n is not None:
# check availabilityfor this n, m
available_slots = determine_slot_numbers(test_oms, n, m, m)
if available_slots == 0:
# if n, m are not feasible, break at this point no have non zero remaining_slots_to_serve
# in order to blocks the request (even is other N,M where feasible)
break
elif m is not None and n is None:
# find a candidate n
n, _, _ = spectrum_selection(test_oms, m, None)
if n is None:
# if no n is feasible for the m, block the request
break
elif m is None and n is not None:
# find a feasible m for this n. If None is found, then block the request
m = determine_slot_numbers(test_oms, n, remaining_slots_to_serve, per_channel_m)
if m == 0 or remaining_slots_to_serve == 0:
break
else:
# if n and m are not defined, try to find a single assignment to fits the remaining slots to serve
# (first fit strategy)
n, _, _ = spectrum_selection(test_oms, remaining_slots_to_serve, None)
if n is None or remaining_slots_to_serve == 0:
break
else:
m = remaining_slots_to_serve
selected_m.append(m)
selected_n.append(n)
test_oms.assign_spectrum(n, m)
remaining_slots_to_serve = remaining_slots_to_serve - m
# re-order selected_m and selected_n according to initial request N, M order, ignoring None values
not_selected = [None for i in range(len(rq_N) - len(selected_n))]
selected_m = restore_order(selected_m + not_selected, order)
selected_n = restore_order(selected_n + not_selected, order)
return selected_n, selected_m, remaining_slots_to_serve
def pth_assign_spectrum(pths, rqs, oms_list, rpths):
"""basic first fit assignment
if reversed path are provided, means that occupation is bidir
""" basic first fit assignment
if reversed path are provided, means that occupation is bidir
"""
for pth, rq, rpth in zip(pths, rqs, rpths):
if hasattr(rq, 'blocking_reason'):
rq.N = None
rq.M = None
else:
# computes the number of channels required for path_bandwidth and the min required nb of slots
# for one channel (corresponds to the spacing)
nb_wl, required_m = compute_spectrum_slot_vs_bandwidth(rq.path_bandwidth,
rq.spacing, rq.bit_rate)
_, per_channel_m = compute_spectrum_slot_vs_bandwidth(rq.bit_rate,
rq.spacing, rq.bit_rate)
# find oms ids that are concerned both by pth and rpth
path_oms = build_path_oms_id_list(pth + rpth)
if getattr(rq, 'M', None) is not None and all(rq.M):
# if all M are well defined: Consistency check that the requested M are enough to carry the nb_wl:
# check that the integer number of per_channel_m carried in each M value is enough to carry nb_wl.
# if not, blocks the demand
nb_channels_of_request = sum([m // per_channel_m for m in rq.M])
# TODO: elaborate a more accurate estimate with nb_wl * min_spacing + possibly guardbands in case of
# superchannel closed packing.
if nb_wl > nb_channels_of_request:
rq.N = None
rq.M = None
rq.blocking_reason = 'NOT_ENOUGH_RESERVED_SPECTRUM'
# need to stop here for this request and not go though spectrum selection process
continue
# Use the req.M even if nb_wl and required_m are smaller.
# first fit strategy: assign as many lambda as possible in the None remaining N, M values
selected_n, selected_m, remaining_slots_to_serve = \
compute_n_m(required_m, rq, path_oms, oms_list, per_channel_m)
# if there are some remaining_slots_to_serve, this means that provided rq.M and rq.N values were
# not possible. Then do not go though spectrum assignment process and blocks the demand
if remaining_slots_to_serve > 0:
rq.N = None
rq.M = None
rq.blocking_reason = 'NO_SPECTRUM'
continue
for oms_elem in path_oms:
for this_n, this_m in zip(selected_n, selected_m):
if this_m is not None:
oms_list[oms_elem].assign_spectrum(this_n, this_m)
oms_list[oms_elem].add_service(rq.request_id, nb_wl)
rq.N = selected_n
rq.M = selected_m
for i, pth in enumerate(pths):
# computes the number of channels required
try:
if rqs[i].blocking_reason:
rqs[i].blocked = True
rqs[i].N = 0
rqs[i].M = 0
except AttributeError:
nb_wl = ceil(rqs[i].path_bandwidth / rqs[i].bit_rate)
# computes the total nb of slots according to requested spacing
# TODO : express superchannels
# assumes that all channels must be grouped
# TODO : enables non contiguous reservation in case of blocking
requested_m = ceil(rqs[i].spacing / 0.0125e12) * nb_wl
# concatenate all path and reversed path elements to derive slots availability
(center_n, startn, stopn), path_oms = spectrum_selection(pth + rpths[i], oms_list, requested_m,
requested_n=None)
# checks that requested_m is fitting startm and stopm
# if not None, center_n and start, stop frequencies are applicable to all oms of pth
# checks that spectrum is not None else indicate blocking reason
if center_n is not None:
# checks that requested_m is fitting startm and stopm
if 2 * requested_m > (stopn - startn + 1):
msg = f'candidate: {(center_n, startn, stopn)} is not consistant ' +\
f'with {requested_m}'
LOGGER.critical(msg)
raise ValueError(msg)
for oms_elem in path_oms:
oms_list[oms_elem].assign_spectrum(center_n, requested_m)
oms_list[oms_elem].add_service(rqs[i].request_id, nb_wl)
rqs[i].blocked = False
rqs[i].N = center_n
rqs[i].M = requested_m
else:
rqs[i].blocked = True
rqs[i].N = 0
rqs[i].M = 0
rqs[i].blocking_reason = 'NO_SPECTRUM'

25
gnpy/yang/__init__.py Normal file
View File

@@ -0,0 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2020 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
'''
Working with YANG-encoded data
'''
from pathlib import Path
def model_path() -> Path:
'''Filesystem path to TIP's own YANG models'''
return Path(__file__).parent / 'tip'
def external_path() -> Path:
'''Filesystem path to third-party YANG models that are shipped with GNPy'''
return Path(__file__).parent / 'ext'
def _yang_library() -> Path:
'''Filesystem path the the ietf-yanglib JSON file'''
return Path(__file__).parent / 'yanglib.json'

24
gnpy/yang/conversion.py Normal file
View File

@@ -0,0 +1,24 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2020 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
"""
Scaling factors for unit conversion
===================================
In YANG, the data model defines units for each possible value explicitly.
This makes it possible for users to input data using the customary, common units.
The :py:mod:`gnpy.yang.conversion` module holds scaling factors for conversion of SI units into YANG units and back.
By convention, each items is used for multiplication when going from YANG to the legacy JSON.
When converting from legacy JSON to YANG, use division.
"""
import math
FIBER_DISPERSION = 1e-6
FIBER_DISPERSION_SLOPE = 1e3
FIBER_GAMMA = 1e-3
FIBER_PMD_COEF = 1e-14 * math.sqrt(10)
THZ = 1e12
GIGA = 1000 * 1000 * 1000

View File

@@ -0,0 +1,458 @@
module ietf-inet-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
prefix "inet";
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
WG Chair: David Kessens
<mailto:david.kessens@nsn.com>
WG Chair: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>
Editor: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>";
description
"This module contains a collection of generally useful derived
YANG data types for Internet addresses and related things.
Copyright (c) 2013 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 6991; see
the RFC itself for full legal notices.";
revision 2013-07-15 {
description
"This revision adds the following new data types:
- ip-address-no-zone
- ipv4-address-no-zone
- ipv6-address-no-zone";
reference
"RFC 6991: Common YANG Data Types";
}
revision 2010-09-24 {
description
"Initial revision.";
reference
"RFC 6021: Common YANG Data Types";
}
/*** collection of types related to protocol fields ***/
typedef ip-version {
type enumeration {
enum unknown {
value "0";
description
"An unknown or unspecified version of the Internet
protocol.";
}
enum ipv4 {
value "1";
description
"The IPv4 protocol as defined in RFC 791.";
}
enum ipv6 {
value "2";
description
"The IPv6 protocol as defined in RFC 2460.";
}
}
description
"This value represents the version of the IP protocol.
In the value set and its semantics, this type is equivalent
to the InetVersion textual convention of the SMIv2.";
reference
"RFC 791: Internet Protocol
RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
RFC 4001: Textual Conventions for Internet Network Addresses";
}
typedef dscp {
type uint8 {
range "0..63";
}
description
"The dscp type represents a Differentiated Services Code Point
that may be used for marking packets in a traffic stream.
In the value set and its semantics, this type is equivalent
to the Dscp textual convention of the SMIv2.";
reference
"RFC 3289: Management Information Base for the Differentiated
Services Architecture
RFC 2474: Definition of the Differentiated Services Field
(DS Field) in the IPv4 and IPv6 Headers
RFC 2780: IANA Allocation Guidelines For Values In
the Internet Protocol and Related Headers";
}
typedef ipv6-flow-label {
type uint32 {
range "0..1048575";
}
description
"The ipv6-flow-label type represents the flow identifier or Flow
Label in an IPv6 packet header that may be used to
discriminate traffic flows.
In the value set and its semantics, this type is equivalent
to the IPv6FlowLabel textual convention of the SMIv2.";
reference
"RFC 3595: Textual Conventions for IPv6 Flow Label
RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
}
typedef port-number {
type uint16 {
range "0..65535";
}
description
"The port-number type represents a 16-bit port number of an
Internet transport-layer protocol such as UDP, TCP, DCCP, or
SCTP. Port numbers are assigned by IANA. A current list of
all assignments is available from <http://www.iana.org/>.
Note that the port number value zero is reserved by IANA. In
situations where the value zero does not make sense, it can
be excluded by subtyping the port-number type.
In the value set and its semantics, this type is equivalent
to the InetPortNumber textual convention of the SMIv2.";
reference
"RFC 768: User Datagram Protocol
RFC 793: Transmission Control Protocol
RFC 4960: Stream Control Transmission Protocol
RFC 4340: Datagram Congestion Control Protocol (DCCP)
RFC 4001: Textual Conventions for Internet Network Addresses";
}
/*** collection of types related to autonomous systems ***/
typedef as-number {
type uint32;
description
"The as-number type represents autonomous system numbers
which identify an Autonomous System (AS). An AS is a set
of routers under a single technical administration, using
an interior gateway protocol and common metrics to route
packets within the AS, and using an exterior gateway
protocol to route packets to other ASes. IANA maintains
the AS number space and has delegated large parts to the
regional registries.
Autonomous system numbers were originally limited to 16
bits. BGP extensions have enlarged the autonomous system
number space to 32 bits. This type therefore uses an uint32
base type without a range restriction in order to support
a larger autonomous system number space.
In the value set and its semantics, this type is equivalent
to the InetAutonomousSystemNumber textual convention of
the SMIv2.";
reference
"RFC 1930: Guidelines for creation, selection, and registration
of an Autonomous System (AS)
RFC 4271: A Border Gateway Protocol 4 (BGP-4)
RFC 4001: Textual Conventions for Internet Network Addresses
RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
Number Space";
}
/*** collection of types related to IP addresses and hostnames ***/
typedef ip-address {
type union {
type inet:ipv4-address;
type inet:ipv6-address;
}
description
"The ip-address type represents an IP address and is IP
version neutral. The format of the textual representation
implies the IP version. This type supports scoped addresses
by allowing zone identifiers in the address format.";
reference
"RFC 4007: IPv6 Scoped Address Architecture";
}
typedef ipv4-address {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ '(%[\p{N}\p{L}]+)?';
}
description
"The ipv4-address type represents an IPv4 address in
dotted-quad notation. The IPv4 address may include a zone
index, separated by a % sign.
The zone index is used to disambiguate identical address
values. For link-local addresses, the zone index will
typically be the interface index number or the name of an
interface. If the zone index is not present, the default
zone of the device will be used.
The canonical format for the zone index is the numerical
format";
}
typedef ipv6-address {
type string {
pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ '(%[\p{N}\p{L}]+)?';
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ '(%.+)?';
}
description
"The ipv6-address type represents an IPv6 address in full,
mixed, shortened, and shortened-mixed notation. The IPv6
address may include a zone index, separated by a % sign.
The zone index is used to disambiguate identical address
values. For link-local addresses, the zone index will
typically be the interface index number or the name of an
interface. If the zone index is not present, the default
zone of the device will be used.
The canonical format of IPv6 addresses uses the textual
representation defined in Section 4 of RFC 5952. The
canonical format for the zone index is the numerical
format as described in Section 11.2 of RFC 4007.";
reference
"RFC 4291: IP Version 6 Addressing Architecture
RFC 4007: IPv6 Scoped Address Architecture
RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
typedef ip-address-no-zone {
type union {
type inet:ipv4-address-no-zone;
type inet:ipv6-address-no-zone;
}
description
"The ip-address-no-zone type represents an IP address and is
IP version neutral. The format of the textual representation
implies the IP version. This type does not support scoped
addresses since it does not allow zone identifiers in the
address format.";
reference
"RFC 4007: IPv6 Scoped Address Architecture";
}
typedef ipv4-address-no-zone {
type inet:ipv4-address {
pattern '[0-9\.]*';
}
description
"An IPv4 address without a zone index. This type, derived from
ipv4-address, may be used in situations where the zone is
known from the context and hence no zone index is needed.";
}
typedef ipv6-address-no-zone {
type inet:ipv6-address {
pattern '[0-9a-fA-F:\.]*';
}
description
"An IPv6 address without a zone index. This type, derived from
ipv6-address, may be used in situations where the zone is
known from the context and hence no zone index is needed.";
reference
"RFC 4291: IP Version 6 Addressing Architecture
RFC 4007: IPv6 Scoped Address Architecture
RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
typedef ip-prefix {
type union {
type inet:ipv4-prefix;
type inet:ipv6-prefix;
}
description
"The ip-prefix type represents an IP prefix and is IP
version neutral. The format of the textual representations
implies the IP version.";
}
typedef ipv4-prefix {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ '/(([0-9])|([1-2][0-9])|(3[0-2]))';
}
description
"The ipv4-prefix type represents an IPv4 address prefix.
The prefix length is given by the number following the
slash character and must be less than or equal to 32.
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.
The canonical format of an IPv4 prefix has all bits of
the IPv4 address set to zero that are not part of the
IPv4 prefix.";
}
typedef ipv6-prefix {
type string {
pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ '(/.+)';
}
description
"The ipv6-prefix type represents an IPv6 address prefix.
The prefix length is given by the number following the
slash character and must be less than or equal to 128.
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.
The IPv6 address should have all bits that do not belong
to the prefix set to zero.
The canonical format of an IPv6 prefix has all bits of
the IPv6 address set to zero that are not part of the
IPv6 prefix. Furthermore, the IPv6 address is represented
as defined in Section 4 of RFC 5952.";
reference
"RFC 5952: A Recommendation for IPv6 Address Text
Representation";
}
/*** collection of domain name and URI types ***/
typedef domain-name {
type string {
pattern
'((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+ '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+ '|\.';
length "1..253";
}
description
"The domain-name type represents a DNS domain name. The
name SHOULD be fully qualified whenever possible.
Internet domain names are only loosely specified. Section
3.5 of RFC 1034 recommends a syntax (modified in Section
2.1 of RFC 1123). The pattern above is intended to allow
for current practice in domain name use, and some possible
future expansion. It is designed to hold various types of
domain names, including names used for A or AAAA records
(host names) and other records, such as SRV records. Note
that Internet host names have a stricter syntax (described
in RFC 952) than the DNS recommendations in RFCs 1034 and
1123, and that systems that want to store host names in
schema nodes using the domain-name type are recommended to
adhere to this stricter standard to ensure interoperability.
The encoding of DNS names in the DNS protocol is limited
to 255 characters. Since the encoding consists of labels
prefixed by a length bytes and there is a trailing NULL
byte, only 253 characters can appear in the textual dotted
notation.
The description clause of schema nodes using the domain-name
type MUST describe when and how these names are resolved to
IP addresses. Note that the resolution of a domain-name value
may require to query multiple DNS records (e.g., A for IPv4
and AAAA for IPv6). The order of the resolution process and
which DNS record takes precedence can either be defined
explicitly or may depend on the configuration of the
resolver.
Domain-name values use the US-ASCII encoding. Their canonical
format uses lowercase US-ASCII characters. Internationalized
domain names MUST be A-labels as per RFC 5890.";
reference
"RFC 952: DoD Internet Host Table Specification
RFC 1034: Domain Names - Concepts and Facilities
RFC 1123: Requirements for Internet Hosts -- Application
and Support
RFC 2782: A DNS RR for specifying the location of services
(DNS SRV)
RFC 5890: Internationalized Domain Names in Applications
(IDNA): Definitions and Document Framework";
}
typedef host {
type union {
type inet:ip-address;
type inet:domain-name;
}
description
"The host type represents either an IP address or a DNS
domain name.";
}
typedef uri {
type string;
description
"The uri type represents a Uniform Resource Identifier
(URI) as defined by STD 66.
Objects using the uri type MUST be in US-ASCII encoding,
and MUST be normalized as described by RFC 3986 Sections
6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
percent-encoding is removed, and all case-insensitive
characters are set to lowercase except for hexadecimal
digits, which are normalized to uppercase as described in
Section 6.2.2.1.
The purpose of this normalization is to help provide
unique URIs. Note that this normalization is not
sufficient to provide uniqueness. Two URIs that are
textually distinct after this normalization may still be
equivalent.
Objects using the uri type may restrict the schemes that
they permit. For example, 'data:' and 'urn:' schemes
might not be appropriate.
A zero-length URI is not a valid URI. This can be used to
express 'URI absent' where required.
In the value set and its semantics, this type is equivalent
to the Uri SMIv2 textual convention defined in RFC 5017.";
reference
"RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
Group: Uniform Resource Identifiers (URIs), URLs,
and Uniform Resource Names (URNs): Clarifications
and Recommendations
RFC 5017: MIB Textual Conventions for Uniform Resource
Identifiers (URIs)";
}
}

View File

@@ -0,0 +1,294 @@
module ietf-network-topology {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
prefix nt;
import ietf-inet-types {
prefix inet;
reference
"RFC 6991: Common YANG Data Types";
}
import ietf-network {
prefix nw;
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
Editor: Alexander Clemm
<mailto:ludwig@clemm.org>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:robert.varga@pantheon.tech>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>
Editor: Xufeng Liu
<mailto:xufeng.liu.ietf@gmail.com>";
description
"This module defines a common base model for a network topology,
augmenting the base network data model with links to connect
nodes, as well as termination points to terminate links
on nodes.
Copyright (c) 2018 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 8345;
see the RFC itself for full legal notices.";
revision 2018-02-26 {
description
"Initial revision.";
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
typedef link-id {
type inet:uri;
description
"An identifier for a link in a topology. The precise
structure of the link-id will be up to the implementation.
The identifier SHOULD be chosen such that the same link in a
real network topology will always be identified through the
same identifier, even if the data model is instantiated in
separate datastores. An implementation MAY choose to capture
semantics in the identifier -- for example, to indicate the
type of link and/or the type of topology of which the link is
a part.";
}
typedef tp-id {
type inet:uri;
description
"An identifier for termination points on a node. The precise
structure of the tp-id will be up to the implementation.
The identifier SHOULD be chosen such that the same termination
point in a real network topology will always be identified
through the same identifier, even if the data model is
instantiated in separate datastores. An implementation MAY
choose to capture semantics in the identifier -- for example,
to indicate the type of termination point and/or the type of
node that contains the termination point.";
}
grouping link-ref {
description
"This grouping can be used to reference a link in a specific
network. Although it is not used in this module, it is
defined here for the convenience of augmenting modules.";
leaf link-ref {
type leafref {
path "/nw:networks/nw:network[nw:network-id=current()/../"+
"network-ref]/nt:link/nt:link-id";
require-instance false;
}
description
"A type for an absolute reference to a link instance.
(This type should not be used for relative references.
In such a case, a relative path should be used instead.)";
}
uses nw:network-ref;
}
grouping tp-ref {
description
"This grouping can be used to reference a termination point
in a specific node. Although it is not used in this module,
it is defined here for the convenience of augmenting
modules.";
leaf tp-ref {
type leafref {
path "/nw:networks/nw:network[nw:network-id=current()/../"+
"network-ref]/nw:node[nw:node-id=current()/../"+
"node-ref]/nt:termination-point/nt:tp-id";
require-instance false;
}
description
"A type for an absolute reference to a termination point.
(This type should not be used for relative references.
In such a case, a relative path should be used instead.)";
}
uses nw:node-ref;
}
augment "/nw:networks/nw:network" {
description
"Add links to the network data model.";
list link {
key "link-id";
description
"A network link connects a local (source) node and
a remote (destination) node via a set of the respective
node's termination points. It is possible to have several
links between the same source and destination nodes.
Likewise, a link could potentially be re-homed between
termination points. Therefore, in order to ensure that we
would always know to distinguish between links, every link
is identified by a dedicated link identifier. Note that a
link models a point-to-point link, not a multipoint link.";
leaf link-id {
type link-id;
description
"The identifier of a link in the topology.
A link is specific to a topology to which it belongs.";
}
container source {
description
"This container holds the logical source of a particular
link.";
leaf source-node {
type leafref {
path "../../../nw:node/nw:node-id";
require-instance false;
}
description
"Source node identifier. Must be in the same topology.";
}
leaf source-tp {
type leafref {
path "../../../nw:node[nw:node-id=current()/../"+
"source-node]/termination-point/tp-id";
require-instance false;
}
description
"This termination point is located within the source node
and terminates the link.";
}
}
container destination {
description
"This container holds the logical destination of a
particular link.";
leaf dest-node {
type leafref {
path "../../../nw:node/nw:node-id";
require-instance false;
}
description
"Destination node identifier. Must be in the same
network.";
}
leaf dest-tp {
type leafref {
path "../../../nw:node[nw:node-id=current()/../"+
"dest-node]/termination-point/tp-id";
require-instance false;
}
description
"This termination point is located within the
destination node and terminates the link.";
}
}
list supporting-link {
key "network-ref link-ref";
description
"Identifies the link or links on which this link depends.";
leaf network-ref {
type leafref {
path "../../../nw:supporting-network/nw:network-ref";
require-instance false;
}
description
"This leaf identifies in which underlay topology
the supporting link is present.";
}
leaf link-ref {
type leafref {
path "/nw:networks/nw:network[nw:network-id=current()/"+
"../network-ref]/link/link-id";
require-instance false;
}
description
"This leaf identifies a link that is a part
of this link's underlay. Reference loops in which
a link identifies itself as its underlay, either
directly or transitively, are not allowed.";
}
}
}
}
augment "/nw:networks/nw:network/nw:node" {
description
"Augments termination points that terminate links.
Termination points can ultimately be mapped to interfaces.";
list termination-point {
key "tp-id";
description
"A termination point can terminate a link.
Depending on the type of topology, a termination point
could, for example, refer to a port or an interface.";
leaf tp-id {
type tp-id;
description
"Termination point identifier.";
}
list supporting-termination-point {
key "network-ref node-ref tp-ref";
description
"This list identifies any termination points on which a
given termination point depends or onto which it maps.
Those termination points will themselves be contained
in a supporting node. This dependency information can be
inferred from the dependencies between links. Therefore,
this item is not separately configurable. Hence, no
corresponding constraint needs to be articulated.
The corresponding information is simply provided by the
implementing system.";
leaf network-ref {
type leafref {
path "../../../nw:supporting-node/nw:network-ref";
require-instance false;
}
description
"This leaf identifies in which topology the
supporting termination point is present.";
}
leaf node-ref {
type leafref {
path "../../../nw:supporting-node/nw:node-ref";
require-instance false;
}
description
"This leaf identifies in which node the supporting
termination point is present.";
}
leaf tp-ref {
type leafref {
path "/nw:networks/nw:network[nw:network-id=current()/"+
"../network-ref]/nw:node[nw:node-id=current()/../"+
"node-ref]/termination-point/tp-id";
require-instance false;
}
description
"Reference to the underlay node (the underlay node must
be in a different topology).";
}
}
}
}
}

View File

@@ -0,0 +1,192 @@
module ietf-network {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network";
prefix nw;
import ietf-inet-types {
prefix inet;
reference
"RFC 6991: Common YANG Data Types";
}
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
Editor: Alexander Clemm
<mailto:ludwig@clemm.org>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:robert.varga@pantheon.tech>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>
Editor: Xufeng Liu
<mailto:xufeng.liu.ietf@gmail.com>";
description
"This module defines a common base data model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2018 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 8345;
see the RFC itself for full legal notices.";
revision 2018-02-26 {
description
"Initial revision.";
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
typedef node-id {
type inet:uri;
description
"Identifier for a node. The precise structure of the node-id
will be up to the implementation. For example, some
implementations MAY pick a URI that includes the network-id
as part of the path. The identifier SHOULD be chosen
such that the same node in a real network topology will
always be identified through the same identifier, even if
the data model is instantiated in separate datastores. An
implementation MAY choose to capture semantics in the
identifier -- for example, to indicate the type of node.";
}
typedef network-id {
type inet:uri;
description
"Identifier for a network. The precise structure of the
network-id will be up to the implementation. The identifier
SHOULD be chosen such that the same network will always be
identified through the same identifier, even if the data model
is instantiated in separate datastores. An implementation MAY
choose to capture semantics in the identifier -- for example,
to indicate the type of network.";
}
grouping network-ref {
description
"Contains the information necessary to reference a network --
for example, an underlay network.";
leaf network-ref {
type leafref {
path "/nw:networks/nw:network/nw:network-id";
require-instance false;
}
description
"Used to reference a network -- for example, an underlay
network.";
}
}
grouping node-ref {
description
"Contains the information necessary to reference a node.";
leaf node-ref {
type leafref {
path "/nw:networks/nw:network[nw:network-id=current()/../"+
"network-ref]/nw:node/nw:node-id";
require-instance false;
}
description
"Used to reference a node.
Nodes are identified relative to the network that
contains them.";
}
uses network-ref;
}
container networks {
description
"Serves as a top-level container for a list of networks.";
list network {
key "network-id";
description
"Describes a network.
A network typically contains an inventory of nodes,
topological information (augmented through the
network-topology data model), and layering information.";
leaf network-id {
type network-id;
description
"Identifies a network.";
}
container network-types {
description
"Serves as an augmentation target.
The network type is indicated through corresponding
presence containers augmented into this container.";
}
list supporting-network {
key "network-ref";
description
"An underlay network, used to represent layered network
topologies.";
leaf network-ref {
type leafref {
path "/nw:networks/nw:network/nw:network-id";
require-instance false;
}
description
"References the underlay network.";
}
}
list node {
key "node-id";
description
"The inventory of nodes of this network.";
leaf node-id {
type node-id;
description
"Uniquely identifies a node within the containing
network.";
}
list supporting-node {
key "network-ref node-ref";
description
"Represents another node that is in an underlay network
and that supports this node. Used to represent layering
structure.";
leaf network-ref {
type leafref {
path "../../../nw:supporting-network/nw:network-ref";
require-instance false;
}
description
"References the underlay network of which the
underlay node is a part.";
}
leaf node-ref {
type leafref {
path "/nw:networks/nw:network/nw:node/nw:node-id";
require-instance false;
}
description
"References the underlay node itself.";
}
}
}
}
}
}

View File

@@ -0,0 +1,474 @@
module ietf-yang-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
prefix "yang";
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
WG Chair: David Kessens
<mailto:david.kessens@nsn.com>
WG Chair: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>
Editor: Juergen Schoenwaelder
<mailto:j.schoenwaelder@jacobs-university.de>";
description
"This module contains a collection of generally useful derived
YANG data types.
Copyright (c) 2013 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 6991; see
the RFC itself for full legal notices.";
revision 2013-07-15 {
description
"This revision adds the following new data types:
- yang-identifier
- hex-string
- uuid
- dotted-quad";
reference
"RFC 6991: Common YANG Data Types";
}
revision 2010-09-24 {
description
"Initial revision.";
reference
"RFC 6021: Common YANG Data Types";
}
/*** collection of counter and gauge types ***/
typedef counter32 {
type uint32;
description
"The counter32 type represents a non-negative integer
that monotonically increases until it reaches a
maximum value of 2^32-1 (4294967295 decimal), when it
wraps around and starts increasing again from zero.
Counters have no defined 'initial' value, and thus, a
single value of a counter has (in general) no information
content. Discontinuities in the monotonically increasing
value normally occur at re-initialization of the
management system, and at other times as specified in the
description of a schema node using this type. If such
other times can occur, for example, the creation of
a schema node of type counter32 at times other than
re-initialization, then a corresponding schema node
should be defined, with an appropriate type, to indicate
the last discontinuity.
The counter32 type should not be used for configuration
schema nodes. A default statement SHOULD NOT be used in
combination with the type counter32.
In the value set and its semantics, this type is equivalent
to the Counter32 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef zero-based-counter32 {
type yang:counter32;
default "0";
description
"The zero-based-counter32 type represents a counter32
that has the defined 'initial' value zero.
A schema node of this type will be set to zero (0) on creation
and will thereafter increase monotonically until it reaches
a maximum value of 2^32-1 (4294967295 decimal), when it
wraps around and starts increasing again from zero.
Provided that an application discovers a new schema node
of this type within the minimum time to wrap, it can use the
'initial' value as a delta. It is important for a management
station to be aware of this minimum time and the actual time
between polls, and to discard data if the actual time is too
long or there is no defined minimum time.
In the value set and its semantics, this type is equivalent
to the ZeroBasedCounter32 textual convention of the SMIv2.";
reference
"RFC 4502: Remote Network Monitoring Management Information
Base Version 2";
}
typedef counter64 {
type uint64;
description
"The counter64 type represents a non-negative integer
that monotonically increases until it reaches a
maximum value of 2^64-1 (18446744073709551615 decimal),
when it wraps around and starts increasing again from zero.
Counters have no defined 'initial' value, and thus, a
single value of a counter has (in general) no information
content. Discontinuities in the monotonically increasing
value normally occur at re-initialization of the
management system, and at other times as specified in the
description of a schema node using this type. If such
other times can occur, for example, the creation of
a schema node of type counter64 at times other than
re-initialization, then a corresponding schema node
should be defined, with an appropriate type, to indicate
the last discontinuity.
The counter64 type should not be used for configuration
schema nodes. A default statement SHOULD NOT be used in
combination with the type counter64.
In the value set and its semantics, this type is equivalent
to the Counter64 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef zero-based-counter64 {
type yang:counter64;
default "0";
description
"The zero-based-counter64 type represents a counter64 that
has the defined 'initial' value zero.
A schema node of this type will be set to zero (0) on creation
and will thereafter increase monotonically until it reaches
a maximum value of 2^64-1 (18446744073709551615 decimal),
when it wraps around and starts increasing again from zero.
Provided that an application discovers a new schema node
of this type within the minimum time to wrap, it can use the
'initial' value as a delta. It is important for a management
station to be aware of this minimum time and the actual time
between polls, and to discard data if the actual time is too
long or there is no defined minimum time.
In the value set and its semantics, this type is equivalent
to the ZeroBasedCounter64 textual convention of the SMIv2.";
reference
"RFC 2856: Textual Conventions for Additional High Capacity
Data Types";
}
typedef gauge32 {
type uint32;
description
"The gauge32 type represents a non-negative integer, which
may increase or decrease, but shall never exceed a maximum
value, nor fall below a minimum value. The maximum value
cannot be greater than 2^32-1 (4294967295 decimal), and
the minimum value cannot be smaller than 0. The value of
a gauge32 has its maximum value whenever the information
being modeled is greater than or equal to its maximum
value, and has its minimum value whenever the information
being modeled is smaller than or equal to its minimum value.
If the information being modeled subsequently decreases
below (increases above) the maximum (minimum) value, the
gauge32 also decreases (increases).
In the value set and its semantics, this type is equivalent
to the Gauge32 type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef gauge64 {
type uint64;
description
"The gauge64 type represents a non-negative integer, which
may increase or decrease, but shall never exceed a maximum
value, nor fall below a minimum value. The maximum value
cannot be greater than 2^64-1 (18446744073709551615), and
the minimum value cannot be smaller than 0. The value of
a gauge64 has its maximum value whenever the information
being modeled is greater than or equal to its maximum
value, and has its minimum value whenever the information
being modeled is smaller than or equal to its minimum value.
If the information being modeled subsequently decreases
below (increases above) the maximum (minimum) value, the
gauge64 also decreases (increases).
In the value set and its semantics, this type is equivalent
to the CounterBasedGauge64 SMIv2 textual convention defined
in RFC 2856";
reference
"RFC 2856: Textual Conventions for Additional High Capacity
Data Types";
}
/*** collection of identifier-related types ***/
typedef object-identifier {
type string {
pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
+ '(\.(0|([1-9]\d*)))*';
}
description
"The object-identifier type represents administratively
assigned names in a registration-hierarchical-name tree.
Values of this type are denoted as a sequence of numerical
non-negative sub-identifier values. Each sub-identifier
value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
are separated by single dots and without any intermediate
whitespace.
The ASN.1 standard restricts the value space of the first
sub-identifier to 0, 1, or 2. Furthermore, the value space
of the second sub-identifier is restricted to the range
0 to 39 if the first sub-identifier is 0 or 1. Finally,
the ASN.1 standard requires that an object identifier
has always at least two sub-identifiers. The pattern
captures these restrictions.
Although the number of sub-identifiers is not limited,
module designers should realize that there may be
implementations that stick with the SMIv2 limit of 128
sub-identifiers.
This type is a superset of the SMIv2 OBJECT IDENTIFIER type
since it is not restricted to 128 sub-identifiers. Hence,
this type SHOULD NOT be used to represent the SMIv2 OBJECT
IDENTIFIER type; the object-identifier-128 type SHOULD be
used instead.";
reference
"ISO9834-1: Information technology -- Open Systems
Interconnection -- Procedures for the operation of OSI
Registration Authorities: General procedures and top
arcs of the ASN.1 Object Identifier tree";
}
typedef object-identifier-128 {
type object-identifier {
pattern '\d*(\.\d*){1,127}';
}
description
"This type represents object-identifiers restricted to 128
sub-identifiers.
In the value set and its semantics, this type is equivalent
to the OBJECT IDENTIFIER type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef yang-identifier {
type string {
length "1..max";
pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
}
description
"A YANG identifier string as defined by the 'identifier'
rule in Section 12 of RFC 6020. An identifier must
start with an alphabetic character or an underscore
followed by an arbitrary sequence of alphabetic or
numeric characters, underscores, hyphens, or dots.
A YANG identifier MUST NOT start with any possible
combination of the lowercase or uppercase character
sequence 'xml'.";
reference
"RFC 6020: YANG - A Data Modeling Language for the Network
Configuration Protocol (NETCONF)";
}
/*** collection of types related to date and time***/
typedef date-and-time {
type string {
pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
+ '(Z|[\+\-]\d{2}:\d{2})';
}
description
"The date-and-time type is a profile of the ISO 8601
standard for representation of dates and times using the
Gregorian calendar. The profile is defined by the
date-time production in Section 5.6 of RFC 3339.
The date-and-time type is compatible with the dateTime XML
schema type with the following notable exceptions:
(a) The date-and-time type does not allow negative years.
(b) The date-and-time time-offset -00:00 indicates an unknown
time zone (see RFC 3339) while -00:00 and +00:00 and Z
all represent the same time zone in dateTime.
(c) The canonical format (see below) of data-and-time values
differs from the canonical format used by the dateTime XML
schema type, which requires all times to be in UTC using
the time-offset 'Z'.
This type is not equivalent to the DateAndTime textual
convention of the SMIv2 since RFC 3339 uses a different
separator between full-date and full-time and provides
higher resolution of time-secfrac.
The canonical format for date-and-time values with a known time
zone uses a numeric time zone offset that is calculated using
the device's configured known offset to UTC time. A change of
the device's offset to UTC time will cause date-and-time values
to change accordingly. Such changes might happen periodically
in case a server follows automatically daylight saving time
(DST) time zone offset changes. The canonical format for
date-and-time values with an unknown time zone (usually
referring to the notion of local time) uses the time-offset
-00:00.";
reference
"RFC 3339: Date and Time on the Internet: Timestamps
RFC 2579: Textual Conventions for SMIv2
XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
}
typedef timeticks {
type uint32;
description
"The timeticks type represents a non-negative integer that
represents the time, modulo 2^32 (4294967296 decimal), in
hundredths of a second between two epochs. When a schema
node is defined that uses this type, the description of
the schema node identifies both of the reference epochs.
In the value set and its semantics, this type is equivalent
to the TimeTicks type of the SMIv2.";
reference
"RFC 2578: Structure of Management Information Version 2
(SMIv2)";
}
typedef timestamp {
type yang:timeticks;
description
"The timestamp type represents the value of an associated
timeticks schema node at which a specific occurrence
happened. The specific occurrence must be defined in the
description of any schema node defined using this type. When
the specific occurrence occurred prior to the last time the
associated timeticks attribute was zero, then the timestamp
value is zero. Note that this requires all timestamp values
to be reset to zero when the value of the associated timeticks
attribute reaches 497+ days and wraps around to zero.
The associated timeticks schema node must be specified
in the description of any schema node using this type.
In the value set and its semantics, this type is equivalent
to the TimeStamp textual convention of the SMIv2.";
reference
"RFC 2579: Textual Conventions for SMIv2";
}
/*** collection of generic address types ***/
typedef phys-address {
type string {
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
}
description
"Represents media- or physical-level addresses represented
as a sequence octets, each octet represented by two hexadecimal
numbers. Octets are separated by colons. The canonical
representation uses lowercase characters.
In the value set and its semantics, this type is equivalent
to the PhysAddress textual convention of the SMIv2.";
reference
"RFC 2579: Textual Conventions for SMIv2";
}
typedef mac-address {
type string {
pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
}
description
"The mac-address type represents an IEEE 802 MAC address.
The canonical representation uses lowercase characters.
In the value set and its semantics, this type is equivalent
to the MacAddress textual convention of the SMIv2.";
reference
"IEEE 802: IEEE Standard for Local and Metropolitan Area
Networks: Overview and Architecture
RFC 2579: Textual Conventions for SMIv2";
}
/*** collection of XML-specific types ***/
typedef xpath1.0 {
type string;
description
"This type represents an XPATH 1.0 expression.
When a schema node is defined that uses this type, the
description of the schema node MUST specify the XPath
context in which the XPath expression is evaluated.";
reference
"XPATH: XML Path Language (XPath) Version 1.0";
}
/*** collection of string types ***/
typedef hex-string {
type string {
pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
}
description
"A hexadecimal string with octets represented as hex digits
separated by colons. The canonical representation uses
lowercase characters.";
}
typedef uuid {
type string {
pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
+ '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
}
description
"A Universally Unique IDentifier in the string representation
defined in RFC 4122. The canonical representation uses
lowercase characters.
The following is an example of a UUID in string representation:
f81d4fae-7dec-11d0-a765-00a0c91e6bf6
";
reference
"RFC 4122: A Universally Unique IDentifier (UUID) URN
Namespace";
}
typedef dotted-quad {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
}
description
"An unsigned 32-bit number expressed in the dotted-quad
notation, i.e., four octets written as decimal numbers
and separated with the '.' (full stop) character.";
}
}

722
gnpy/yang/io.py Normal file
View File

@@ -0,0 +1,722 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2020 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
#
"""
Reading and writing YANG data
=============================
Module :py:mod:`gnpy.yang.io` enables loading of data that are formatted according to the YANG+JSON rules.
Use :func:`load_from_yang` to parse and validate the data, and :func:`save_equipment` to store the equipment library.
"""
from networkx import DiGraph
from typing import Any, Dict, List, Tuple, Union
import numpy as np
import yangson as _y
import copy
from gnpy.core import elements, exceptions
import gnpy.tools.json_io as _ji
import gnpy.core.science_utils as _sci
import gnpy.yang
import gnpy.yang.conversion as _conv
def create_datamodel() -> _y.DataModel:
'''Create a new yangson.DataModel'''
return _y.DataModel.from_file(gnpy.yang._yang_library(), (gnpy.yang.external_path(), gnpy.yang.model_path()))
def _extract_common_fiber(fiber: _y.instance.ArrayEntry) -> Dict:
return {
'dispersion': float(fiber['chromatic-dispersion'].value) * _conv.FIBER_DISPERSION,
'dispersion_slope': float(fiber['chromatic-dispersion-slope'].value) * _conv.FIBER_DISPERSION_SLOPE,
'gamma': float(fiber['gamma'].value) * _conv.FIBER_GAMMA,
'pmd_coef': float(fiber['pmd-coefficient'].value) * _conv.FIBER_PMD_COEF,
}
def _transform_fiber(fiber: _y.instance.ArrayEntry) -> _ji.Fiber:
'''Turn yangson's ``tip-photonic-equipment:fiber`` into a Fiber equipment type representation'''
return _ji.Fiber(
type_variety=fiber['type'].value,
**_extract_common_fiber(fiber),
)
def _transform_raman_fiber(fiber: _y.instance.ArrayEntry) -> _ji.RamanFiber:
'''Turn yangson's ``tip-photonic-equipment:fiber`` with a Raman section into a RamanFiber equipment type representation'''
return _ji.RamanFiber(
type_variety=fiber['type'].value,
raman_efficiency={ # FIXME: check the order here, the existing code is picky, and YANG doesn't guarantee any particular order here
'cr': [x['cr'].value for x in fiber['raman-efficiency']],
'frequency_offset': [float(x['delta-frequency'].value) for x in fiber['raman-efficiency']],
},
**_extract_common_fiber(fiber),
)
def _extract_per_spectrum(key: str, yang) -> List[float]:
'''Extract per-frequency offsets from a freq->offset YANG list and store them as a list interpolated at a 50 GHz grid'''
if key not in yang:
return (0, )
data = [(int(x['frequency'].value), float(x[key].value)) for x in yang[key]]
data.sort(key=lambda tup: tup[0])
# FIXME: move this to gnpy.core.elements
# FIXME: we're also probably doing the interpolation wrong in elements.py (C-band grid vs. actual carrier frequencies)
keys = [x[0] for x in data]
values = [x[1] for x in data]
frequencies = [int(191.3e12 + channel * 50e9) for channel in range(96)]
data = [x for x in np.interp(frequencies, keys, values)] # force back Python's native list to silence a FutureWarning: elementwise comparison failed
return data
def _transform_edfa(edfa: _y.instance.ArrayEntry) -> _ji.Amp:
'''Turn yangson's ``tip-photonic-equipment:amplifier`` into an EDFA equipment type representation'''
POLYNOMIAL_NF = 'polynomial-NF'
OPENROADM_ILA = 'OpenROADM-ILA'
OPENROADM_PREAMP = 'OpenROADM-preamp'
OPENROADM_BOOSTER = 'OpenROADM-booster'
MIN_MAX_NF = 'min-max-NF'
COMPOSITE = 'composite'
RAMAN_APPROX = 'raman-approximation'
GAIN_RIPPLE = 'gain-ripple'
NF_RIPPLE = 'nf-ripple'
DYNAMIC_GAIN_TILT = 'dynamic-gain-tilt'
name = edfa['type'].value
type_def = None
nf_model = None
dual_stage_model = None
f_min = None
f_max = None
gain_flatmax = None
p_max = None
nf_fit_coeff = None
nf_ripple = None
dgt = None
gain_ripple = None
if COMPOSITE in edfa:
# this model will be postprocessed in _fixup_dual_stage, so just save some placeholders here
model = edfa[COMPOSITE]
type_def = 'dual_stage'
dual_stage_model = _ji.Model_dual_stage(model['preamp'].value, model['booster'].value)
else:
if POLYNOMIAL_NF in edfa:
model = edfa[POLYNOMIAL_NF]
nf_fit_coeff = (float(model['a'].value), float(model['b'].value), float(model['c'].value), float(model['d'].value))
type_def = 'advanced_model'
elif OPENROADM_ILA in edfa:
model = edfa[OPENROADM_ILA]
nf_model = _ji.Model_openroadm_ila(nf_coef=(float(model['a'].value), float(model['b'].value),
float(model['c'].value), float(model['d'].value)))
type_def = 'openroadm'
elif OPENROADM_PREAMP in edfa:
type_def = 'openroadm_preamp'
elif OPENROADM_BOOSTER in edfa:
type_def = 'openroadm_booster'
elif MIN_MAX_NF in edfa:
model = edfa[MIN_MAX_NF]
nf_min = float(model['nf-min'].value)
nf_max = float(model['nf-max'].value)
nf1, nf2, delta_p = _sci.estimate_nf_model(name, float(edfa['gain-min'].value), float(edfa['gain-flatmax'].value),
nf_min, nf_max)
nf_model = _ji.Model_vg(nf1, nf2, delta_p, nf_min, nf_max)
type_def = 'variable_gain'
elif RAMAN_APPROX in edfa:
model = edfa[RAMAN_APPROX]
nf_fit_coeff = (0., 0., 0., float(model['nf'].value))
type_def = 'advanced_model'
else:
raise NotImplementedError(f'Internal error: EDFA model {name}: unrecognized amplifier NF model for EDFA. '
'Error in the YANG validation code.')
gain_flatmax = float(edfa['gain-flatmax'].value)
f_min = float(edfa['frequency-min'].value) * _conv.THZ
f_max = float(edfa['frequency-max'].value) * _conv.THZ
p_max = float(edfa['max-power-out'].value)
gain_ripple = _extract_per_spectrum(GAIN_RIPPLE, edfa)
dgt = _extract_per_spectrum(DYNAMIC_GAIN_TILT, edfa)
nf_ripple = _extract_per_spectrum(NF_RIPPLE, edfa)
return _ji.Amp(
type_variety=name,
type_def=type_def,
f_min=f_min,
f_max=f_max,
gain_min=float(edfa['gain-min'].value),
gain_flatmax=gain_flatmax,
p_max=p_max,
nf_fit_coeff=nf_fit_coeff,
nf_ripple=nf_ripple,
dgt=dgt,
gain_ripple=gain_ripple,
out_voa_auto=None, # FIXME
allowed_for_design=True, # FIXME
raman=False,
nf_model=nf_model,
dual_stage_model=dual_stage_model,
)
def _fixup_dual_stage(amps: Dict[str, _ji.Amp]) -> Dict[str, _ji.Amp]:
'''Replace preamp/booster string model IDs with references to actual objects'''
for name, amp in amps.items():
if amp.dual_stage_model is None:
continue
preamp = amps[amp.dual_stage_model.preamp_variety]
booster = amps[amp.dual_stage_model.booster_variety]
this_amp = amps[name]
# FIXME: the old JSON code copies each and every attr, do we need that here?
for attr in preamp.__dict__.keys():
setattr(this_amp, f'preamp_{attr}', getattr(preamp, attr))
for attr in booster.__dict__.keys():
setattr(this_amp, f'booster_{attr}', getattr(booster, attr))
return amps
def _transform_roadm(roadm: _y.instance.ArrayEntry) -> _ji.Roadm:
'''Turn yangson's ``tip-photonic-equipment:roadm`` into a ROADM equipment type representation'''
return _ji.Roadm(
target_pch_out_db=float(roadm['target-channel-out-power'].value),
add_drop_osnr=float(roadm['add-drop-osnr'].value),
pmd=float(roadm['polarization-mode-dispersion'].value),
restrictions={
'preamp_variety_list': [amp.value for amp in roadm['compatible-preamp']] if 'compatible-preamp' in roadm else [],
'booster_variety_list': [amp.value for amp in roadm['compatible-booster']] if 'compatible-booster' in roadm else [],
},
)
def _transform_transceiver_mode(mode: _y.instance.ArrayEntry) -> Dict[str, object]:
return {
'format': mode['name'].value,
'baud_rate': float(mode['baud-rate'].value) * _conv.GIGA,
'OSNR': float(mode['required-osnr'].value),
'bit_rate': float(mode['bit-rate'].value) * _conv.GIGA,
'roll_off': float(mode['tx-roll-off'].value),
'tx_osnr': float(mode['in-band-tx-osnr'].value),
'min_spacing': float(mode['grid-spacing'].value) * _conv.GIGA,
'cost': float(mode['tip-photonic-simulation:cost'].value),
}
def _transform_transceiver(txp: _y.instance.ArrayEntry) -> _ji.Transceiver:
'''Turn yangson's ``tip-photonic-equipment:transceiver`` into a Transceiver equipment type representation'''
return _ji.Transceiver(
type_variety=txp['type'].value,
frequency={
"min": float(txp['frequency-min'].value) * _conv.THZ,
"max": float(txp['frequency-max'].value) * _conv.THZ,
},
mode=[_transform_transceiver_mode(mode) for mode in txp['mode']],
)
def _optional_float(yangish, key, default=None):
'''Retrieve a decimal64 value as a float, or None if not present'''
return float(yangish[key].value) if key in yangish else default
def _load_equipment(data: _y.instance.RootNode, sim_data: _y.instance.InstanceNode) -> Dict[str, Dict[str, Any]]:
'''Load the equipment library from YANG data'''
equipment = {
'Edfa': _fixup_dual_stage({x['type'].value: _transform_edfa(x) for x in data['tip-photonic-equipment:amplifier']}),
'Fiber': {x['type'].value: _transform_fiber(x) for x in data['tip-photonic-equipment:fiber']},
'RamanFiber': {x['type'].value: _transform_raman_fiber(x) for x in data['tip-photonic-equipment:fiber'] if 'raman-efficiency' in x},
'Span': {'default': _ji.Span(
power_mode='power-mode' in sim_data['autodesign'],
delta_power_range_db=[
float(sim_data['autodesign']['power-adjustment-for-span-loss']['maximal-reduction'].value),
float(sim_data['autodesign']['power-adjustment-for-span-loss']['maximal-boost'].value),
float(sim_data['autodesign']['power-adjustment-for-span-loss']['excursion-step-size'].value),
],
max_fiber_lineic_loss_for_raman=0, # FIXME: can we deprecate this?
target_extended_gain=2.5, # FIXME
max_length=150, # FIXME
length_units='km', # FIXME
max_loss=None, # FIXME
padding=0, # FIXME
EOL=0, # FIXME
con_in=0,
con_out=0,
)
},
'Roadm': {x['type'].value: _transform_roadm(x) for x in data['tip-photonic-equipment:roadm']},
'SI': {
'default': _ji.SI(
f_min=float(sim_data['grid']['frequency-min'].value) * _conv.THZ,
f_max=float(sim_data['grid']['frequency-max'].value) * _conv.THZ,
baud_rate=float(sim_data['grid']['baud-rate'].value) * _conv.GIGA,
spacing=float(sim_data['grid']['spacing'].value) * _conv.GIGA,
power_dbm=float(sim_data['grid']['power'].value),
power_range_db=(
[ # start, stop, step
float(sim_data['autodesign']['power-mode']['power-sweep']['start'].value),
float(sim_data['autodesign']['power-mode']['power-sweep']['stop'].value),
float(sim_data['autodesign']['power-mode']['power-sweep']['step-size'].value),
] if 'power-sweep' in sim_data['autodesign']['power-mode'] else [0, 0, 0]
) if ('power-mode' in sim_data['autodesign']) else None,
roll_off=float(sim_data['grid']['tx-roll-off'].value),
sys_margins=float(sim_data['system-margin'].value),
tx_osnr=float(sim_data['grid']['tx-osnr'].value),
),
},
'Transceiver': {x['type'].value: _transform_transceiver(x) for x in data['tip-photonic-equipment:transceiver']},
}
return equipment
def _load_network(data: _y.instance.RootNode, equipment: Dict[str, Dict[str, Any]]) -> DiGraph:
'''Load the network topology from YANG data'''
network = DiGraph()
nodes = {}
for net in data['ietf-network:networks']['ietf-network:network']:
if 'network-types' not in net:
continue
if 'tip-photonic-topology:photonic-topology' not in net['network-types']:
continue
for node in net['ietf-network:node']:
uid = node['node-id'].value
location = None
if 'tip-photonic-topology:geo-location' in node:
loc = node['tip-photonic-topology:geo-location']
if 'x' in loc and 'y' in loc:
location = elements.Location(
longitude=float(loc['tip-photonic-topology:x'].value),
latitude=float(loc['tip-photonic-topology:y'].value)
)
metadata = {'location': location} if location is not None else None
if 'tip-photonic-topology:amplifier' in node:
amp = node['tip-photonic-topology:amplifier']
type_variety = amp['model'].value
params = copy.copy(equipment['Edfa'][type_variety].__dict__)
el = elements.Edfa(
uid=uid,
type_variety=type_variety,
params=params,
metadata=metadata,
operational={
'gain_target': _optional_float(amp, 'gain-target'),
'tilt_target': _optional_float(amp, 'tilt-target', 0),
'out_voa': _optional_float(amp, 'out-voa-target'),
'delta_p': _optional_float(amp, 'delta-p'),
},
)
elif 'tip-photonic-topology:roadm' in node:
roadm = node['tip-photonic-topology:roadm']
type_variety = roadm['model'].value
params = copy.copy(equipment['Roadm'][type_variety].__dict__)
el = elements.Roadm(
uid=uid,
type_variety=roadm['model'].value,
metadata={'location': location} if location is not None else None,
params=params,
# FIXME
)
elif 'tip-photonic-topology:transceiver' in node:
txp = node['tip-photonic-topology:transceiver']
el = elements.Transceiver(
uid=uid,
type_variety=txp['model'].value,
metadata={'location': location} if location is not None else None,
# FIXME
)
elif 'tip-photonic-topology:attenuator' in node:
att = node['tip-photonic-topology:attenuator']
el = elements.Fused(
uid=uid,
params={
'loss': _optional_float(att, 'attenuation', None),
}
)
else:
raise ValueError(f'Internal error: unrecognized network node {node} which was expected to belong to the photonic-topology')
network.add_node(el)
nodes[el.uid] = el
# start by creating GNPy network nodes
for link in net['ietf-network-topology:link']:
source = link['source']['source-node'].value
target = link['destination']['dest-node'].value
if 'tip-photonic-topology:fiber' in link:
fiber = link['tip-photonic-topology:fiber']
params = {
'length_units': 'km', # FIXME
'length': float(fiber['length'].value),
'loss_coef': float(fiber['loss-per-km'].value),
'att_in': float(fiber['attenuation-in'].value),
'con_in': float(fiber['conn-att-in'].value),
'con_out': float(fiber['conn-att-out'].value),
}
specs = equipment['Fiber'][fiber['type'].value]
for key in ('dispersion', 'gamma', 'pmd_coef'):
params[key] = getattr(specs, key)
location = elements.Location(
latitude=(nodes[source].metadata['location'].latitude + nodes[target].metadata['location'].latitude) / 2,
longitude=(nodes[source].metadata['location'].longitude + nodes[target].metadata['location'].longitude) / 2,
)
el = elements.Fiber(
uid=link['link-id'].value,
type_variety=fiber['type'].value,
params=params,
metadata={'location': location},
# FIXME
)
network.add_node(el)
nodes[el.uid] = el
elif 'tip-photonic-topology:patch' in link:
# No GNPy-level node is needed for these
pass
else:
raise ValueError(f'Internal error: unrecognized network link {link} which was expected to belong to the photonic-topology')
# now add actual links
for link in net['ietf-network-topology:link']:
source = link['source']['source-node'].value
target = link['destination']['dest-node'].value
if 'tip-photonic-topology:fiber' in link:
this_node = link['link-id'].value
network.add_edge(nodes[source], nodes[this_node], weight=float(fiber['length'].value))
network.add_edge(nodes[this_node], nodes[target], weight=0.01)
elif 'tip-photonic-topology:patch' in link:
network.add_edge(nodes[source], nodes[target], weight=0.01)
patch = link['tip-photonic-topology:patch']
if 'roadm-target-egress-per-channel-power' in patch:
per_degree_power = float(patch['roadm-target-egress-per-channel-power'].value)
nodes[source].params.per_degree_pch_out_db[target] = per_degree_power
# FIXME: read set_egress_amplifier and make it do what I want to do here
# FIXME: be super careful with autodesign!, the assumptions in "legacy JSON" and in "YANG JSON" are very different
return network
def load_from_yang(json_data: Dict) -> Tuple[Dict[str, Dict[str, Any]], DiGraph]:
'''Load equipment library, (FIXME: nothing for now, will be the network topology) and simulation options from a YANG-formatted JSON-like object'''
dm = create_datamodel()
data = dm.from_raw(json_data)
data.validate(ctype=_y.enumerations.ContentType.config)
data = data.add_defaults()
# No warnings are given for "missing data". In YANG, it is either an error if some required data are missing,
# or there are default values which in turn mean that it is safe to not specify those data. There's no middle
# ground like "please yell at me when I missed that, but continue with the simulation". I have to admit I like that.
SIMULATION = 'tip-photonic-simulation:simulation'
if SIMULATION not in data:
raise exceptions.ConfigurationError(f'YANG data does not contain the /{SIMULATION} element')
sim_data = data[SIMULATION]
equipment = _load_equipment(data, sim_data)
# FIXME: adjust all Simulation's parameters
network = _load_network(data, equipment)
return (equipment, network)
def _store_equipment_edfa(name: str, edfa: _ji.Amp) -> Dict:
'''Save in-memory representation of an EDFA amplifier type into a YANG-formatted dict'''
res = {
'type': name,
'gain-min': str(edfa.gain_min),
}
if edfa.dual_stage_model is not None:
res['composite'] = {
'preamp': edfa.dual_stage_model.preamp_variety,
'booster': edfa.dual_stage_model.booster_variety,
}
else:
res['frequency-min'] = str(edfa.f_min / _conv.THZ)
res['frequency-max'] = str(edfa.f_max / _conv.THZ)
res['gain-flatmax'] = str(edfa.gain_flatmax)
res['max-power-out'] = str(edfa.p_max)
res['has-output-voa'] = edfa.out_voa_auto
if isinstance(edfa.nf_model, _ji.Model_fg):
if edfa.nf_model.nf0 < 3:
res['raman-approximation'] = {
'nf': str(edfa.nf_model.nf0)
}
else:
res['polynomial-NF'] = {
'a': '0',
'b': '0',
'c': '0',
'd': str(edfa.nf_model.nf0),
}
elif isinstance(edfa.nf_model, _ji.Model_vg):
res['min-max-NF'] = {
'nf-min': str(edfa.nf_model.orig_nf_min),
'nf-max': str(edfa.nf_model.orig_nf_max),
}
elif isinstance(edfa.nf_model, _ji.Model_openroadm_ila):
res['OpenROADM-ILA'] = {
'a': str(edfa.nf_model.nf_coef[0]),
'b': str(edfa.nf_model.nf_coef[1]),
'c': str(edfa.nf_model.nf_coef[2]),
'd': str(edfa.nf_model.nf_coef[3]),
}
elif isinstance(edfa.nf_model, _ji.Model_openroadm_preamp):
res['OpenROADM-preamp'] = {}
elif isinstance(edfa.nf_model, _ji.Model_openroadm_booster):
res['OpenROADM-booster'] = {}
elif edfa.type_def == 'advanced_model':
res['polynomial-NF'] = {
'a': str(edfa.nf_fit_coeff[0]),
'b': str(edfa.nf_fit_coeff[1]),
'c': str(edfa.nf_fit_coeff[2]),
'd': str(edfa.nf_fit_coeff[3]),
}
# FIXME: implement these
# 'nf_ripple': None,
# 'dgt': None,
# 'gain_ripple': None,
return res
def _store_equipment_fiber(name: str, fiber: Union[_ji.Fiber, _ji.RamanFiber]) -> Dict:
'''Save in-memory representation of a single fiber type into a YANG-formatted dict'''
res = {
'type': name,
'chromatic-dispersion': str(fiber.dispersion / _conv.FIBER_DISPERSION),
'gamma': str(fiber.gamma / _conv.FIBER_GAMMA),
'pmd-coefficient': str(fiber.pmd_coef / _conv.FIBER_PMD_COEF),
}
# FIXME: do we support setting 'dispersion-slope' via JSON setting in the first place? There are no examples...
try:
res['dispersion-slope'] = str(fiber.dispersion_slope / _conv.FIBER_DISPERSION_SLOPE)
except AttributeError:
pass
if isinstance(fiber, _ji.RamanFiber):
res['raman-efficiency'] = [
{
'delta-frequency': str(freq / _conv.THZ),
'cr': str(float(cr)),
} for (cr, freq) in zip(fiber.raman_efficiency['cr'], fiber.raman_efficiency['frequency_offset'])
]
return res
def _store_equipment_transceiver(name: str, txp: _ji.Transceiver) -> Dict:
'''Save in-memory representation of a transceiver type into a YANG-formatted dict'''
return {
'type': name,
'frequency-min': str(txp.frequency['min'] / _conv.THZ),
'frequency-max': str(txp.frequency['max'] / _conv.THZ),
'mode': [{
'name': mode['format'],
'bit-rate': int(mode['bit_rate'] / _conv.GIGA),
'baud-rate': str(float(mode['baud_rate'] / _conv.GIGA)),
'required-osnr': str(float(mode['OSNR'])),
'in-band-tx-osnr': str(float(mode['tx_osnr'])),
'grid-spacing': str(float(mode['min_spacing'] / _conv.GIGA)),
'tx-roll-off': str(float(mode['roll_off'])),
'tip-photonic-simulation:cost': mode['cost'],
} for mode in txp.mode],
}
def _store_equipment_roadm(name: str, roadm: _ji.Roadm) -> Dict:
'''Save in-memory representation of a ROADM type into a YANG-formatted dict'''
return {
'type': name,
'add-drop-osnr': str(roadm.add_drop_osnr),
'polarization-mode-dispersion': str(roadm.pmd),
'target-channel-out-power': str(roadm.target_pch_out_db),
'compatible-preamp': [amp for amp in roadm.restrictions.get('preamp_variety_list', [])],
'compatible-booster': [amp for amp in roadm.restrictions.get('booster_variety_list', [])],
}
def _json_yang_link(uid, source, destination, extra):
link = {
'link-id': uid,
'source': {
'source-node': source,
},
'destination': {
'dest-node': destination,
},
}
link.update(extra)
return link
def _store_topology(raw: Dict, equipment, network):
nodes = []
links = []
for n in network.nodes():
if isinstance(n, elements.Transceiver):
if not hasattr(n, 'type_variety'):
# raise exceptions.NetworkTopologyError(f"Legacy JSON doesn't specify type_variety for {n!s}")
# FIXME: Many topologies do not define transponder types. How to solve this?
n.type_variety = next(iter(equipment['Transceiver']))
nodes.append({
'node-id': n.uid,
'tip-photonic-topology:transceiver': {
'model': n.type_variety,
}
})
# for x in _next_nodes_except_links(network, n):
# links.append(_json_yang_link(f'{n.uid} - {x.uid}', n.uid, x.uid, {})
elif isinstance(n, elements.Edfa):
amp_data = {
'model': n.type_variety,
}
if n.operational.gain_target is not None:
amp_data['gain-target'] = str(n.operational.gain_target)
if n.operational.delta_p is not None:
amp_data['delta-p'] = str(n.operational.delta_p)
if n.operational.tilt_target is not None:
amp_data['tilt-target'] = str(n.operational.tilt_target)
if n.operational.out_voa is not None:
amp_data['out-voa-target'] = str(n.operational.out_voa)
nodes.append({
'node-id': n.uid,
'tip-photonic-topology:amplifier': amp_data,
})
elif isinstance(n, elements.Roadm):
if not hasattr(n, 'type_variety'):
raise exceptions.NetworkTopologyError(f"Legacy JSON doesn't specify type_variety for {n!s}")
nodes.append({
'node-id': n.uid,
'tip-photonic-topology:roadm': {
'model': n.type_variety,
'target-egress-per-channel-power': str(n.params.target_pch_out_db),
# FIXME: more
}
})
elif isinstance(n, elements.Fused):
nodes.append({
'node-id': n.uid,
'tip-photonic-topology:attenuator': {
'attenuation': str(n.loss),
}
})
elif isinstance(n, elements.Fiber):
ingress_node = next(network.predecessors(n))
egress_node = next(network.successors(n))
specific = {
'tip-photonic-topology:fiber': {
'type': n.type_variety,
'length': str(n.params.length * 1e-3),
'attenuation-in': str(n.params.att_in),
'conn-att-in': str(n.params.con_in),
'conn-att-out': str(n.params.con_out),
# FIXME: more?
}
}
links.append(_json_yang_link(n.uid, ingress_node.uid, egress_node.uid, specific))
else:
raise NotImplementedError(f'Internal error: unhandled node {n!s}')
for edge in network.edges():
if isinstance(edge[0], elements.Fiber):
if isinstance(edge[1], elements.Fiber):
raise exceptions.NetworkTopologyError(f"Fiber connected to a Fiber: {edge[0].uid}, {edge[1].uid}")
else:
# nt:link got created when the Fiber node was processed
continue
elif isinstance(edge[1], elements.Fiber):
# nt:link got created when the Fiber node was processed
continue
link = {'tip-photonic-topology:patch': {}}
if isinstance(edge[0], elements.Roadm):
per_degree_powers = edge[0].params.per_degree_pch_out_db
next_node_name = edge[1].uid
link['tip-photonic-topology:patch']['roadm-target-egress-per-channel-power'] = str(
per_degree_powers.get(next_node_name, edge[0].params.target_pch_out_db))
links.append(_json_yang_link(f'patch{{{edge[0].uid}, {edge[1].uid}}}', edge[0].uid, edge[1].uid, link))
raw['ietf-network:networks'] = {
'network': [{
'network-id': 'GNPy',
'network-types': {
'tip-photonic-topology:photonic-topology': {},
},
'node': nodes,
'ietf-network-topology:link': links,
}],
}
def save_to_json(equipment: Dict[str, Dict[str, Any]], network) -> Dict:
'''Save the in-memory equipment library into a dict with YANG-formatted data'''
dm = create_datamodel()
for k in ('Edfa', 'Fiber', 'Span', 'SI', 'Transceiver', 'Roadm'):
if k not in equipment:
raise exceptions.ConfigurationError(f'No "{k}" in the equipment library')
for k in ('Span', 'SI'):
if 'default' not in equipment[k]:
raise exceptions.ConfigurationError('No ["{k}"]["default"] in the equipment library')
# FIXME: what do we do with these amps? Is this detection a good thing, btw?
# legacy_raman = [name for (name, amp) in equipment['Edfa'].items() if amp.raman]
# if legacy_raman:
# raise exceptions.ConfigurationError(
# f'Legacy Raman amplifiers are not supported, remove them from configuration: {legacy_raman}')
span: _ji.Span = equipment['Span']['default']
spectrum: _ji.SI = equipment['SI']['default']
raw = {
"tip-photonic-equipment:amplifier": [_store_equipment_edfa(k, v) for (k, v) in equipment['Edfa'].items()],
"tip-photonic-equipment:fiber":
[_store_equipment_fiber(k, v) for (k, v) in equipment['Fiber'].items() if k not in equipment.get('RamanFiber', {})] +
[_store_equipment_fiber(k, v) for (k, v) in equipment.get('RamanFiber', {}).items()],
"tip-photonic-equipment:transceiver": [_store_equipment_transceiver(k, v) for (k, v) in equipment['Transceiver'].items()],
"tip-photonic-equipment:roadm": [_store_equipment_roadm(k, v) for (k, v) in equipment['Roadm'].items()],
"tip-photonic-simulation:simulation": {
'grid': {
'frequency-min': str(spectrum.f_min / _conv.THZ),
'frequency-max': str(spectrum.f_max / _conv.THZ),
'spacing': str(spectrum.spacing / _conv.GIGA),
'power': str(spectrum.power_dbm),
'tx-roll-off': str(spectrum.roll_off),
'tx-osnr': str(spectrum.tx_osnr),
'baud-rate': str(spectrum.baud_rate / _conv.GIGA),
},
'autodesign': {
'allowed-inline-edfa': [k for (k, v) in equipment['Edfa'].items() if v.allowed_for_design],
'power-adjustment-for-span-loss': {
'maximal-reduction': str(span.delta_power_range_db[0]),
'maximal-boost': str(span.delta_power_range_db[1]),
'excursion-step-size': str(span.delta_power_range_db[2]),
},
},
'system-margin': str(spectrum.sys_margins),
},
}
if span.power_mode:
raw['tip-photonic-simulation:simulation']['autodesign']['power-mode'] = {
'power-sweep': {
'start': str(spectrum.power_range_db[0]),
'stop': str(spectrum.power_range_db[1]),
'step-size': str(spectrum.power_range_db[2]),
},
}
else:
raw['tip-photonic-simulation:simulation']['autodesign']['gain-mode'] = [None]
if network is not None:
_store_topology(raw, equipment, network)
data = dm.from_raw(raw)
data.validate()
return data.raw_value()

View File

@@ -0,0 +1,104 @@
module tip-onos-topology {
yang-version 1.1;
namespace "https://oopt.telecominfraproject.com/yang/onos-topology";
prefix "gnpy-onos";
import ietf-network {
prefix nw;
revision-date 2018-02-26;
}
import ietf-network-topology {
prefix nt;
revision-date 2018-02-26;
}
organization "Telecom Infrastructure Project";
contact "https://github.com/Telecominfraproject/oopt-gnpy";
description "Feeding GNPy simulations into ONOS
GNPy and ONOS have different understanding of what \"a node\" is.
In GNPy, a typical ROADM, and even a ROADM degree, comprises one GNPy-level element for the \"switching matrix\", and also an extra element for each integrated EDFA.
This presents certain issues when mapping ONOS-level requests with GNPy-level path information -- simply because the node IDs *cannot* be the same.
No GNPy nodes are \"split\" into several ONOS nodes, but many ONOS elements are split into several GNPy nodes each.
To use this, just create one nw:network for the GNPy topology, and one nw:network for the ONOS topology.
The node IDs in GNPy are arbitrary, while the node IDs in this topology must map directly to ONOS Device URLs.
Create a pair of nt:network/node/supporting-node/node-ref and network-ref going from the ONOS topology to the GNPy topology.
GNPy's experimental API server will use this information to automatically build a device configuration JSON that can be fed to ONOS.
The links are a bit more complex, because GNPy does not use ports -- just devices.
All connections in GNPy are unidirectional, whereas in ONOS we only use bidirectional ones -- but with a given port.
This is required so that, e.g., ONOS knows how to determine the egress port number when routing a MC in a ROADM.
";
revision 2021-06-06 {
description "Initial release";
reference "Internal documentation";
}
augment "/nw:networks/nw:network/nw:network-types" {
description "ONOS topology for use with GNPy";
container onos-topology {
presence "Devices for ONOS";
description "Devices for ONOS";
}
}
augment "/nw:networks/nw:network/nw:node" {
when "../nw:network-types/gnpy-onos:onos-topology";
description "ONOS devices";
container device {
description "A device that ONOS can connect to
Use nt:node/supporting-node to tie this with GNPy-level nodes.
";
leaf name {
type string;
mandatory true;
description "A free-form title";
}
leaf grid-x {
type int16;
mandatory true;
description "Position in ONOS' topology view (X)";
}
leaf grid-y {
type int16;
mandatory true;
description "Position in ONOS' topology view (Y)";
}
leaf driver {
type string;
mandatory true;
description "Driver ID";
}
container netconf {
description "Protocol options for NETCONF connections";
leaf username {
type string;
mandatory true;
description "Login name";
}
leaf password {
type string;
mandatory true;
description "Password in cleartext";
}
leaf idle-timeout {
type uint16;
description "Just use 0 here";
}
}
}
}
augment "/nw:networks/nw:network/nt:link" {
when "../nw:network-types/gnpy-onos:onos-topology";
description "ONOS device links";
// right now we just don't to anything; we create a link with a magic name, and that's all
}
}

View File

@@ -0,0 +1,694 @@
module tip-photonic-equipment {
yang-version 1.1;
namespace "https://oopt.telecominfraproject.com/yang/equipment";
prefix "tip-pe";
organization "Telecom Infrastructure Project";
contact "https://github.com/Telecominfraproject/oopt-gnpy";
description "Catalog of photonic equipment for simulating signal propagation via the OOPT-PSE GNPy tool";
revision 2020-09-01 {
description "Initial release";
reference "Internal documentation";
}
typedef db-ratio {
type decimal64 {
fraction-digits 2;
}
units "dB";
description "Decibels";
}
typedef noise-figure {
type db-ratio {
range "3.0 .. 20.0";
}
description "Noise Figure of an amplifier";
}
typedef gain {
type db-ratio {
range "0 .. 40.0";
}
description "Gain of an amplifier";
}
typedef power {
type decimal64 {
fraction-digits 2;
range "-99.9 .. 30.0";
}
units "dBm";
description "Optical power in dBm";
}
typedef carrier-frequency {
type decimal64 {
fraction-digits 7;
range "191.0 .. 197.0";
}
units "THz";
description "Optical frequency of a signal";
}
typedef frequency-channel-spacing {
type decimal64 {
fraction-digits 7;
range "6.25 .. 200.0";
}
units "GHz";
description "Channel spacing";
}
typedef frequency-raman-pump {
type decimal64 {
fraction-digits 3;
range "196.0 .. 260.0";
}
units "THz";
description "Optical frequency of a Raman pumping laser";
}
typedef baud-rate {
type decimal64 {
fraction-digits 4;
range "10 .. 130";
}
units "Gbaud";
description "Symbol rate";
}
typedef roll-off {
type decimal64 {
fraction-digits 4;
range "0 .. 1";
}
description "Roll-off parameter (β) of the TX pulse shaping filter. This assumes a raised-cosine filter.";
}
typedef cd {
type decimal64 {
fraction-digits 2;
range "-50000 .. 50000";
}
units "ps × nm⁻¹";
description "Chromatic Dispersion (CD).";
}
typedef pmd {
type decimal64 {
fraction-digits 4;
}
units "ps";
description "Polarization mode dispersion (PMD).";
}
typedef polynomial-coefficient {
type decimal64 {
fraction-digits 12;
}
description "One coefficient within a polynomial";
}
grouping cubic-polynomial-coefficients {
description "Coefficients for a polynomial of a third degree: f(x) = a*x³ + b*x² + c*x + d";
leaf a {
type polynomial-coefficient;
mandatory true;
description "Cubic (x³) coefficient";
}
leaf b {
type polynomial-coefficient;
mandatory true;
description "Quadratic (x²) coefficient";
}
leaf c {
type polynomial-coefficient;
mandatory true;
description "Linear (x) coefficient";
}
leaf d {
type polynomial-coefficient;
mandatory true;
description "Offset (+) coefficient";
}
}
grouping amp-spectrum-profile {
description "Changes in amplifier's operation as a function of frequency";
list gain-ripple {
leaf frequency {
type carrier-frequency;
description "Frequency for the specific gain ripple deviation";
}
leaf gain-ripple {
type db-ratio;
mandatory true;
description "Gain ripple deviation at a given frequency";
}
key "frequency";
description "Amplifier gain ripple excursion comb list in dB across the frequency range";
}
list nf-ripple {
leaf frequency {
type carrier-frequency;
description "Frequency for the specific NF ripple deviation";
}
leaf nf-ripple {
type db-ratio;
mandatory true;
description "NF ripple deviation at a given frequency";
}
key "frequency";
description "Amplifier NF ripple excursion comb list in dB across the frequency range";
}
list dynamic-gain-tilt {
leaf frequency {
type carrier-frequency;
description "Frequency for the specific NF ripple deviation";
}
leaf dynamic-gain-tilt {
type db-ratio;
mandatory true;
description "DGT at a specified frequency";
}
key "frequency";
description "Dynamic Gain Tilt (DGT) refers to a relative change of gain
at a given frequency when compared to a reference frequency.
Intro about the model: https://telecominfraproject.workplace.com/groups/OOPT.PSE/permalink/957144244450445/
Relevant paper: https://www.osapublishing.org/jlt/abstract.cfm?uri=JLT-18-3-343";
}
}
grouping amp-common {
description "Properties common to all EDFAs except the composite models";
leaf frequency-min {
type carrier-frequency;
default 191.325;
description "Minimal frequency supported by this amplifier
This refers to the edge of the optical spectrum, not to a central frequency of a fixed grid.";
}
leaf frequency-max {
type carrier-frequency;
default 196.125;
description "Maximal frequency supported by this amplifier
This refers to the edge of the optical spectrum, not to a central frequency of a fixed grid.";
}
leaf has-output-voa {
type boolean;
default false;
description "If true, output VOA is present.
An amplifier with an output VOA can be pushed to operate at its the max-power-out if the output VOA is available.";
}
leaf gain-flatmax {
type gain;
mandatory true;
description "Maximal gain of the nominal range (without entering the extended range)
Once the amplifier's gain gets pushed into the extended range, it begins to tilt as specified in the dynamic-gain-tilt.";
}
leaf max-power-out {
type power;
mandatory true;
description "Maximal output power at the amplifier's output port
The total signal output power will not be allowed beyond this value.";
}
}
list amplifier {
key "type";
description "Available amplifier (EDFA) models";
leaf type {
type string;
description "Brief identification of the amplifier model. This is used for cross-referencing from topology data.";
}
uses amp-common {
when "count(composite) = 0";
description "Common parameters for all EDFAs except aggregated ones";
}
leaf gain-min {
type gain;
mandatory true;
description "Minimal possible gain of the amplifier
If the amplifier's gain is set below this value, the amplifier's input is automatically padded with an attenuator,
and the NF is increased by the attenuation of this padding.";
}
choice noise-model {
mandatory true;
description "What simulation algorithm to use for this amplifier model";
case polynomial-NF {
container polynomial-NF {
description "Whitebox model with detailed information about gain ripple, NF ripple and dynamic gain tilt
Polynomial coefficients for NF calculation:
f(x) = a*x³ + b*x² + c*x + d
NF = f(gain_max - gain)
This model can be also used for fixed-gain fixed-NF amplifiers. In that case, use:
a = b = c = 0
d = NF";
uses cubic-polynomial-coefficients;
}
}
case min-max-NF {
container min-max-NF {
description "Operator-focused model
Performance is defined by the minimal and maximal NF. These are especially suited to model a dual-coil
EDFA with a VOA in between.";
leaf nf-min {
type noise-figure;
mandatory true;
description "Minimal Noise Figure (operating at the point of the maximal flat gain)
See gain-flatmax.";
}
leaf nf-max {
type noise-figure;
mandatory true;
description "Maximal Noise Figure (operating at the minimal gain)";
}
}
}
case OpenROADM-ILA {
container OpenROADM-ILA {
description "EDFA model based on the OpenROADM specification for an ILA
OpenROADM describes amplifier performance in terms of an incremental OSNR as a function of input power:
Incremental OSNR = a*Pᵢₙ³ + b*Pᵢₙ² + c*Pᵢₙ + d
";
uses cubic-polynomial-coefficients;
}
}
case OpenROADM-preamp {
container OpenROADM-preamp {
presence true;
description "Linear impairments of the MW-MW path within an OpenROADM ROADM node
Unlike GNPy which simulates the preamplifier and the booster separately as two amplifiers for best accuracy,
the OpenROADM specification mandates a certain performance level for a combination of these two amplifiers.
For the express path, the effective noise mask comprises the preamplifier and the booster.
When terminating a channel, the same effective noise mask is mandated for a combination of the preamplifier
and the drop stage.
This NF model provides all of the linear impairments to the signal, including those which are incurred by
the booster in a real network.";
}
}
case OpenROADM-booster {
container OpenROADM-booster {
presence true;
description "A faux, \"zero-noise\" amplifier for use along with OpenROADM-preamp as a booster.";
}
}
case composite {
container composite {
description "Dual-stage amplifier combines two distinct amplifiers
The first amplifier will be always operated at its maximal gain (and therefore its best NF).";
leaf preamp {
type leafref {
path "/tip-pe:amplifier/type";
}
must "count(deref(.)/../composite) = 0" {
error-message "First (preamp) stage of a composite amplifier cannot be a composite amplifier";
}
must "../../gain-min >= deref(.)/../gain-min" {
error-message "Minimal total gain of a composite EDFA cannot be lower that the minimal gain of the preamp";
}
mandatory true;
description "Amplifier type used as a preamplifier, i.e., the first stage";
}
leaf booster {
type leafref {
path "/tip-pe:amplifier/type";
}
must "count(deref(.)/../composite) = 0" {
error-message "Second (booster) stage of a composite amplifier cannot be a composite amplifier";
}
must "(deref(.)/../frequency-min <= deref(../preamp)/../frequency-max) and
(deref(.)/../frequency-max >= deref(../preamp)/../frequency-min)" {
error-message "booster/preamp operating frequencies do not overlap";
}
mandatory true;
description "Amplifier type used as a booster, i.e., the second stage";
}
}
}
case raman-approximation {
container raman-approximation {
description "Emulate a Raman amplifier with a possibly negative NF
This NF model assumes a particular, fixed NF. It is similar to the polynomial-NF model, except that the
effective NF value is fixed (and therefore it does not vary with the amplifier's operating point), and
that the effective NF can be described as a negative value.
Use this for model to (roughly) emulate a Raman amplifier when the detailed description of Raman pumps
is not available from the equipment vendor.";
leaf nf {
type db-ratio {
range "-5.0 .. 20.0";
}
mandatory true;
description "Noise Figure (NF) of the amplifier";
}
}
}
}
uses amp-spectrum-profile {
when "count(deref(.)/composite) = 0";
}
leaf model-precision {
type enumeration {
enum public-approximation {
description "These data come from a publicly available datasheet, and as such might be only an approximate representation";
}
enum reasonably-precise {
description "The GNPy team believes that these are reasonably accurate";
}
}
default reasonably-precise;
description "How precise are the modeling data
If a simulation runs with only approximate inputs, the simulation results might be \"tainted\" with inaccuracies.";
}
}
list fiber {
key "type";
description "Available fiber types";
leaf type {
type string;
description "Unique identification of the fiber type. This is used for cross-referencing from topology data.";
}
leaf chromatic-dispersion {
type decimal64 {
fraction-digits 6;
range "-25 .. 25";
}
units "ps × nm⁻¹ × km⁻¹";
mandatory true;
description "Chromatic dispersion";
}
leaf chromatic-dispersion-slope {
type decimal64 {
fraction-digits 8;
range "0 .. 0.1";
}
units "ps × nm⁻² × km⁻¹";
default "0.07";
description "Chromatic dispersion slope is related to the β₃ coefficient
Cf. Abramczyk, Halina. Dispersion phenomena in optical fibers. Virtual European University on Lasers, 2005.
http://mitr.p.lodz.pl/evu/lectures/Abramczyk3.pdf";
}
leaf gamma {
type decimal64 {
fraction-digits 8;
range "0.5 .. 2.5";
}
units "W⁻¹ × km⁻¹";
mandatory true;
description "Fiber's γ coefficient
See, e.g., A. Carena, G. Bosco, V. Curri, P. Poggiolini, M. Tapia Taiba, and F. Forghieri. Statistical characterization
of PM-QPSK signals after propagation in uncompensated fiber links. In European Conference on Optical Communications,
2010, 13. IEEE, 2010-09.
URL: http://ieeexplore.ieee.org/document/5621509/
doi:10.1109/ECOC.2010.5621509";
}
leaf pmd-coefficient {
type decimal64 {
fraction-digits 10;
range "0 .. 10";
}
units "ps × √(km)⁻¹";
mandatory true;
description "Polarization mode dispersion (PMD) coefficient";
}
list raman-efficiency {
key "delta-frequency";
description "Efficiency of Raman amplification in the fiber medium per operating frequency
See, e.g., J. Bromage. Raman Amplification for Fiber Communications Systems. In J. Lightwave Technol. 22, 79- (2004).";
leaf delta-frequency {
type decimal64 {
fraction-digits 3;
range "0 .. 60";
}
units "THz";
description "Spectral difference between the pumping photon and the one receiving energy";
}
leaf cr {
type decimal64 {
fraction-digits 12;
range "0 .. 1";
}
mandatory true;
description "Normalized Raman efficiency (the Cᵣ parameter)";
}
}
}
list transceiver {
key "type";
description "Available transceivers";
leaf type {
type string;
description "Unique identification of the transceiver type. This is used for cross-referencing from topology data.";
}
leaf frequency-min {
type carrier-frequency;
default 191.35;
description "Minimal frequency supported by this transceiver model";
}
leaf frequency-max {
type carrier-frequency;
default 196.1;
description "Maximal frequency supported by this transceiver model";
}
list mode {
key "name";
min-elements 1;
description "Operating mode of a transceiver";
leaf name {
type string;
description "Name of this operating mode";
}
leaf bit-rate {
type uint16 {
range "100 .. 1000";
}
units "Gbits * s⁻¹";
description "Data bit rate";
}
leaf baud-rate {
type baud-rate;
mandatory true;
description "Symbol baud rate";
}
leaf required-osnr {
type db-ratio {
range "10..40";
}
mandatory true;
description "Minimal required OSNR at the Rx port per 0.1nm of bandwidth";
}
leaf in-band-tx-osnr {
type db-ratio;
mandatory true;
description "Worst-case guaranteed initial OSNR at the Tx port per 0.1nm of bandwidth
Only the in-band OSNR is considered.";
}
leaf grid-spacing {
type frequency-channel-spacing;
mandatory true;
description "Minimal grid spacing
This includes the effective channel spectral bandwidth as well as any operational constraints and policies.";
}
leaf tx-roll-off {
type roll-off;
mandatory true;
description "Roll-off parameter (β) of the TX pulse shaping filter. This assumes a raised-cosine filter.";
}
leaf max-chromatic-dispersion {
type cd;
description "Maximal allowed CD (a hard limit)";
}
leaf max-polarization-mode-dispersion {
type pmd {
range "0 .. 500";
}
description "Maximal allowed PMD (a hard limit)";
}
list chromatic-and-polarization-dispersion-penalty {
key "chromatic-dispersion polarization-mode-dispersion";
leaf chromatic-dispersion {
type cd;
must ". <= ../../max-chromatic-dispersion" {
error-message "CD in the penalty matrix exceeds receiver tolerance";
}
description "CD for a given penalty";
}
leaf polarization-mode-dispersion {
type pmd {
range "0 .. 500";
}
must ". <= ../../max-polarization-mode-dispersion" {
error-message "PMD in the penalty matrix exceeds receiver tolerance";
}
description "PMD for a given penalty";
}
leaf penalty {
type db-ratio {
range "-5 .. 10";
}
mandatory true;
description "Resulting GSNR penalty at the specified CD and PMD";
}
description "GSNR penalty for a combination of a CD and PMD
The receiver performance should be de-rated by a given `penalty` for a specified combination of CD and PMD.
GNPy will use linear approximation between the provided datapoints in the CD/PMD matrix.
";
}
}
}
list roadm {
key "type";
description "ROADM - Reconfigurable Optical Add/Drop Multiplexer";
leaf type {
type string;
description "Unique identification of the transponder type. This is used for cross-referencing from topology data.";
}
leaf add-drop-osnr {
type db-ratio;
mandatory true;
description "OSNR penalty introduced by the Add stage and the Drop stage of this ROADM model
Effective degradation of the signal, taking into account both the Add and the Drop stages of this ROADM model.";
}
leaf target-channel-out-power {
type power;
mandatory true;
description "Per-channel target TX power towards the egress amplifier
Within GNPy, a ROADM is expected to attenuate any signal that enters the ROADM node to this level. This can be
overridden on a per-link basis in the network topology.";
}
leaf polarization-mode-dispersion {
type pmd {
range "0 .. 5";
}
mandatory true;
description "Polarization mode dispersion (PMD) penalty of the express path within this ROADM model";
}
leaf-list compatible-preamp {
type leafref {
path "/tip-pe:amplifier/type";
}
description "A set of allowed amplifier types to be used in the ingress direction
If empty, autodesign is allowed to pick any amplifier as a preamp.";
}
leaf-list compatible-booster {
type leafref {
path "/tip-pe:amplifier/type";
}
description "A set of allowed amplifier types to be used in the egress direction
If empty, autodesign is allowed to pick any amplifier as a booster.";
}
}
}

View File

@@ -0,0 +1,244 @@
module tip-photonic-simulation {
yang-version 1.1;
namespace "https://oopt.telecominfraproject.com/yang/simulation";
prefix "tip-sim";
import tip-photonic-equipment {
prefix tip-pe;
revision-date 2020-09-01;
}
organization "Telecom Infrastructure Project";
contact "https://github.com/Telecominfraproject/oopt-gnpy";
description "Simulation settings for GNPy";
revision 2020-09-01 {
description "Initial release";
reference "Internal documentation";
}
container simulation {
presence "Activates a GNPy simulation";
description "Simulation settings and per-run input parameters";
choice spectrum {
mandatory true;
description "Spectral load for planning considerations
This is the channel allocation for which GNPy will optimize. It should represent the end-of-life spectrum allocation.";
case grid {
container grid {
description "Homogeneous channel allocation on a fixed grid";
leaf frequency-min {
type tip-pe:carrier-frequency;
default 191.35;
description "Central frequency of the first (lowest) channel";
}
leaf frequency-max {
type tip-pe:carrier-frequency;
default 196.1;
description "Central frequency of the last (highest) channel";
}
leaf spacing {
type tip-pe:frequency-channel-spacing;
default 50.0;
description "Grid spacing";
}
leaf baud-rate {
type tip-pe:baud-rate;
mandatory true;
description "Symbol baud rate";
}
leaf tx-osnr {
type tip-pe:db-ratio;
mandatory true;
description "Transponder TX signal OSNR";
}
leaf tx-roll-off {
type tip-pe:roll-off;
mandatory true;
description "Roll-off parameter (β) of the TX pulse shaping filter. This assumes a raised-cosine filter.";
}
leaf power {
type tip-pe:power;
mandatory true;
description "";
}
}
}
}
container autodesign {
description "Optimization parameters";
choice edfa-gain-strategy {
mandatory true;
description "Optimization strategy for setting amplifier operating mode";
case power-mode {
container power-mode {
description "Whatever GNPy power-mode actually means"; // FIXME
container power-sweep {
presence "Vary the initial launch power";
description "Varying the initial launch power";
leaf start {
type tip-pe:db-ratio;
mandatory true;
description "Initial delta from the reference power when determining the best initial launch power";
}
leaf stop {
type tip-pe:db-ratio;
mandatory true;
description "Final delta from the reference power when determining the best initial launch power";
}
leaf step-size {
type tip-pe:db-ratio;
mandatory true;
description "Step size when determining the best initial launch power";
}
}
}
}
case gain-mode {
leaf gain-mode {
type empty;
mandatory true;
// FIXME: describe this
description "Set EDFA gain based on previous span loss
For all EDFAs whose gain has not been set manually, set the gain based on the following rules:
1) Set gain to the preceding span loss.
2) Offset the gains around the reference power (FIXME: what does it mean?
This will leave the gain of EDFAs which have their gains set manually in the network topology unchanged.";
}
}
}
container power-adjustment-for-span-loss {
description "Adjusting launch power depending on a span loss
When in effect, lanuch powers to spans are adjusted based on the total span loss. The span loss is
compared to a reference span of 20dB, and the launch power is adjusted by about 0.3 * loss_difference,
up to a provided maximal adjustment.
This adjustment is performed for all spans when running in the `power-mode`. When in `gain-mode`,
it affects only EDFAs which do not have an explicitly assigned `delta-p`.
";
leaf maximal-reduction {
type tip-pe:power;
mandatory true;
description "Launch power might be reduced by up to this many dB on \"short\" spans";
}
leaf maximal-boost {
type tip-pe:power;
mandatory true;
description "Launch power might be increased by up to this many dB on lossy spans";
}
leaf excursion-step-size {
type tip-pe:power;
mandatory true;
description "Step size when increasing/decreasing the launch power";
}
}
leaf-list allowed-inline-edfa {
type leafref {
path "/tip-pe:amplifier/tip-pe:type";
}
description "Allowed EDFA types to be used as inline amplifiers";
}
leaf maximal-span-length {
type uint16 {
range 10..300;
}
units "km";
default 100;
description "Distance threshold for inserting amplifiers into tentative links
When working with not-fully-specified fiber links (tentative links), keep the individual fiber below this length. Extra
inline amplifiers will be automatically inserted in between.";
}
}
leaf system-margin {
type tip-pe:power {
range 0..10;
}
default 2;
description "Require this many dBm of GSNR headroom as a safety margin for End-of-Life component deterioration";
}
leaf edfa-maximal-extended-power {
type tip-pe:power {
range 0..6;
}
default 2.5;
status deprecated; // FIXME: move this into /tip-photonic-equipment:amplifier once the backend accounts for that argument
description "Allow up to this many dB increase of an amplifier's gain into its extended power range";
}
leaf shortest-span-without-extra-attenuation {
type tip-pe:db-ratio;
default 10.0;
description "When a fiber span has a lower attenuation than this, automatically insert an attenuator at its beginning";
}
container nli {
description "Non-linear interference (NLI) simulation options";
leaf algorithm {
type enumeration {
enum analytic-gn-model {
description ""; // FIXME: to be filed by Polito
}
enum generalized-gn-spectrally-separated {
description ""; // FIXME: to be filed by Polito
}
}
default generalized-gn-spectrally-separated;
description "What simulation model to use for calculating NLI contribution to the GSNR";
}
container raman {
presence "If present, enable Raman-aware simulation";
description "Global options for Raman-aware simulation";
// FIXME: this really needs docs! CHeck with Alessio and Andrea et al
// FIXME: space-resolution
}
// FIXME: grid-size
// FIXME: dispersion-tolerance
// FIXME: phase-shift-tolerance
// FIXME: computed-channels
}
}
augment "/tip-pe:transceiver/tip-pe:mode" {
description "Transponder mode selection: cost of a particular mode";
leaf cost {
type uint32;
units "Arbitrary units";
default 1;
description "Cost of selecting this mode when determining path feasibility";
}
}
}

View File

@@ -0,0 +1,330 @@
module tip-photonic-topology {
yang-version 1.1;
namespace "https://oopt.telecominfraproject.com/yang/topology";
prefix "tip-topo";
import tip-photonic-equipment {
prefix tip-pe;
revision-date 2020-09-01;
}
import tip-photonic-simulation {
prefix tip-sim;
revision-date 2020-09-01;
}
import ietf-network {
prefix nw;
revision-date 2018-02-26;
}
import ietf-network-topology {
prefix nt;
revision-date 2018-02-26;
}
organization "Telecom Infrastructure Project";
contact "https://github.com/Telecominfraproject/oopt-gnpy";
description "Network topology for simulating signal propagation via the OOPT-PSE GNPy tool";
revision 2020-09-01 {
description "Initial release";
reference "Internal documentation";
}
augment "/nw:networks/nw:network/nw:network-types" {
description "Telecom Infra Project Open Optical Packet Transport Photonic Simulation Environment";
container photonic-topology {
presence "indicates topology describing optical elements";
description "The presence of this container indicates a topology with optical elements";
}
}
grouping link-common-properties {
description "Common fiber parameters which are always known, even when performing autodesign and inserting amplifiers";
leaf type {
type leafref {
path "/tip-pe:fiber/tip-pe:type";
}
mandatory true;
description "Fiber type cross-reference";
}
leaf length {
type decimal64 {
fraction-digits 3;
}
units "km";
mandatory true;
description "Length of the fiber segment";
}
}
augment "/nw:networks/nw:network/nt:link" {
when "../nw:network-types/tip-topo:photonic-topology";
description "Connections of optical components";
// Unfortunately, ietf-network-topology has `require-instance: false` for source and target nodes, and
// the YANG standard doesn't even allow a deviation to override this.
// Also, a `must` statement is not allowed here, and also not in the `choice` statement. One could do a
// `when` deviation`, but that one produced non-intuitive error messages.
// So we have three copies of that superficial `must`, yay.
choice link-type {
description "Is this a well-specified fiber, or a link that should be optimized?";
case tentative-link {
container tentative-link {
must "count(deref(../nt:source/nt:source-node)) = 1" {
error-message "ietf-network-topology:source/source-node must point to a defined node";
}
must "count(deref(../nt:destination/nt:dest-node)) = 1" {
error-message "ietf-network-topology:destination/dest-node must point to a defined node";
}
description "A link where GNPy is expected to inject amplifiers where needed";
uses link-common-properties;
}
}
case fiber {
container fiber {
must "count(deref(../nt:source/nt:source-node)) = 1" {
error-message "ietf-network-topology:source/source-node must point to a defined node";
}
must "count(deref(../nt:destination/nt:dest-node)) = 1" {
error-message "ietf-network-topology:destination/dest-node must point to a defined node";
}
description "Fiber connection
This signifies a fiber whose length is already known. No amplifier huts are available, and the fiber will be used as-is.";
uses link-common-properties;
leaf loss-per-km {
type decimal64 {
fraction-digits 6;
range "0..10";
}
units "dB/km";
default 0.2;
description "Attenuation per kilometer of fiber";
// FIXME: should we just put total attenuation of that fiber in?
}
leaf attenuation-in {
type tip-pe:db-ratio {
range "0..100";
}
default 0;
description "Extra fixed attenuator at the beginning of the fiber";
}
leaf conn-att-in {
type tip-pe:db-ratio {
range "0..100";
}
default 0;
description "Attenuation of the connector at the fiber's beginning";
}
leaf conn-att-out {
type tip-pe:db-ratio {
range "0..100";
}
default 0;
description "Attenuation of the connector at the fiber's end";
}
container raman {
must "count(/tip-sim:simulation/tip-sim:nli/tip-sim:raman) = 1" {
error-message "Raman-aware fiber requires a Raman-aware model in global simulation parameters";
}
must "count(deref(../type)/../tip-pe:raman-efficiency) > 0" {
error-message "Raman simulation requires specification of fiber's Raman efficiency in the equipment library";
}
presence "If present, activate Raman-aware modeling for this fiber";
description "Raman parameters: SRS awareness and explicit pumping";
leaf temperature {
type uint16 {
range 273..373;
}
units "K";
mandatory true;
description "Temperature of the fiber";
}
list pump {
key "frequency";
leaf frequency {
type tip-pe:frequency-raman-pump;
mandatory true;
description "Frequency of this Raman pump laser";
}
leaf power {
type tip-pe:power;
mandatory true;
description "Pumping power";
}
leaf direction {
type enumeration {
enum co-propagating {
description "Co-propagating Raman pump pumps the power in the same direction as the carried optical signal payload";
}
enum counter-propagating {
description "Coounter-propagating Raman pump pumps the power in the opposite direction to the carried optical signal payload";
}
}
mandatory true;
description "Direction of propagation of this Raman pump";
}
description "Raman pump lasers";
}
}
}
}
case patch {
container patch {
must "count(deref(../nt:source/nt:source-node)) = 1" {
error-message "ietf-network-topology:source/source-node must point to a defined node";
}
must "count(deref(../nt:destination/nt:dest-node)) = 1" {
error-message "ietf-network-topology:destination/dest-node must point to a defined node";
}
// FIXME: check booster/preamp restrictions for ROADMs
description "Direct connection between network elements
A direct patch cord is a special case of fiber. It is assumed to be very short (a hundred meters at most) so that the
effect of NLI is limited, and that there's negligible attenuation.";
leaf roadm-target-egress-per-channel-power {
when "count(deref(../../nt:source/nt:source-node)/../roadm) > 0";
type tip-pe:power;
description "Per-channel tar egress power for signals exiting the ROADM over this link";
}
}
}
}
}
augment "/nw:networks/nw:network/nw:node" {
when "../nw:network-types/tip-topo:photonic-topology";
description "Optical elements within a network";
choice element {
mandatory true;
description "A physical instance of something";
case amplifier-placeholder {
leaf amplifier-placeholder {
type empty;
mandatory true;
description "Intent to place an amplifier, to be replaced by GNPy's autodesign with a specific model";
}
}
case amplifier {
container amplifier {
description "Amplifier";
leaf model {
type leafref {
path "/tip-pe:amplifier/tip-pe:type";
}
mandatory true;
description "Amplifier model cross-reference";
}
leaf gain-target {
type tip-pe:gain;
description "Desired gain of the amplifier
If not set, GNPy will try to find an optimal operating point.";
}
leaf out-voa-target {
// when "deref(../model)/has-output-voa"; FIXME: implement this
type tip-pe:db-ratio;
description "Output VOA setting
If not set, GNPy will try to find an optimal operating point -- which means operating the EDFA at its highest gain
for the lowest NF, and using the output VOA to compensate.";
}
leaf tilt-target {
type tip-pe:db-ratio;
// FIXME: make this available only when the amplifier model supports tilt settings
description "Desired tilt of the amplifier";
}
leaf delta-p {
type tip-pe:db-ratio;
description "FIXME: GNPy magic parameter."; // FIXME: describe this
}
}
}
case attenuator {
container attenuator {
description "Excessive attenuation
Use this construct for slicing together longer segments of fiber. For shorter connections,
use an `nt:link` with a `patch`. Do not put an `attenuator` in between of two `nt:link`, `patch` connections.";
leaf attenuation {
type tip-pe:db-ratio;
default 0;
description "Attenuator loss";
}
}
}
case transceiver {
container transceiver {
description "Transceiver";
leaf model {
type leafref {
path "/tip-pe:transceiver/tip-pe:type";
}
mandatory true;
description "Transceiver model, a cross-reference to the equipment library";
}
}
}
case roadm {
container roadm {
description "ROADM";
leaf model {
type leafref {
path "/tip-pe:roadm/tip-pe:type";
}
mandatory true;
description "ROADM model, a cross-reference to the equipment library";
}
leaf target-egress-per-channel-power {
type tip-pe:power;
description "Per-channel target egress power for signals exiting the ROADM
This can be overriden on a per-link basis via patch/roadm-target-egress-per-channel-power.";
}
}
}
}
}
}

55
gnpy/yang/yanglib.json Normal file
View File

@@ -0,0 +1,55 @@
{
"ietf-yang-library:modules-state": {
"module-set-id": "",
"module": [
{
"name": "ietf-inet-types",
"revision": "2013-07-15",
"namespace": "urn:ietf:params:xml:ns:yang:ietf-inet-types",
"conformance-type": "import"
},
{
"name": "ietf-yang-types",
"revision": "2013-07-15",
"namespace": "urn:ietf:params:xml:ns:yang:ietf-yang-types",
"conformance-type": "import"
},
{
"name": "ietf-network-topology",
"revision": "2018-02-26",
"namespace": "urn:ietf:params:xml:ns:yang:ietf-network-topology",
"conformance-type": "implement"
},
{
"name": "ietf-network",
"revision": "2018-02-26",
"namespace": "urn:ietf:params:xml:ns:yang:ietf-network",
"conformance-type": "implement"
},
{
"name": "tip-photonic-equipment",
"revision": "2020-09-01",
"namespace": "https://oopt.telecominfraproject.com/yang/equipment",
"conformance-type": "implement"
},
{
"name": "tip-photonic-topology",
"revision": "2020-09-01",
"namespace": "https://oopt.telecominfraproject.com/yang/topology",
"conformance-type": "implement"
},
{
"name": "tip-photonic-simulation",
"revision": "2020-09-01",
"namespace": "https://oopt.telecominfraproject.com/yang/simulation",
"conformance-type": "implement"
},
{
"name": "tip-onos-topology",
"revision": "2021-06-06",
"namespace": "https://oopt.telecominfraproject.com/yang/onos-topology",
"conformance-type": "implement"
}
]
}
}

10
requirements.txt Normal file
View File

@@ -0,0 +1,10 @@
flask>=2.0.1,<3
matplotlib>=3.3.3,<4
networkx>=2.5,<3
numpy>=1.19.4,<2
pandas>=1.1.5,<2
pbr>=5.5.1,<6
pyang>=2.4.0,<3
scipy>=1.5.4,<2
xlrd>=1.2.0,<2
yangson>=1.4.8,<2

View File

@@ -1,9 +1,10 @@
[metadata]
name = gnpy
description-file = README.md
description-content-type = text/markdown; variant=GFM
description = Route planning and optimization tool for mesh optical networks
description-file = README.rst
description-content-type = text/x-rst; charset=UTF-8
author = Telecom Infra Project
author-email = jkt@jankundrat.com
author-email = jan.kundrat@telecominfraproject.com
license = BSD-3-Clause
home-page = https://github.com/Telecominfraproject/oopt-gnpy
project_urls =
@@ -21,9 +22,6 @@ classifier =
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Physics
@@ -42,6 +40,9 @@ warnerrors = True
[files]
packages = gnpy
data_files =
examples = examples/*
# FIXME: solve example data files
[options.entry_points]
console_scripts =
@@ -49,35 +50,4 @@ console_scripts =
gnpy-transmission-example = gnpy.tools.cli_examples:transmission_main_example
gnpy-path-request = gnpy.tools.cli_examples:path_requests_run
gnpy-convert-xls = gnpy.tools.convert:_do_convert
[options]
install_requires =
# matplotlib 3.8 removed support for Python 3.8
matplotlib>=3.7.3,<4
# networkx 3.2 removed support for Python 3.8
networkx>=3.1,<4
# numpy 1.25 removed support for Python 3.8
numpy>=1.24.4,<2
pbr>=6.0.0,<7
# scipy 1.11 removed support for Python 3.8
scipy>=1.10.1,<2
# xlrd 2.x removed support for .xlsx, it's only .xls now
xlrd>=1.2.0,<2
[options.extras_require]
tests =
build>=1.0.3,<2
pytest>=7.4.3,<8
# pandas 2.1 removed support for Python 3.8
pandas>=2.0.3,<3
# flake v6 killed the --diff option
flake8>=5.0.4,<6
docs =
alabaster>=0.7.12,<1
docutils>=0.17.1,<1
myst-parser>=0.16.1,<1
Pygments>=2.11.2,<3
rstcheck
Sphinx>=5.3.0,<6
sphinxcontrib-bibtex>=2.4.1,<3
gnpy-convert-to-yang = gnpy.tools.cli_examples:convert_to_yang

135
tests/compare.py Normal file
View File

@@ -0,0 +1,135 @@
#!/usr/bin/env python3
from json import dump
from pathlib import Path
from argparse import ArgumentParser
from collections import namedtuple
from gnpy.tools.json_io import load_json
class Results(namedtuple('Results', 'missing extra different expected actual')):
def _asdict(self):
return {'missing': self.missing,
'extra': self.extra,
'different': self.different}
def __str__(self):
rv = []
if self.missing:
rv.append('Missing: {len(self.missing)}/{len(self.expected)}')
rv.extend(f'\t{x}' for x in sorted(self.missing))
if self.extra:
rv.append('Extra: {len(self.extra)}/{len(self.expected)}')
rv.extend(f'\t{x}' for x in sorted(self.extra))
if self.different:
rv.append('Different: {len(self.different)}/{len(self.expected)}')
rv.extend(f'\tExpected: {x}\n\tActual: {y}' for x, y in self.different)
if not self.missing and not self.extra and not self.different:
rv.append('All match!')
return '\n'.join(rv)
class NetworksResults(namedtuple('NetworksResult', 'elements connections')):
def _asdict(self):
return {'elements': self.elements._asdict(),
'connections': self.connections._asdict()}
def __str__(self):
return '\n'.join([
'Elements'.center(40, '='),
str(self.elements),
'Connections'.center(40, '='),
str(self.connections),
])
class ServicesResults(namedtuple('ServicesResult', 'requests synchronizations')):
def _asdict(self):
return {'requests': self.requests.asdict(),
'synchronizations': self.synchronizations.asdict()}
def __str__(self):
return '\n'.join([
'Requests'.center(40, '='),
str(self.requests),
'Synchronizations'.center(40, '='),
str(self.synchronizations),
])
class PathsResults(namedtuple('PathsResults', 'paths')):
def _asdict(self):
return {'paths': self.paths.asdict()}
def __str__(self):
return '\n'.join([
'Paths'.center(40, '='),
str(self.paths),
])
def compare(expected, actual, key=lambda x: x):
expected = {key(el): el for el in expected}
actual = {key(el): el for el in actual}
missing = set(expected) - set(actual)
extra = set(actual) - set(expected)
different = [(expected[x], actual[x]) for
x in set(expected) & set(actual)
if expected[x] != actual[x]]
return Results(missing, extra, different, expected, actual)
def compare_networks(expected, actual):
elements = compare(expected['elements'], actual['elements'],
key=lambda el: el['uid'])
connections = compare(expected['connections'], actual['connections'],
key=lambda el: (el['from_node'], el['to_node']))
return NetworksResults(elements, connections)
def compare_services(expected, actual):
requests = compare(expected['path-request'], actual['path-request'],
key=lambda el: el['request-id'])
synchronizations = compare(expected['path-request'], expected['path-request'],
key=lambda el: el['request-id'])
if 'synchronization' in expected.keys():
synchronizations = compare(expected['synchronization'], actual['synchronization'],
key=lambda el: el['synchronization-id'])
return ServicesResults(requests, synchronizations)
def compare_paths(expected_output, actual_output):
paths = compare(expected['path'], actual['path'], key=lambda el: el['path-id'])
return PathsResults(paths)
COMPARISONS = {
'networks': compare_networks,
'services': compare_services,
'paths': compare_paths,
}
parser = ArgumentParser()
parser.add_argument('expected_output', type=Path, metavar='FILE')
parser.add_argument('actual_output', type=Path, metavar='FILE')
parser.add_argument('-o', '--output', default=None)
parser.add_argument('-c', '--comparison', choices=COMPARISONS, default='networks')
def encode_sets(obj):
if isinstance(obj, set):
return list(obj)
raise TypeError(f'{obj!r} is not JSON serializable!')
if __name__ == '__main__':
args = parser.parse_args()
expected = load_json(args.expected_output)
actual = load_json(args.actual_output)
result = COMPARISONS[args.comparison](expected, actual)
if args.output:
with open(args.output, 'w', encoding='utf-8') as f:
dump(result, f, default=encode_sets, indent=2, ensure_ascii=False)
else:
print(str(result))

View File

@@ -1,13 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2020 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
#
import pytest
from gnpy.core.parameters import SimParams, NLIParams, RamanParams
@pytest.fixture
def set_sim_params(monkeypatch):
monkeypatch.setattr(SimParams, '_shared_dict', {'nli_params': NLIParams(), 'raman_params': RamanParams()})

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
{
"path-request": [
{
"request-id": "0",
"source": "trx Abilene",
"destination": "trx Albany",
"src-tp-id": "trx Abilene",
"dst-tp-id": "trx Albany",
"bidirectional": false,
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 3",
"spacing": 62500000000.0,
"path_bandwidth": 100000000000.0
}
}
}
]
}

View File

@@ -1,6 +1,4 @@
{
"f_min": 191.35e12,
"f_max": 196.1e12,
"nf_ripple": [
0.0,
0.0,
@@ -198,101 +196,101 @@
0.0
],
"dgt": [
1.0,
1.017807767853702,
1.0356155337864215,
1.0534217504465226,
1.0712204022764056,
1.0895983485572227,
1.108555289615659,
1.1280891949729075,
1.1476135933863398,
1.1672278304018044,
1.1869318618366975,
1.2067249615595257,
1.2264996957264114,
1.2428104897182262,
1.2556591482982988,
1.2650555289898042,
1.2744470198196236,
1.2838336236692311,
1.2932153453410835,
1.3040618749785347,
1.316383926863083,
1.3301807335621048,
1.3439818461440451,
1.3598972673004606,
1.3779439775587023,
1.3981208704326855,
1.418273806730323,
1.4340878115214444,
1.445565137158368,
1.45273959485914,
1.4599103316162523,
1.4670307626366115,
1.474100442252211,
1.48111939735681,
1.488134243479226,
1.495145456062699,
1.502153039909686,
1.5097346239790443,
1.5178910621476225,
1.5266220576235803,
1.5353620432989845,
1.545374152761467,
1.5566577309558969,
1.569199764184379,
1.5817353179379183,
1.5986915141218316,
1.6201194134191075,
1.6460167077689267,
1.6719047669939942,
1.6918150918099673,
1.7057507692361864,
1.7137640932265894,
1.7217732861435076,
1.7297783508684146,
1.737780757913635,
1.7459181197626403,
1.7541903672600494,
1.7625959636196327,
1.7709972329654864,
1.7793941781790852,
1.7877868031023945,
1.7961751115773796,
1.8045606557581335,
1.8139629377087627,
1.824381436842932,
1.835814081380705,
1.847275503201129,
1.862235672444246,
1.8806927939516411,
1.9026104247588487,
1.9245345552113182,
1.9482128147680253,
1.9736443063300082,
2.0008103857988204,
2.0279625371819305,
2.055100772005235,
2.082225099873648,
2.1183028432496016,
2.16337565384239,
2.2174389328192197,
2.271520771371253,
2.322373696229342,
2.3699990328716107,
2.414398437185221,
2.4587748041127506,
2.499446286796604,
2.5364027376452056,
2.5696460593920065,
2.602860350286428,
2.630396440815385,
2.6521732021128046,
2.6681935771243177,
2.6841217449620203,
2.6947834587664494,
2.714526681131686,
2.705443819238505,
2.714526681131686
2.6947834587664494,
2.6841217449620203,
2.6681935771243177,
2.6521732021128046,
2.630396440815385,
2.602860350286428,
2.5696460593920065,
2.5364027376452056,
2.499446286796604,
2.4587748041127506,
2.414398437185221,
2.3699990328716107,
2.322373696229342,
2.271520771371253,
2.2174389328192197,
2.16337565384239,
2.1183028432496016,
2.082225099873648,
2.055100772005235,
2.0279625371819305,
2.0008103857988204,
1.9736443063300082,
1.9482128147680253,
1.9245345552113182,
1.9026104247588487,
1.8806927939516411,
1.862235672444246,
1.847275503201129,
1.835814081380705,
1.824381436842932,
1.8139629377087627,
1.8045606557581335,
1.7961751115773796,
1.7877868031023945,
1.7793941781790852,
1.7709972329654864,
1.7625959636196327,
1.7541903672600494,
1.7459181197626403,
1.737780757913635,
1.7297783508684146,
1.7217732861435076,
1.7137640932265894,
1.7057507692361864,
1.6918150918099673,
1.6719047669939942,
1.6460167077689267,
1.6201194134191075,
1.5986915141218316,
1.5817353179379183,
1.569199764184379,
1.5566577309558969,
1.545374152761467,
1.5353620432989845,
1.5266220576235803,
1.5178910621476225,
1.5097346239790443,
1.502153039909686,
1.495145456062699,
1.488134243479226,
1.48111939735681,
1.474100442252211,
1.4670307626366115,
1.4599103316162523,
1.45273959485914,
1.445565137158368,
1.4340878115214444,
1.418273806730323,
1.3981208704326855,
1.3779439775587023,
1.3598972673004606,
1.3439818461440451,
1.3301807335621048,
1.316383926863083,
1.3040618749785347,
1.2932153453410835,
1.2838336236692311,
1.2744470198196236,
1.2650555289898042,
1.2556591482982988,
1.2428104897182262,
1.2264996957264114,
1.2067249615595257,
1.1869318618366975,
1.1672278304018044,
1.1476135933863398,
1.1280891949729075,
1.108555289615659,
1.0895983485572227,
1.0712204022764056,
1.0534217504465226,
1.0356155337864215,
1.017807767853702,
1.0
]
}
}

View File

@@ -1,5 +1,4 @@
{
"Edfa": [{
{ "Edfa":[{
"type_variety": "CienaDB_medium_gain",
"type_def": "advanced_model",
"gain_flatmax": 25,
@@ -8,9 +7,10 @@
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
"out_voa_auto": false,
"allowed_for_design": true
}, {
},
{
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 21,
@@ -18,9 +18,10 @@
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
}, {
},
{
"type_variety": "std_low_gain",
"type_def": "variable_gain",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 21,
@@ -28,7 +29,8 @@
"nf_max": 11,
"out_voa_auto": false,
"allowed_for_design": true
}, {
},
{
"type_variety": "test",
"type_def": "variable_gain",
"gain_flatmax": 25,
@@ -38,7 +40,8 @@
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
}, {
},
{
"type_variety": "test_fixed_gain",
"type_def": "fixed_gain",
"gain_flatmax": 21,
@@ -46,7 +49,8 @@
"p_max": 21,
"nf0": 5,
"allowed_for_design": true
}, {
},
{
"type_variety": "std_booster",
"type_def": "fixed_gain",
"gain_flatmax": 21,
@@ -54,18 +58,18 @@
"p_max": 21,
"nf0": 5,
"allowed_for_design": false
}
],
"Fiber": [{
}
],
"Fiber":[{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"gamma": 0.00127,
"pmd_coef": 1.265e-15
}
],
"Span": [{
"power_mode": true,
"delta_power_range_db": [0, 0, 0.5],
}
],
"Span":[{
"power_mode":true,
"delta_power_range_db": [0,0,0.5],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
@@ -75,218 +79,156 @@
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [{
"type_variety": "example_test",
"target_pch_out_db": -18,
"add_drop_osnr": 35,
"pmd": 1e-12,
"pdl": 0.5,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
},
"roadm-path-impairments": []
}, {
"type_variety": "example_detailed_impairments",
"target_pch_out_db": -20,
"add_drop_osnr": 35,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list":[],
"booster_variety_list":[]
},
"roadm-path-impairments": [
{
"roadm-path-impairments-id": 0,
"roadm-express-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
},
"roadm-pmd": 0,
"roadm-cd": 0,
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 16.5
}
]
}, {
"roadm-path-impairments-id": 1,
"roadm-add-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
},
"roadm-pmd": 0,
"roadm-cd": 0,
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 11.5,
"roadm-pmax": 2.5,
"roadm-osnr": 41,
"roadm-noise-figure": 23
}]
}, {
"roadm-path-impairments-id": 2,
"roadm-drop-path": [{
"frequency-range": {
"lower-frequency": 191.3e12,
"upper-frequency": 196.1e12
},
"roadm-pmd": 0,
"roadm-cd": 0,
"roadm-pdl": 0,
"roadm-inband-crosstalk": 0,
"roadm-maxloss": 11.5,
"roadm-minloss": 7.5,
"roadm-typloss": 10,
"roadm-pmin": -13.5,
"roadm-pmax": -9.5,
"roadm-ptyp": -12,
"roadm-osnr": 41,
"roadm-noise-figure": 15
}]
}]
}, {
}
],
"Roadm":[{
"target_pch_out_db": -20,
"add_drop_osnr": 38,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
}
}
],
"SI": [{
"preamp_variety_list":[],
"booster_variety_list":[]
}
}],
"SI":[{
"f_min": 191.3e12,
"f_max": 196.1e12,
"f_max":196.1e12,
"baud_rate": 32e9,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [0, 0, 0.5],
"power_range_db": [0,0,0.5],
"roll_off": 0.15,
"tx_osnr": 100,
"sys_margins": 0
"sys_margins": 0
}],
"Transceiver":[
{
"type_variety": "vendorA_trx-type1",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "PS_SP64_1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost":1
},
{
"format": "PS_SP64_2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost":1
}
]
},
"mode": [{
"format": "PS_SP64_1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "PS_SP64_2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "mode 2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}
]
}, {
{
"type_variety": "Voyager_16QAM",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost":1
}
]
},
"mode": [{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}
]
}, {
{
"type_variety": "Voyager",
"frequency": {
"min": 191.35e12,
"max": 196.1e12
},
"mode": [{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 62.5e9,
"cost": 1
}, {
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 2 - fake",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}
]
}
]
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 50e9,
"cost":1
},
{
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 62.5e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 2 - fake",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost":1
}
]
}
]
}

View File

@@ -1,220 +0,0 @@
{
"Edfa": [{
"type_variety": "CienaDB_medium_gain",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 21,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "std_low_gain",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 21,
"nf_min": 7,
"nf_max": 11,
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "test",
"type_def": "variable_gain",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"nf_min": 5.8,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "test_fixed_gain",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5,
"allowed_for_design": true
}, {
"type_variety": "std_booster",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5,
"allowed_for_design": false
}
],
"Fiber": [{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
}
],
"Span": [{
"power_mode": true,
"delta_power_range_db": [0, 0, 0.5],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
"length_units": "km",
"max_loss": 28,
"padding": 10,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [{
"target_psd_out_mWperGHz": 3.125e-4,
"add_drop_osnr": 38,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
}
}
],
"SI": [{
"f_min": 191.35e12,
"f_max": 196.1e12,
"baud_rate": 32e9,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [0, 0, 0.5],
"roll_off": 0.15,
"tx_osnr": 100,
"sys_margins": 0
}
],
"Transceiver": [{
"type_variety": "vendorA_trx-type1",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [{
"format": "PS_SP64_1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "PS_SP64_2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "mode 2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}
]
}, {
"type_variety": "Voyager_16QAM",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}
]
}, {
"type_variety": "Voyager",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 62.5e9,
"cost": 1
}, {
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 2 - fake",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}
]
}
]
}

View File

@@ -1,220 +0,0 @@
{
"Edfa": [{
"type_variety": "CienaDB_medium_gain",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 21,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "std_low_gain",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 21,
"nf_min": 7,
"nf_max": 11,
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "test",
"type_def": "variable_gain",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"nf_min": 5.8,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
}, {
"type_variety": "test_fixed_gain",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5,
"allowed_for_design": true
}, {
"type_variety": "std_booster",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5,
"allowed_for_design": false
}
],
"Fiber": [{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
}
],
"Span": [{
"power_mode": true,
"delta_power_range_db": [0, 0, 0.5],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
"length_units": "km",
"max_loss": 28,
"padding": 10,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [{
"target_out_mWperSlotWidth": 2.0e-4,
"add_drop_osnr": 38,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
}
}
],
"SI": [{
"f_min": 191.35e12,
"f_max": 196.1e12,
"baud_rate": 32e9,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [0, 0, 0.5],
"roll_off": 0.15,
"tx_osnr": 100,
"sys_margins": 0
}
],
"Transceiver": [{
"type_variety": "vendorA_trx-type1",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [{
"format": "PS_SP64_1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "PS_SP64_2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "mode 2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}
]
}, {
"type_variety": "Voyager_16QAM",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}
]
}, {
"type_variety": "Voyager",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 50e9,
"cost": 1
}, {
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 62.5e9,
"cost": 1
}, {
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 2 - fake",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}, {
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}
]
}
]
}

View File

@@ -1,238 +0,0 @@
{
"Edfa": [{
"type_variety": "CienaDB_medium_gain",
"type_def": "advanced_model",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
"gain_min": 15,
"p_max": 21,
"nf_min": 6,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "std_low_gain",
"type_def": "variable_gain",
"gain_flatmax": 16,
"gain_min": 8,
"p_max": 21,
"nf_min": 7,
"nf_max": 11,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "test",
"type_def": "variable_gain",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"nf_min": 5.8,
"nf_max": 10,
"out_voa_auto": false,
"allowed_for_design": true
},
{
"type_variety": "test_fixed_gain",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5,
"allowed_for_design": true
},
{
"type_variety": "std_booster",
"type_def": "fixed_gain",
"gain_flatmax": 21,
"gain_min": 20,
"p_max": 21,
"nf0": 5,
"allowed_for_design": false
}
],
"Fiber": [{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"effective_area": 83e-12,
"pmd_coef": 1.265e-15
}
],
"Span": [{
"power_mode":true,
"delta_power_range_db": [0,0,0.5],
"max_fiber_lineic_loss_for_raman": 0.25,
"target_extended_gain": 2.5,
"max_length": 150,
"length_units": "km",
"max_loss": 28,
"padding": 10,
"EOL": 0,
"con_in": 0,
"con_out": 0
}
],
"Roadm": [{
"target_pch_out_db": -20,
"add_drop_osnr": 38,
"pmd": 0,
"pdl": 0,
"restrictions": {
"preamp_variety_list":[],
"booster_variety_list":[]
}
}
],
"SI": [{
"f_min": 191.35e12,
"f_max": 196.1e12,
"baud_rate": 32e9,
"spacing": 50e9,
"power_dbm": 0,
"power_range_db": [-6,0,0.5],
"roll_off": 0.15,
"tx_osnr": 100,
"sys_margins": 0
}
],
"Transceiver":[
{
"type_variety": "vendorA_trx-type1",
"frequency":{
"min": 191.4e12,
"max": 196.1e12
},
"mode":[
{
"format": "PS_SP64_1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
},
{
"format": "PS_SP64_2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
},
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
},
{
"format": "mode 2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost": 1
}
]
},
{
"type_variety": "Voyager_16QAM",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [
{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost": 1
}
]
},
{
"type_variety": "Voyager",
"frequency": {
"min": 191.4e12,
"max": 196.1e12
},
"mode": [
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 50e9,
"cost": 1
},
{
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 62.5e9,
"cost": 1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
},
{
"format": "mode 2 - fake",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
},
{
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost": 1
}
]
}
]
}

View File

@@ -63,7 +63,6 @@
{
"uid": "roadm Lannion_CAS",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -18.6,
"restrictions": {
@@ -88,7 +87,6 @@
{
"uid": "roadm Lorient_KMA",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -113,7 +111,6 @@
{
"uid": "roadm Vannes_KBE",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -137,7 +134,6 @@
{
"uid": "roadm Rennes_STA",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -161,7 +157,6 @@
{
"uid": "roadm Brest_KLA",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -1673,4 +1668,4 @@
"to_node": "fiber (Ploermel → Vannes_KBE)-"
}
]
}
}

View File

@@ -0,0 +1,224 @@
{
"uid": "Span1",
"params": {
"length": 80,
"loss_coef": 0.2,
"length_units": "km",
"att_in": 0,
"con_in": 0.5,
"con_out": 0.5,
"type_variety": "SSMF",
"dispersion": 0.0000167,
"gamma": 0.00127,
"pmd_coef": 1.265e-15,
"raman_efficiency": {
"cr": [
0,
0.0000094,
0.0000292,
0.0000488,
0.0000682,
0.0000831,
0.000094,
0.0001014,
0.0001069,
0.0001119,
0.0001217,
0.0001268,
0.0001365,
0.000149,
0.000165,
0.000181,
0.0001977,
0.0002192,
0.0002469,
0.0002749,
0.0002999,
0.0003206,
0.0003405,
0.0003592,
0.000374,
0.0003826,
0.0003841,
0.0003826,
0.0003802,
0.0003756,
0.0003549,
0.0003795,
0.000344,
0.0002933,
0.0002024,
0.0001158,
0.0000846,
0.0000714,
0.0000686,
0.000085,
0.0000893,
0.0000901,
0.0000815,
0.0000667,
0.0000437,
0.0000328,
0.0000296,
0.0000265,
0.0000257,
0.0000281,
0.0000308,
0.0000367,
0.0000585,
0.0000663,
0.0000636,
0.000055,
0.0000406,
0.0000277,
0.0000242,
0.0000187,
0.000016,
0.000014,
0.0000113,
0.0000105,
0.0000098,
0.0000098,
0.0000113,
0.0000164,
0.0000195,
0.0000238,
0.0000226,
0.0000203,
0.0000148,
0.0000109,
0.0000098,
0.0000105,
0.0000117,
0.0000125,
0.0000121,
0.0000109,
0.0000098,
0.0000082,
0.0000066,
0.0000047,
0.0000027,
0.0000019,
0.0000012,
4e-7,
2e-7,
1e-7
],
"frequency_offset": [
0,
500000000000,
1000000000000,
1500000000000,
2000000000000,
2500000000000,
3000000000000,
3500000000000,
4000000000000,
4500000000000,
5000000000000,
5500000000000,
6000000000000,
6500000000000,
7000000000000,
7500000000000,
8000000000000,
8500000000000,
9000000000000,
9500000000000,
10000000000000,
10500000000000,
11000000000000,
11500000000000,
12000000000000,
12500000000000,
12750000000000,
13000000000000,
13250000000000,
13500000000000,
14000000000000,
14500000000000,
14750000000000,
15000000000000,
15500000000000,
16000000000000,
16500000000000,
17000000000000,
17500000000000,
18000000000000,
18250000000000,
18500000000000,
18750000000000,
19000000000000,
19500000000000,
20000000000000,
20500000000000,
21000000000000,
21500000000000,
22000000000000,
22500000000000,
23000000000000,
23500000000000,
24000000000000,
24500000000000,
25000000000000,
25500000000000,
26000000000000,
26500000000000,
27000000000000,
27500000000000,
28000000000000,
28500000000000,
29000000000000,
29500000000000,
30000000000000,
30500000000000,
31000000000000,
31500000000000,
32000000000000,
32500000000000,
33000000000000,
33500000000000,
34000000000000,
34500000000000,
35000000000000,
35500000000000,
36000000000000,
36500000000000,
37000000000000,
37500000000000,
38000000000000,
38500000000000,
39000000000000,
39500000000000,
40000000000000,
40500000000000,
41000000000000,
41500000000000,
42000000000000
]
}
},
"operational": {
"temperature": 283,
"raman_pumps": [
{
"power": 0.2,
"frequency": 205000000000000,
"propagation_direction": "counterprop"
},
{
"power": 0.206,
"frequency": 201000000000000,
"propagation_direction": "counterprop"
}
]
},
"metadata": {
"location": {
"latitude": 1,
"longitude": 0,
"city": null,
"region": ""
}
}
}

View File

@@ -1,13 +1,14 @@
{
"raman_params": {
"flag": true,
"result_spatial_resolution": 10e3,
"solver_spatial_resolution": 50
"raman_parameters": {
"flag_raman": true,
"space_resolution": 10e3,
"tolerance": 1e-8
},
"nli_params": {
"method": "ggn_spectrally_separated",
"nli_parameters": {
"nli_method_name": "ggn_spectrally_separated",
"wdm_grid_size": 50e9,
"dispersion_tolerance": 1,
"phase_shift_tolerance": 0.1,
"computed_channels": [1, 18, 37, 56, 75]
}
}
}

View File

@@ -14,8 +14,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -39,8 +39,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -64,8 +64,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,

View File

@@ -159,7 +159,6 @@
{
"uid": "roadm Lannion_CAS",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -184,7 +183,6 @@
{
"uid": "roadm Lorient_KMA",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -209,7 +207,6 @@
{
"uid": "roadm Vannes_KBE",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -233,7 +230,6 @@
{
"uid": "roadm Rennes_STA",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -244,6 +240,7 @@
"east edfa in Rennes_STA to Stbrieuc": -20,
"east edfa in Rennes_STA to Ploermel": -20
}
},
"metadata": {
"location": {
@@ -257,7 +254,6 @@
{
"uid": "roadm Brest_KLA",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -281,7 +277,6 @@
{
"uid": "roadm a",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -307,7 +302,6 @@
{
"uid": "roadm b",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -316,7 +310,7 @@
],
"booster_variety_list": []
},
"per_degree_pch_out_db": {
"per_degree_pch_out_db":{
"east edfa in b to a": -20,
"east edfa in b to f": -20
}
@@ -333,14 +327,13 @@
{
"uid": "roadm c",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
"preamp_variety_list": [],
"booster_variety_list": []
},
"per_degree_pch_out_db": {
"per_degree_pch_out_db":{
"east edfa in c to a": -20,
"east edfa in c to d": -20,
"east edfa in c to f": -20
@@ -358,7 +351,6 @@
{
"uid": "roadm d",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -382,7 +374,6 @@
{
"uid": "roadm e",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -406,7 +397,6 @@
{
"uid": "roadm f",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -431,7 +421,6 @@
{
"uid": "roadm g",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -441,7 +430,7 @@
"per_degree_pch_out_db": {
"east edfa in g to e": -20,
"east edfa in g to h": -20
}
}
},
"metadata": {
"location": {
@@ -455,7 +444,6 @@
{
"uid": "roadm h",
"type": "Roadm",
"type_variety": "default",
"params": {
"target_pch_out_db": -20,
"restrictions": {
@@ -1605,7 +1593,7 @@
"type": "Edfa",
"type_variety": "std_medium_gain",
"operational": {
"gain_target": 13.177288,
"gain_target": 18.5,
"delta_p": null,
"tilt_target": 0,
"out_voa": 0
@@ -2247,7 +2235,7 @@
"type": "Edfa",
"type_variety": "std_low_gain",
"operational": {
"gain_target": 11.822712,
"gain_target": 6.5,
"delta_p": null,
"tilt_target": 0,
"out_voa": 0
@@ -2304,7 +2292,7 @@
"type": "Edfa",
"type_variety": "std_low_gain",
"operational": {
"gain_target": 13.822712,
"gain_target": 13.82,
"delta_p": null,
"tilt_target": 0,
"out_voa": 0
@@ -2323,7 +2311,7 @@
"type": "Edfa",
"type_variety": "test_fixed_gain",
"operational": {
"gain_target": 15.177288,
"gain_target": 15.18,
"delta_p": null,
"tilt_target": 0,
"out_voa": 0

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
response-id,source,destination,path_bandwidth,Pass?,nb of tsp pairs,total cost,transponder-type,transponder-mode,OSNR-0.1nm,SNR-0.1nm,SNR-bandwidth,baud rate (Gbaud),input power (dBm),path,"spectrum (N,M)",reversed path OSNR-0.1nm,reversed path SNR-0.1nm,reversed path SNR-bandwidth
0,trx Lorient_KMA,trx Vannes_KBE,100.0,True,1,1,Voyager,mode 1,30.84,30.84,26.75,32.0,0.0,trx Lorient_KMA | roadm Lorient_KMA | east edfa in Lorient_KMA to Vannes_KBE | fiber (Lorient_KMA → Vannes_KBE)-F055 | west edfa in Vannes_KBE to Lorient_KMA | roadm Vannes_KBE | trx Vannes_KBE,"[-284], [4]",,,
1,trx Brest_KLA,trx Vannes_KBE,10.0,True,1,1,Voyager,mode 1,22.65,22.11,18.03,32.0,1.0,trx Brest_KLA | roadm Brest_KLA | east edfa in Brest_KLA to Morlaix | fiber (Brest_KLA → Morlaix)-F060 | east fused spans in Morlaix | fiber (Morlaix → Lannion_CAS)-F059 | west edfa in Lannion_CAS to Morlaix | roadm Lannion_CAS | east edfa in Lannion_CAS to Corlay | fiber (Lannion_CAS → Corlay)-F061 | west fused spans in Corlay | fiber (Corlay → Loudeac)-F010 | west fused spans in Loudeac | fiber (Loudeac → Lorient_KMA)-F054 | west edfa in Lorient_KMA to Loudeac | roadm Lorient_KMA | east edfa in Lorient_KMA to Vannes_KBE | fiber (Lorient_KMA → Vannes_KBE)-F055 | west edfa in Vannes_KBE to Lorient_KMA | roadm Vannes_KBE | trx Vannes_KBE,"[-276], [4]",,,
3,trx Lannion_CAS,trx Rennes_STA,60.0,True,1,1,vendorA_trx-type1,mode 1,28.29,25.85,21.77,32.0,1.0,trx Lannion_CAS | roadm Lannion_CAS | east edfa in Lannion_CAS to Stbrieuc | fiber (Lannion_CAS → Stbrieuc)-F056 | east edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Rennes_STA)-F057 | west edfa in Rennes_STA to Stbrieuc | roadm Rennes_STA | trx Rennes_STA,"[-284], [4]",,,
4,trx Rennes_STA,trx Lannion_CAS,150.0,True,1,1,vendorA_trx-type1,mode 2,22.27,22.14,15.05,64.0,0.0,trx Rennes_STA | roadm Rennes_STA | east edfa in Rennes_STA to Ploermel | fiber (Rennes_STA → Ploermel)- | east edfa in Ploermel to Vannes_KBE | fiber (Ploermel → Vannes_KBE)- | west edfa in Vannes_KBE to Ploermel | roadm Vannes_KBE | east edfa in Vannes_KBE to Lorient_KMA | fiber (Vannes_KBE → Lorient_KMA)-F055 | west edfa in Lorient_KMA to Vannes_KBE | roadm Lorient_KMA | east edfa in Lorient_KMA to Loudeac | fiber (Lorient_KMA → Loudeac)-F054 | east fused spans in Loudeac | fiber (Loudeac → Corlay)-F010 | east fused spans in Corlay | fiber (Corlay → Lannion_CAS)-F061 | west edfa in Lannion_CAS to Corlay | roadm Lannion_CAS | trx Lannion_CAS,"[-266], [6]",,,
5,trx Rennes_STA,trx Lannion_CAS,20.0,True,1,1,vendorA_trx-type1,mode 2,30.79,28.76,21.67,64.0,3.0,trx Rennes_STA | roadm Rennes_STA | east edfa in Rennes_STA to Stbrieuc | fiber (Rennes_STA → Stbrieuc)-F057 | west edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Lannion_CAS)-F056 | west edfa in Lannion_CAS to Stbrieuc | roadm Lannion_CAS | trx Lannion_CAS,"[-274], [6]",,,
0,trx Lorient_KMA,trx Vannes_KBE,100.0,True,1,1,Voyager,mode 1,30.84,30.84,26.75,32.0,0.0,trx Lorient_KMA | roadm Lorient_KMA | east edfa in Lorient_KMA to Vannes_KBE | fiber (Lorient_KMA → Vannes_KBE)-F055 | west edfa in Vannes_KBE to Lorient_KMA | roadm Vannes_KBE | trx Vannes_KBE,"-284, 4",,,
1,trx Brest_KLA,trx Vannes_KBE,10.0,True,1,1,Voyager,mode 1,22.65,22.11,18.03,32.0,1.0,trx Brest_KLA | roadm Brest_KLA | east edfa in Brest_KLA to Morlaix | fiber (Brest_KLA → Morlaix)-F060 | east fused spans in Morlaix | fiber (Morlaix → Lannion_CAS)-F059 | west edfa in Lannion_CAS to Morlaix | roadm Lannion_CAS | east edfa in Lannion_CAS to Corlay | fiber (Lannion_CAS → Corlay)-F061 | west fused spans in Corlay | fiber (Corlay → Loudeac)-F010 | west fused spans in Loudeac | fiber (Loudeac → Lorient_KMA)-F054 | west edfa in Lorient_KMA to Loudeac | roadm Lorient_KMA | east edfa in Lorient_KMA to Vannes_KBE | fiber (Lorient_KMA → Vannes_KBE)-F055 | west edfa in Vannes_KBE to Lorient_KMA | roadm Vannes_KBE | trx Vannes_KBE,"-276, 4",,,
3,trx Lannion_CAS,trx Rennes_STA,60.0,True,1,1,vendorA_trx-type1,mode 1,28.29,25.85,21.77,32.0,1.0,trx Lannion_CAS | roadm Lannion_CAS | east edfa in Lannion_CAS to Stbrieuc | fiber (Lannion_CAS → Stbrieuc)-F056 | east edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Rennes_STA)-F057 | west edfa in Rennes_STA to Stbrieuc | roadm Rennes_STA | trx Rennes_STA,"-284, 4",,,
4,trx Rennes_STA,trx Lannion_CAS,150.0,True,1,1,vendorA_trx-type1,mode 2,22.27,22.15,15.05,64.0,0.0,trx Rennes_STA | roadm Rennes_STA | east edfa in Rennes_STA to Ploermel | fiber (Rennes_STA → Ploermel)- | east edfa in Ploermel to Vannes_KBE | fiber (Ploermel → Vannes_KBE)- | west edfa in Vannes_KBE to Ploermel | roadm Vannes_KBE | east edfa in Vannes_KBE to Lorient_KMA | fiber (Vannes_KBE → Lorient_KMA)-F055 | west edfa in Lorient_KMA to Vannes_KBE | roadm Lorient_KMA | east edfa in Lorient_KMA to Loudeac | fiber (Lorient_KMA → Loudeac)-F054 | east fused spans in Loudeac | fiber (Loudeac → Corlay)-F010 | east fused spans in Corlay | fiber (Corlay → Lannion_CAS)-F061 | west edfa in Lannion_CAS to Corlay | roadm Lannion_CAS | trx Lannion_CAS,"-266, 6",,,
5,trx Rennes_STA,trx Lannion_CAS,20.0,True,1,1,vendorA_trx-type1,mode 2,30.79,28.77,21.68,64.0,3.0,trx Rennes_STA | roadm Rennes_STA | east edfa in Rennes_STA to Stbrieuc | fiber (Rennes_STA → Stbrieuc)-F057 | west edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Lannion_CAS)-F056 | west edfa in Lannion_CAS to Stbrieuc | roadm Lannion_CAS | trx Lannion_CAS,"-274, 6",,,
6,,,,NO_PATH,,,,,,,,,,,,,,
1 response-id source destination path_bandwidth Pass? nb of tsp pairs total cost transponder-type transponder-mode OSNR-0.1nm SNR-0.1nm SNR-bandwidth baud rate (Gbaud) input power (dBm) path spectrum (N,M) reversed path OSNR-0.1nm reversed path SNR-0.1nm reversed path SNR-bandwidth
2 0 trx Lorient_KMA trx Vannes_KBE 100.0 True 1 1 Voyager mode 1 30.84 30.84 26.75 32.0 0.0 trx Lorient_KMA | roadm Lorient_KMA | east edfa in Lorient_KMA to Vannes_KBE | fiber (Lorient_KMA → Vannes_KBE)-F055 | west edfa in Vannes_KBE to Lorient_KMA | roadm Vannes_KBE | trx Vannes_KBE [-284], [4] -284, 4
3 1 trx Brest_KLA trx Vannes_KBE 10.0 True 1 1 Voyager mode 1 22.65 22.11 18.03 32.0 1.0 trx Brest_KLA | roadm Brest_KLA | east edfa in Brest_KLA to Morlaix | fiber (Brest_KLA → Morlaix)-F060 | east fused spans in Morlaix | fiber (Morlaix → Lannion_CAS)-F059 | west edfa in Lannion_CAS to Morlaix | roadm Lannion_CAS | east edfa in Lannion_CAS to Corlay | fiber (Lannion_CAS → Corlay)-F061 | west fused spans in Corlay | fiber (Corlay → Loudeac)-F010 | west fused spans in Loudeac | fiber (Loudeac → Lorient_KMA)-F054 | west edfa in Lorient_KMA to Loudeac | roadm Lorient_KMA | east edfa in Lorient_KMA to Vannes_KBE | fiber (Lorient_KMA → Vannes_KBE)-F055 | west edfa in Vannes_KBE to Lorient_KMA | roadm Vannes_KBE | trx Vannes_KBE [-276], [4] -276, 4
4 3 trx Lannion_CAS trx Rennes_STA 60.0 True 1 1 vendorA_trx-type1 mode 1 28.29 25.85 21.77 32.0 1.0 trx Lannion_CAS | roadm Lannion_CAS | east edfa in Lannion_CAS to Stbrieuc | fiber (Lannion_CAS → Stbrieuc)-F056 | east edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Rennes_STA)-F057 | west edfa in Rennes_STA to Stbrieuc | roadm Rennes_STA | trx Rennes_STA [-284], [4] -284, 4
5 4 trx Rennes_STA trx Lannion_CAS 150.0 True 1 1 vendorA_trx-type1 mode 2 22.27 22.14 22.15 15.05 64.0 0.0 trx Rennes_STA | roadm Rennes_STA | east edfa in Rennes_STA to Ploermel | fiber (Rennes_STA → Ploermel)- | east edfa in Ploermel to Vannes_KBE | fiber (Ploermel → Vannes_KBE)- | west edfa in Vannes_KBE to Ploermel | roadm Vannes_KBE | east edfa in Vannes_KBE to Lorient_KMA | fiber (Vannes_KBE → Lorient_KMA)-F055 | west edfa in Lorient_KMA to Vannes_KBE | roadm Lorient_KMA | east edfa in Lorient_KMA to Loudeac | fiber (Lorient_KMA → Loudeac)-F054 | east fused spans in Loudeac | fiber (Loudeac → Corlay)-F010 | east fused spans in Corlay | fiber (Corlay → Lannion_CAS)-F061 | west edfa in Lannion_CAS to Corlay | roadm Lannion_CAS | trx Lannion_CAS [-266], [6] -266, 6
6 5 trx Rennes_STA trx Lannion_CAS 20.0 True 1 1 vendorA_trx-type1 mode 2 30.79 28.76 28.77 21.67 21.68 64.0 3.0 trx Rennes_STA | roadm Rennes_STA | east edfa in Rennes_STA to Stbrieuc | fiber (Rennes_STA → Stbrieuc)-F057 | west edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Lannion_CAS)-F056 | west edfa in Lannion_CAS to Stbrieuc | roadm Lannion_CAS | trx Lannion_CAS [-274], [6] -274, 6
7 6 NO_PATH

View File

@@ -14,8 +14,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -39,8 +39,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -104,8 +104,8 @@
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 50000000000.0,
@@ -129,8 +129,8 @@
"trx_mode": "mode 2",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 75000000000.0,
@@ -154,8 +154,8 @@
"trx_mode": "mode 2",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 75000000000.0,
@@ -179,8 +179,8 @@
"trx_mode": "mode 2",
"effective-freq-slot": [
{
"N": null,
"M": null
"N": "null",
"M": "null"
}
],
"spacing": 75000000000.0,

Some files were not shown because too many files have changed in this diff Show More