Feat: create project skeleton using CANDI POC experimental api

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I44c9c96c58fabb79e2b569f7b404036b475b4fde
This commit is contained in:
EstherLerouzic
2025-02-02 16:58:26 +01:00
parent 733af3d088
commit 34df7f5fc1
18 changed files with 14750 additions and 2 deletions

View File

@@ -1,6 +1,36 @@
# GNPy API
tbd
REST API (experimental)
-----------------------
``gnpyapi`` provides an experimental api for requesting several paths at once. It is based on Flask server.
You can run it through command line or Docker.
.. code-block:: shell-session
$ gnpy-rest
.. code-block:: shell-session
$ docker run -p 8080:8080 -it emmanuelledelfour/gnpy-experimental:candi-1.1 gnpy-rest
When starting the api server will aks for an encryption/decryption key. This key i used to encrypt equipment file when using /api/v1/equipments endpoint.
This key is a Fernet key and can be generated this way:
.. code-block:: python
from cryptography.fernet import Fernet
Fernet.generate_key()
After typing the key, you can detach the container by typing ^P^Q.
After starting the api server, you can launch a request
.. code-block:: shell-session
$ curl -v -X POST -H "Content-Type: application/json" -d @<PATH_TO_JSON_REQUEST_FILE> https://localhost:8080/api/v1/path-computation -k
TODO: api documentation, unit tests, real WSGI server with trusted certificates
## Quick Start

20
docs/Makefile Executable file
View File

@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = GNPyAPI
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env python
"""GNPy official API
"""

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
module gnpy-api {
yang-version 1.1;
namespace "gnpy:gnpy-api";
prefix gnpyapi;
import gnpy-network-topology {
prefix gnpynt;
revision-date "2025-01-20";
}
import gnpy-path-computation {
prefix gnpypc;
revision-date "2025-01-21";
}
import gnpy-eqpt-config {
prefix gnpyeqpt;
revision-date "2025-01-20";
}
import ietf-yang-types {
prefix ietftypes;
}
organization
"Telecom Infra Project OOPT PSE Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description
"YANG model for gnpy api input for path computation - TransportPCE preversion";
revision 2021-01-06 {
description
"draft for experimental/2020-candi.
Add the possibility to use a topology_id or an equipment_id
";
reference
"YANG model for api input for path computation with gnpy";
}
container service {
description
"Describe the service file to connect to gnpy";
uses gnpypc:service;
}
container response {
uses gnpypc:response;
description
"Describe the response object to gnpy";
}
choice topo {
case explicit {
container topology {
description
"Describe the topology file to connect to gnpy";
uses gnpynt:topo;
}
}
case id {
leaf topology_id {
type ietftypes:uuid;
mandatory true;
}
}
}
choice eqpt {
case explicit {
container equipment {
description
"Describe the equipment library to connect to gnpy";
uses gnpyeqpt:eqpt;
}
}
case id {
leaf equipment_id {
type ietftypes:uuid;
mandatory true;
}
}
}
}

View File

@@ -0,0 +1,442 @@
module gnpy-eqpt-config {
yang-version 1;
namespace "gnpy:gnpy-eqpt-config";
prefix "gnpyeqpt";
organization
"Telecom Infra Project OOPT PSE
Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description "Base YANG model for gnpy equipment library input for path computation - 2020 - candi preversion";
revision "2020-10-22" {
description "draft for experimental/2020-candi";
reference "Base YANG model for equipment library input for path computation with gnpy";
}
/*
* Identities
identity edfa-type-def {
description "base identity for variable gain and fixed gain";
}
identity variable-gain{
base edfa-type-def ;
description "'variable_gain' is a simplified model simulating a 2-coil
EDFA with internal, input and output VOAs. The NF vs gain response is calculated
accordingly based on the input parameters: nf_min, nf_max, and gain_flatmax. It
is not a simple interpolation but a 2-stage NF calculation.";
}
identity fixed-gain{
base edfa-type-def ;
description "'fixed_gain' is a fixed gain model. NF == Cte == nf0 if gain_min < gain < gain_flatmax";
}
identity fiber-variety {
description "base identity for fiber variety";
}
identity transceiver-variety {
description "base identity for transceiver variety";
}
*/
grouping variable-gain {
leaf nf_min {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf nf_max {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf out_voa_auto{
type boolean ;
description "auto_design feature to optimize the amplifier output VOA. If true, output VOA is present
and will be used to push amplifier gain to its maximum, within EOL power margins.";
}
}
grouping fixed-gain{
leaf nf0 {
type decimal64 {
fraction-digits 2;
}
units dB;
}
}
grouping no-type-def{
leaf advanced_config_from_json {
type string ;
description " filename with json edfa";
}
}
grouping openroadm{
leaf-list nf_coef {
type decimal64 {
fraction-digits 5;
}
//default [8.1e-4,6.142e-2,1.558,19.97] ;
}
}
grouping dual-stage {
leaf raman {
type boolean;
}
leaf preamp_variety {
type leafref {
path "../../Edfa/type_variety";
}
}
leaf booster_variety {
type leafref {
path "../../Edfa/type_variety";
}
}
}
grouping edfa-common {
leaf allowed_for_design{
type boolean ;
description "If false, the amplifier will not be picked by auto-design but it can still be used as a
manual input (from JSON or Excel template topology files.)";
}
leaf gain_flatmax {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf gain_min {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf p_max {
type decimal64 {
fraction-digits 2;
}
units dBm;
}
leaf type_def {
type identityref{
base edfa-type-def ;
}
}
choice type_of_model {
case variable-gain {
when "type_def = 'variable-gain'";
uses variable-gain ;
}
case fixed-gain{
when "type_def = 'fixed-gain'";
uses fixed-gain;
}
case no-type-def{
when "type_def = 'no-type-def'";
uses no-type-def;
}
case openroadm{
when "type_def = 'openroadm'";
uses openroadm;
}
case dual_stage {
when "type_def = 'dual_stage'";
uses dual-stage ;
}
}
}
grouping common-fiber {
description "common parameters for fiber and raman fiber";
leaf type_variety {
type string ;
}
description "a unique name to ID the fiber in the JSON or Excel template topology input file";
leaf dispersion{
type decimal64 {
fraction-digits 8;
}
units s.m-1.m-1;
}
leaf gamma{
type decimal64 {
fraction-digits 8;
}
units w-1.m-1 ;
description "2pi.n2/(lambda*Aeff) (w-2.m-1)";
}
leaf pmd_coef{
type decimal64 {
fraction-digits 16;
}
units s.sqrt(m)-1;
}
}
grouping eqpt{
list Edfa {
key type_variety;
leaf type_variety {
type string;
description "a unique name to ID the amplifier in the JSON/Excel template topology input file";
}
uses edfa-common;
}
list Fiber {
key type_variety;
uses common-fiber;
}
list RamanFiber {
uses common-fiber;
container raman_efficiency {
leaf-list cr {
type decimal64 {
fraction-digits 8;
}
}
leaf-list frequency_offset {
type decimal64 {
fraction-digits 8;
}
}
}
}
list Span {
leaf power_mode {
type boolean ;
}
leaf-list delta_power_range_db {
type decimal64 {
fraction-digits 2;
}
}
leaf max_length {
type decimal64 {
fraction-digits 2;
}
units km;
default 150.0 ;
}
leaf max_loss {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf max_fiber_lineic_loss_for_raman {
type decimal64 {
fraction-digits 2;
}
units dB.km-1;
}
leaf target_extended_gain {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf length_units{
type string ;
default "km";
}
leaf padding{
type decimal64 {
fraction-digits 2;
}
default 10.0 ;
}
leaf EOL{
type decimal64 {
fraction-digits 2;
}
default 0.0 ;
}
leaf con_in{
type decimal64 {
fraction-digits 2;
}
default 0.0 ;
}
leaf con_out{
type decimal64 {
fraction-digits 2;
}
default 0.0 ;
}
}
list Roadm {
leaf target_pch_out_db {
type decimal64 {
fraction-digits 2;
}
}
leaf add_drop_osnr {
type decimal64 {
fraction-digits 2;
}
}
leaf pmd {
type decimal64 {
fraction-digits 2;
}
}
container restrictions {
leaf-list preamp_variety_list {
type string;
}
leaf-list booster_variety_list {
type string;
}
}
}
list SI {
leaf f_min {
type decimal64 {
fraction-digits 2;
}
}
leaf f_max {
type decimal64 {
fraction-digits 2;
}
}
leaf baud_rate {
type decimal64 {
fraction-digits 2;
}
}
leaf spacing {
type decimal64 {
fraction-digits 2;
}
}
leaf power_dbm {
type decimal64 {
fraction-digits 2;
}
}
leaf-list power_range_db {
type decimal64 {
fraction-digits 2;
}
}
leaf roll_off {
type decimal64 {
fraction-digits 2;
}
}
leaf tx_osnr {
type decimal64 {
fraction-digits 2;
}
}
leaf sys_margins {
type decimal64 {
fraction-digits 2;
}
}
}
list Transceiver {
leaf type_variety {
type string ;
description "a unique name to ID the transceiver in the JSON or Excel template topology input file";
}
container frequency {
leaf min {
type decimal64 {
fraction-digits 2;
}
units Hz ;
}
leaf max {
type decimal64 {
fraction-digits 2;
}
units Hz ;
}
description "Min/max frequency of transponder eg 191.35e12 and 196.1e12";
}
list mode {
leaf format {
type string ;
description "unique name of the mode";
}
leaf baud_rate {
type decimal64 {
fraction-digits 2;
}
units baud ;
description "baud_rate";
}
leaf OSNR {
type decimal64 {
fraction-digits 2;
}
units dB ;
description "min required OSNR in 0.1nm (dB)";
}
leaf tx_osnr {
type decimal64 {
fraction-digits 2;
}
units dB ;
description "min required OSNR in 0.1nm (dB)";
}
leaf min_spacing {
type decimal64 {
fraction-digits 2;
}
units GHz ;
description "...";
}
leaf bit_rate {
type decimal64 {
fraction-digits 2;
}
units bit/s ;
description "bit rate";
}
leaf roll_off {
type decimal64 {
fraction-digits 2;
}
description "...";
}
leaf cost {
type decimal64 {
fraction-digits 2;
}
description "arbitrary unit";
}
}
}
}
}

View File

@@ -0,0 +1,770 @@
module gnpy-eqpt-config {
yang-version 1.1;
namespace "urn:ns:gnpy:equipment_library";
prefix "gnpyeqpt";
import ietf-optical-impairment-topology {
prefix "oit";
revision-date 2024-05-21;
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
import ietf-layer0-types {
prefix "l0-types";
revision-date 2024-03-04;
reference
"RFC 8345: A YANG Data Model for Network Topologies";
}
organization
"Telecom Infra Project OOPT PSE
Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description "Base YANG model for gnpy equipment library input for path computation - 2020 - candi preversion";
revision 2025-01-20 {
description
"Add RamanFiber, design bands, tx_power";
reference
"Base YANG model for equipment library input for detecon, libyang validation, GNPy4Ofr API";
}
revision "2024-02-21" {
description "add roadm, fix identity-ref, fix leafref";
reference "Base YANG model for equipment library input for detecon, libyang validatio, GNPy4Ofr API";
}
revision "2023-02-04" {
description "fix pdl, pmd fraction-digit, add advanced_model type def, remove no-type-def";
reference "Base YANG model for equipment library input for detecon - GNPy";
}
revision "2022-11-21" {
description "draft for toaster detecon - GNPy API";
reference "Base YANG model for equipment library input for detecon - GNPy";
}
revision "2020-10-22" {
description "draft for experimental/2020-candi";
reference "Base YANG model for equipment library input for path computation with gnpy";
}
/*
* Identities
*/
identity edfa-type-def {
description "base identity for variable gain and fixed gain";
}
identity variable_gain {
base edfa-type-def;
description "'variable_gain' is a simplified model simulating a 2-coil
EDFA with internal, input and output VOAs. The NF vs gain response is calculated
accordingly based on the input parameters: nf_min, nf_max, and gain_flatmax. It
is not a simple interpolation but a 2-stage NF calculation.";
}
identity fixed_gain {
base edfa-type-def;
description "'fixed_gain' is a fixed gain model. NF == Cte == nf0 if gain_min < gain < gain_flatmax";
}
identity openroadm {
base edfa-type-def;
description "'openroadm' is an openroadm amplifier type.";
}
identity multi_band {
base edfa-type-def;
description "multi_band has a combination of amp per frequency band defined with their f_min f_max range";
}
identity dual_stage {
base edfa-type-def;
description "dual-stage has two amps defined";
}
identity advanced_model {
base edfa-type-def;
description "advanced_model has a combination of amp per frequency band defined with their f_min f_max range";
}
identity fiber-variety {
description "base identity for fiber variety";
}
identity transceiver-variety {
description "base identity for transceiver variety";
}
grouping variable_gain {
leaf nf_min {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf nf_max {
type decimal64 {
fraction-digits 2;
}
units dB;
}
}
grouping fixed_gain{
leaf nf0 {
type decimal64 {
fraction-digits 2;
}
units dB;
}
}
grouping openroadm{
leaf-list nf_coef {
type decimal64 {
fraction-digits 8;
}
//default [8.1e-4,6.142e-2,1.558,19.97] ;
}
}
grouping dual-stage {
leaf preamp_variety {
type union {
type leafref {
path "../../Edfa/type_variety";
}
type leafref {
path "../../Edfa/other_name";
}
}
}
leaf booster_variety {
type union {
type leafref {
path "../../Edfa/type_variety";
}
type leafref {
path "../../Edfa/other_name";
}
}
}
}
grouping multi_band {
leaf-list amplifiers {
type string;
description "list of amplifier type-variety picked in other type-def";
}
}
grouping advanced_model {
leaf advanced_config_from_json {
type string;
description
"file name where all noise interp coef, gain ripple, dgt, nf_ripple are detailed";
}
}
grouping edfa-common {
leaf allowed_for_design{
type boolean ;
description "If false, the amplifier will not be picked by auto-design but it can still be used as a
manual input (from JSON or Excel template topology files.)";
}
leaf gain_flatmax {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf gain_min {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf gain_extended {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf p_max {
type decimal64 {
fraction-digits 2;
}
units dBm;
}
leaf type_def {
type identityref{
base edfa-type-def;
}
}
leaf raman {
type boolean;
}
leaf out_voa_auto{
type boolean ;
description "auto_design feature to optimize the amplifier output VOA. If true, output VOA is present
and will be used to push amplifier gain to its maximum, within EOL power margins.";
}
leaf in_voa_auto{
type boolean ;
description "auto_design feature to optimize the amplifier input VOA. If true, input VOA is present.
TODO: code the function in GNPy";
}
choice type_of_model {
case variable_gain {
when "type_def = 'gnpyeqpt:variable_gain'";
uses variable_gain ;
}
case fixed_gain{
when "type_def = 'gnpyeqpt:fixed_gain'";
uses fixed_gain;
}
case openroadm{
when "type_def = 'gnpyeqpt:openroadm'";
uses openroadm;
}
case dual_stage {
when "type_def = 'gnpyeqpt:dual_stage'";
uses dual-stage ;
}
case multi_band {
when "type_def = 'gnpyeqpt:multi_band'";
uses multi_band ;
}
case advanced_model {
when "type_def = 'gnpyeqpt:advanced_model'";
uses advanced_model;
}
}
}
grouping common-fiber {
description "common parameters for fiber and raman fiber";
leaf type_variety {
type string ;
description "a unique name to ID the fiber in the JSON or Excel template topology input file";
}
leaf dispersion{
type decimal64 {
fraction-digits 8;
}
units s.m-1.m-1;
}
leaf gamma{
type decimal64 {
fraction-digits 8;
}
units w-1.m-1 ;
description "2pi.n2/(lambda*Aeff) (w-2.m-1)";
}
leaf pmd_coef{
type decimal64 {
fraction-digits 18;
}
units s.sqrt(m)-1;
}
leaf effective_area{
type decimal64 {
fraction-digits 14;
}
units m-2;
}
}
grouping range {
leaf min_value {
type decimal64 {
fraction-digits 2;
}
}
leaf max_value {
type decimal64 {
fraction-digits 2;
}
}
leaf step {
type decimal64 {
fraction-digits 2;
}
}
}
grouping eqpt{
list Edfa {
config false ;
key type_variety;
leaf type_variety {
type string;
description "a unique name to ID the amplifier in the JSON/Excel template topology input file";
}
leaf-list other_name {
type string;
description "a list of alternative names for the equipment";
}
leaf f_min {
type decimal64 {
fraction-digits 1;
}
}
leaf f_max {
type decimal64 {
fraction-digits 1;
} }
uses edfa-common;
}
grouping frequency-range {
description
"This grouping defines the lower and upper bounds of a
frequency range (e.g., a band).
This grouping SHOULD NOT be used to define a frequency slot,
which SHOULD be defined using the n and m values instead.
copied from ietf-layer0-types except for units which must be Hz";
leaf lower-frequency {
type union {
type decimal64 {
fraction-digits 2;
range "0..max";
}
type empty;
}
units Hz;
mandatory true;
description
"The lower frequency boundary of the
frequency range.";
}
leaf upper-frequency {
type union {
type decimal64 {
fraction-digits 2;
range "0..max";
}
type empty;
}
units Hz;
must '. > ../lower-frequency' {
error-message
"The upper frequency must be greater than the lower
frequency.";
}
mandatory true;
description
"The upper frequency boundary of the
frequency range.";
}
}
list Fiber {
config false ;
key type_variety;
uses common-fiber;
}
list RamanFiber {
config false ;
uses common-fiber;
container raman_efficiency {
leaf-list cr {
type decimal64 {
fraction-digits 9;
}
}
leaf-list frequency_offset {
type decimal64 {
fraction-digits 2;
}
}
}
}
list Span {
config false ;
leaf power_mode {
type boolean ;
}
container delta_power_range_dict_db {
uses range ;
}
leaf max_length {
type decimal64 {
fraction-digits 2;
}
units km;
default 150.0 ;
}
leaf max_loss {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf max_fiber_lineic_loss_for_raman {
type decimal64 {
fraction-digits 2;
}
units dB.km-1;
}
leaf target_extended_gain {
type decimal64 {
fraction-digits 2;
}
units dB;
}
leaf length_units{
type string ;
default "km";
}
leaf padding{
type decimal64 {
fraction-digits 2;
}
default 10.0 ;
}
leaf EOL{
type decimal64 {
fraction-digits 2;
}
default 0.0 ;
}
leaf con_in{
type decimal64 {
fraction-digits 2;
}
default 0.0 ;
}
leaf con_out{
type decimal64 {
fraction-digits 2;
}
default 0.0 ;
}
}
list Roadm {
config false ;
leaf type_variety {
type string;
}
leaf target_pch_out_db {
type decimal64 {
fraction-digits 2;
}
}
leaf target_psd_out_mWperGHz {
type decimal64 {
fraction-digits 2;
}
}
leaf target_out_mWperSlotWidth {
type decimal64 {
fraction-digits 2;
}
}
leaf add_drop_osnr {
type decimal64 {
fraction-digits 2;
}
}
leaf pmd {
type decimal64 {
fraction-digits 15;
}
}
leaf pdl {
type decimal64 {
fraction-digits 2;
}
}
container restrictions {
leaf-list preamp_variety_list {
type string;
}
leaf-list booster_variety_list {
type string;
}
}
list roadm-path-impairments {
key "roadm-path-impairments-id";
config false;
description
"The set of optical impairments related to a ROADM path.";
leaf roadm-path-impairments-id {
type uint32;
description "index of the ROADM path-impairment list";
}
choice impairment-type {
description "type path impairment";
case roadm-express-path {
list roadm-express-path {
description
"The list of optical impairments on a ROADM express
path for different frequency ranges.
Two elements in the list must not have the same range
or overlapping ranges.";
container frequency-range {
description
"The frequency range for which these optical
impairments apply.";
uses frequency-range;
}
// todo: augment express to allow transit OSNR//
uses oit:roadm-express-path;
}
}
case roadm-add-path {
list roadm-add-path {
description
"The list of optical impairments on a ROADM add
path for different frequency ranges.
Two elements in the list must not have the same range
or overlapping ranges.";
container frequency-range {
description
"The frequency range for which these optical
impairments apply.";
uses frequency-range;
}
uses oit:roadm-add-path;
}
}
case roadm-drop-path {
list roadm-drop-path {
description
"The list of optical impairments on a ROADM add
path for different frequency ranges.
Two elements in the list must not have the same range
or overlapping ranges.";
container frequency-range {
description
"The frequency range for which these optical
impairments apply.";
uses frequency-range;
}
uses oit:roadm-drop-path;
}
}
}
} // list path impairments
}
list SI {
config false ;
leaf f_min {
type decimal64 {
fraction-digits 2;
}
}
leaf f_max {
type decimal64 {
fraction-digits 2;
}
}
leaf baud_rate {
type decimal64 {
fraction-digits 2;
}
}
leaf spacing {
type decimal64 {
fraction-digits 2;
}
}
leaf power_dbm {
type decimal64 {
fraction-digits 2;
}
}
container power_range_dict_db {
uses range;
}
leaf roll_off {
type decimal64 {
fraction-digits 2;
}
}
leaf tx_osnr {
type decimal64 {
fraction-digits 2;
}
}
leaf tx_power_dbm {
type decimal64 {
fraction-digits 2;
}
}
leaf type_variety {
type string ;
description "a unique name to ID the SI band";
}
leaf sys_margins {
type decimal64 {
fraction-digits 2;
}
}
}
list Transceiver {
config false ;
leaf type_variety {
type string ;
description "a unique name to ID the transceiver in the JSON or Excel template topology input file";
}
leaf-list other_name {
type string;
description "a list of alternative names for the equipment";
}
leaf comment {
type string;
description "free string";
}
container frequency {
leaf min {
type decimal64 {
fraction-digits 2;
}
units Hz ;
}
leaf max {
type decimal64 {
fraction-digits 2;
}
units Hz ;
}
description "Min/max frequency of transponder eg 191.35e12 and 196.1e12";
}
list mode {
config false ;
leaf format {
type string ;
description "unique name of the mode";
}
leaf-list other_name {
type string;
description "a list of alternative names for the mode";
}
leaf baud_rate {
type decimal64 {
fraction-digits 2;
}
units baud ;
description "baud_rate";
}
leaf OSNR {
type decimal64 {
fraction-digits 2;
}
units dB ;
description "min required OSNR in 0.1nm (dB)";
}
leaf tx_osnr {
type decimal64 {
fraction-digits 2;
}
units dB ;
description "min required OSNR in 0.1nm (dB)";
}
leaf min_spacing {
type decimal64 {
fraction-digits 2;
}
units GHz ;
description "...";
}
leaf bit_rate {
type decimal64 {
fraction-digits 2;
}
units bit/s ;
description "bit rate";
}
leaf roll_off {
type union {
type decimal64 {
fraction-digits 2;
}
type empty;
}
description "...";
}
leaf cost {
type decimal64 {
fraction-digits 2;
}
description "arbitrary unit";
}
list penalties {
leaf chromatic_dispersion {
type decimal64 {
fraction-digits 2;
}
description "chromatic dispersion";
}
leaf pmd {
type decimal64 {
fraction-digits 15;
}
description "Polarization mode dispersion";
}
leaf pdl {
type decimal64 {
fraction-digits 2;
}
description "Polarization dependant loss";
}
leaf penalty_value {
type decimal64 {
fraction-digits 2;
}
}
}
leaf equalization_offset_db {
type decimal64 {
fraction-digits 4;
}
description "Power offset for equalizing this mode in ROADM compared to reference channel";
}
leaf equalization_slot_width {
type decimal64 {
fraction-digits 2;
}
description "slot width used for equalization instead of min_spacing in case of
equalization per slot width";
}
}
}
}
augment "/gnpyeqpt:equipment/gnpyeqpt:Roadm/gnpyeqpt:roadm-path-impairments/"
+ "gnpyeqpt:impairment-type/gnpyeqpt:roadm-express-path/"
+ "gnpyeqpt:roadm-express-path" {
leaf roadm-osnr {
type l0-types:snr-or-null;
description
"Optical Signal-to-Noise Ratio (OSNR).
If the express path contains an integrated amplifier,
this reflects its OSNR contribution.";
}
}
container equipment {
description
"Describe the equipment library of gnpy release 2.6";
uses eqpt;
}
}

View File

@@ -0,0 +1,300 @@
module gnpy-network-topology {
yang-version 1.1;
namespace "gnpy:gnpy-network-topology";
prefix gnpynt;
organization
"Telecom Infra Project OOPT PSE Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description
"YANG model for gnpy network input for path computation - 2020 - candi preversion";
revision 2020-10-22 {
description
"draft for experimental/2020-candi";
reference
"YANG model for network input for path computation with gnpy";
}
identity type-element {
description
"Base identity for element type";
}
identity Transceiver {
base type-element;
description
" Transceiver element";
}
identity Fiber {
base type-element;
description
"Fiber element (unidirectional)";
}
identity Roadm {
base type-element;
description
"Roadm element";
}
identity Edfa {
base type-element;
description
"Edfa element";
}
identity Fused {
base type-element;
description
"Fused element ; non amplified connection between two fiber spans ;
can be used to model optical distribution frame, or losses due to
connectors or fused in a span";
}
identity length-unit {
description
"length unit";
}
identity km {
base length-unit;
description
"kilometers";
}
identity m {
base length-unit;
description
"meter";
}
typedef Coordinate {
type decimal64 {
fraction-digits 6;
}
}
typedef Coef {
type decimal64 {
fraction-digits 2;
}
}
grouping location-attributes {
container location {
leaf city {
type string;
mandatory true;
}
leaf region {
type string;
mandatory true;
}
leaf latitude {
type Coordinate;
mandatory true;
}
leaf longitude {
type Coordinate;
mandatory true;
}
}
}
grouping fiber-params {
description
".....";
leaf length {
type decimal64 {
fraction-digits 2;
}
mandatory true;
}
leaf loss_coef {
type decimal64 {
fraction-digits 2;
}
mandatory true;
units db/km;
description "Loss coefficient of the fiber span (dB/km)";
}
leaf length_units {
type identityref {
base length-unit;
}
mandatory true;
}
leaf att_in {
type decimal64 {
fraction-digits 2;
}
units "dB";
mandatory true;
}
leaf con_in {
type decimal64 {
fraction-digits 2;
}
units "dB";
mandatory true;
}
leaf con_out {
type decimal64 {
fraction-digits 2;
}
units "dB";
mandatory true;
}
}
grouping edfa-params {
container operational {
description
"Operational values for the Edfa ";
leaf gain_target {
type decimal64 {
fraction-digits 2;
}
units "dB";
mandatory true;
description
"gain target of the amplifier (before VOA and after att_in)";
}
leaf tilt_target {
type decimal64 {
fraction-digits 2;
}
mandatory true;
description
"..";
}
leaf out_voa {
type decimal64 {
fraction-digits 2;
}
units "dB";
mandatory true;
description
"..";
}
leaf delta_p {
type decimal64 {
fraction-digits 2;
}
units "dB";
mandatory true;
description
"per channel target output power delta with respect to power setting in SI";
}
}
}
grouping roadm-params {
leaf target_pch_out_db {
type decimal64 {
fraction-digits 2;
}
units "dB";
description
"..";
}
container restrictions {
leaf-list preamp_variety_list {
type string;
description
"List of authorized preamp type-variety";
}
leaf-list booster_variety_list {
type string;
description
"List of authorized booster type-variety";
}
}
}
grouping transceiver-params;
grouping fused-params{
leaf loss {
type decimal64 {
fraction-digits 2;
}
units "dB";
description
"Concentrated loss of the fused element";
}
}
grouping element-type-choice {
choice element-type {
case Edfa {
when "type = 'Edfa'";
uses edfa-params;
}
case FiberRoadm {
container params {
choice fiberroadmfused {
case Fiber {
when "type = 'Fiber'";
uses fiber-params;
}
case Roadm {
when "type = 'Roadm'";
uses roadm-params;
}
case Fused {
when "type = 'Fused'";
uses fused-params;
}
}
}
}
case Transceiver {
when "type = 'Transceiver'";
}
}
}
grouping topo {
list elements {
key "uid";
leaf uid {
type string;
}
leaf type {
type identityref {
base type-element;
}
mandatory true;
}
leaf type_variety {
type string;
mandatory false;
}
container metadata {
uses location-attributes;
}
uses element-type-choice;
}
list connections {
config false;
leaf from_node {
type leafref {
path "../../elements/uid";
}
}
leaf to_node {
type leafref {
path "../../elements/uid";
}
}
}
}
}

View File

@@ -0,0 +1,594 @@
module gnpy-network-topology {
yang-version 1.1;
namespace "gnpy:gnpy-network-topology";
prefix gnpynt;
organization
"Telecom Infra Project OOPT PSE Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description
"YANG model for gnpy network input for path computation - 2020 - candi preversion";
revision 2025-01-20 {
description
"Add RamanFiber, design bands, impairments";
reference
"YANG model for network input for path computation with gnpy";
}
revision 2024-02-21 {
description
"fix namespaces for identity-ref,
add roadm impairment";
reference
"YANG model for network input for path computation with gnpy";
}
revision 2023-02-01 {
description
"change per-degree roadm targets
set 6 digits for fiber length
set 6 digits for loss_coef
add type empty for con_in and con_out";
reference
"YANG model for network input for path computation with gnpy";
}
revision 2022-11-21 {
description
"draft for detecon - GNPy API";
reference
"YANG model for network input for path computation with gnpy";
}
revision 2020-10-22 {
description
"draft for experimental/2020-candi";
reference
"YANG model for network input for path computation with gnpy";
}
identity type-element {
description
"Base identity for element type";
}
identity Transceiver {
base type-element;
description
" Transceiver element";
}
identity Fiber {
base type-element;
description
"Fiber element (unidirectional)";
}
identity RamanFiber {
base type-element;
description
"RamanFiber element (unidirectional)";
}
identity Roadm {
base type-element;
description
"Roadm element";
}
identity Edfa {
base type-element;
description
"Edfa element";
}
identity Fused {
base type-element;
description
"Fused element ; non amplified connection between two fiber spans ;
can be used to model optical distribution frame, or losses due to
connectors or fused in a span";
}
identity Multiband_amplifier {
base type-element;
description
"Multiband_amplifier element";
}
identity length-unit {
description
"length unit";
}
identity km {
base length-unit;
description
"kilometers";
}
identity m {
base length-unit;
description
"meter";
}
typedef Coordinate {
type decimal64 {
fraction-digits 6;
}
}
identity pumping-direction {
description
"Raman pumping direction";
}
identity coprop {
base pumping-direction;
description
"forward pumping";
}
identity counterprop {
base pumping-direction;
description
"backward pumping";
}
typedef Coef {
type decimal64 {
fraction-digits 2;
}
}
grouping location-attributes {
container location {
leaf city {
type union {
type string;
type empty;
}
mandatory false;
}
leaf region {
type union {
type string;
type empty;
}
mandatory false;
}
leaf latitude {
type Coordinate;
mandatory false;
}
leaf longitude {
type Coordinate;
mandatory false;
}
}
}
grouping frequency_band {
description
"Used for amplifiers, for design band";
leaf f_min {
type decimal64 {
fraction-digits 1;
}
units "Hz";
}
leaf f_max {
type decimal64 {
fraction-digits 1;
}
units "Hz";
}
}
grouping fiber-common-params {
description
"Common attributes to fiber and raman fiber";
leaf length {
type decimal64 {
fraction-digits 6;
}
mandatory true;
}
leaf loss_coef {
type decimal64 {
fraction-digits 6;
}
mandatory true;
units db/km;
description "Loss coefficient of the fiber span (dB/km)";
}
/* case when loss_coef is a vector
list loss_coef {
leaf-list frequency {
type decimal64 {
fraction-digits 1;
}
units "Hz";
}
leaf-list value {
type decimal64 {
fraction-digits 6;
}
units "dB/km";
}
}
*/
leaf length_units {
type identityref {
base length-unit;
}
mandatory true;
}
leaf att_in {
type decimal64 {
fraction-digits 2;
}
units "dB";
}
leaf con_in {
type union {
type decimal64 {
fraction-digits 2;
}
type empty;
}
units "dB";
}
leaf con_out {
type union {
type decimal64 {
fraction-digits 2;
}
type empty;
}
units "dB";
}
}
grouping raman-fiber-operational {
leaf temperature {
type decimal64 {
fraction-digits 2;
}
}
list raman_pumps {
key "frequency";
leaf power {
type decimal64 {
fraction-digits 9;
}
}
leaf frequency {
type decimal64 {
fraction-digits 2;
}
}
leaf propagation_direction {
type identityref {
base pumping-direction;
}
}
}
}
grouping edfa-params {
leaf gain_target {
type union {
type decimal64 {
fraction-digits 6;
}
type empty;
}
units "dB";
description
"gain target of the amplifier (before VOA and after att_in)";
}
leaf tilt_target {
type union {
type decimal64 {
fraction-digits 6;
}
type empty;
}
description
"..";
}
leaf out_voa {
type union {
type decimal64 {
fraction-digits 2;
}
type empty;
}
units "dB";
description
"..";
}
leaf in_voa {
type union {
type decimal64 {
fraction-digits 2;
}
type empty;
}
units "dB";
description
"..";
}
leaf delta_p {
type union {
type decimal64 {
fraction-digits 6;
}
type empty;
}
units "dB";
description
"per channel target output power delta with respect to power setting in SI";
}
}
grouping multiband-params{
list amplifiers {
key "type_variety";
leaf type_variety {
type string;
}
container operational {
description
"Operational values for the Edfa ";
uses edfa-params;
uses frequency_band;
}
}
}
grouping roadm-trx-params {
list design_bands {
key "f_min";
uses frequency_band;
}
list per_degree_design_bands {
key "degree_uid";
leaf degree_uid {
type leafref {
path "../../../../elements/uid";
}
}
list per_degree_design_band {
key "f_min";
uses frequency_band;
}
}
}
grouping roadm-params {
choice target_type {
case constant_power {
leaf target_pch_out_db {
type decimal64 {
fraction-digits 2;
}
units "dBm";
description
"Target power applied on all channels out of all degrees of the ROADM";
}
}
case constant_psd {
leaf target_psd_out_mWperGHz {
type decimal64 {
fraction-digits 10;
}
units "mW/GHz";
description
"Target power spectral density applied on all channels out of all degrees of the ROADM.
target power is computed for each channel using this value multiplied by the baud_rate of
each channel in Ghz. eg target power = 0.0003125 * 32Gbauds = 0.01 mw ie -20 dBm";
}
}
case constant_psw {
leaf target_out_mWperSlotWidth {
type decimal64 {
fraction-digits 10;
}
units "mW/GHz";
description
"Target power spectral density applied on all channels out of all degrees of the ROADM.
target power is computed for each channel using this value multiplied by the slot width of
each channel in Ghz. eg target power = 0.0002 * 50GHz = 0.01 mw ie -20 dBm";
}
}
}
container restrictions {
leaf-list preamp_variety_list {
type string;
description
"List of authorized preamp type-variety";
}
leaf-list booster_variety_list {
type string;
description
"List of authorized booster type-variety";
}
}
list per_degree_power_targets {
key "degree_uid";
leaf degree_uid {
type leafref {
path "../../../../elements/uid";
}
}
choice per_degree_target_type {
case constant_power {
leaf per_degree_pch_out_db {
type decimal64 {
fraction-digits 2;
}
units "dBm";
description
"Equalization applied on all channels on this degree.
This target replaces the one defined for all degrees";
}
}
case constant_psd {
leaf per_degree_psd_out_mWperGHz {
type decimal64 {
fraction-digits 10;
}
units "mW/GHz";
description
"Equalization applied on all channels on this degree.
This target replaces the one defined for all degrees";
}
}
case constant_psw {
leaf per_degree_psd_out_mWperSlotWidth {
type decimal64 {
fraction-digits 10;
}
units "mW/GHz";
description
"Equalization applied on all channels on this degree.
This target replaces the one defined for all degrees";
}
}
}
}
list per_degree_impairments {
key "from_degree to_degree";
leaf from_degree {
type leafref {
path "../../../../elements/uid";
}
}
leaf to_degree {
type leafref {
path "../../../../elements/uid";
}
}
leaf impairment_id {
type uint32;
}
}
}
grouping transceiver-params;
grouping fused-params{
leaf loss {
type union {
type decimal64 {
fraction-digits 2;
}
type empty;
}
units "dB";
description
"Concentrated loss of the fused element";
}
}
grouping element-type-choice {
container operational {
when "../type = 'gnpynt:Edfa' or ../type = 'gnpynt:RamanFiber'";
description
"Operational values for the Edfa and the RamanFiber";
choice ramanfiber {
case RamanFiber {
when "../type = 'gnpynt:RamanFiber'";
uses raman-fiber-operational;
}
case Edfa {
when "../type = 'gnpynt:Edfa'";
uses edfa-params;
uses frequency_band;
}
}
}
choice element-type {
case FiberRoadm {
container params {
choice fiberroadmfused {
case Fiber {
when "../type = 'gnpynt:Fiber' or ../type = 'gnpynt:RamanFiber'";
uses fiber-common-params;
}
case RoadmTransceiver {
when "../type = 'gnpynt:Roadm' or ../type = 'gnpynt:Transceiver'";
uses roadm-trx-params;
choice roadm {
case roadm {
when "../type = 'gnpynt:Roadm'";
uses roadm-params;
}
}
}
case Fused {
when "../type = 'gnpynt:Fused'";
uses fused-params;
}
}
}
}
case Multiband_amplifier {
when "type = 'gnpynt:Multiband_amplifier'";
uses multiband-params;
}
}
}
grouping topo {
list elements {
key "uid";
leaf uid {
type string;
}
leaf type {
type identityref {
base type-element;
}
mandatory true;
}
leaf type_variety {
type string;
mandatory false;
}
container metadata {
uses location-attributes;
}
uses element-type-choice;
}
list connections {
key "from_node to_node";
leaf from_node {
type leafref {
path "../../elements/uid";
}
}
leaf to_node {
type leafref {
path "../../elements/uid";
}
}
}
}
container topology {
description
"Describe the topology gnpy-formated for release 2.6 toaster (including mixed rate and multiband)";
uses topo;
leaf network_name {
type string;
mandatory false;
}
}
}

View File

@@ -0,0 +1,559 @@
module gnpy-path-computation-simplified {
yang-version 1.1;
namespace "gnpy:path";
prefix "gnpypc";
organization
"Telecom Infra Project OOPT PSE Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description "YANG model for gnpy path computation simplified for - 2020 - candi preversion";
revision "2020-10-22" {
description
"draft for experimental/2020-candi";
reference
"YANG model for path computation with gnpy inputs";
}
grouping effective-freq-slot{
/* content copied from ietf-flexi-grid-media-channel, because only M and N are needed
from the initial grouping.
*/
description "The effective frequency slot is an attribute
of a media channel and, being a frequency slot, it is
described by its nominal central frequency and slot
width";
reference "rfc7698";
leaf N {
type int32;
description
"Is used to determine the Nominal Central
Frequency. The set of nominal central frequencies
can be built using the following expression:
f = 193.1 THz + n x 0.00625 THz,
where 193.1 THz is ITU-T ''anchor frequency'' for
transmission over the C band, n is a positive or
negative integer including 0.";
reference "rfc7698";
}
leaf M {
type uint32;
description
"Is used to determine the slot width. A slot width
is constrained to be M x SWG (that is, M x 12.5 GHz),
where M is an integer greater than or equal to 1.";
reference "rfc7698";
}
}
grouping gnpy-specific-parameters{
description
"This grouping defines the gnpy specific parameters for requests.";
leaf technology {
type string;
default "flexi-grid";
description
"Data plane technology type.";
}
leaf trx_type {
type string ;
mandatory true;
description "name of the transponder type (to be read from equipment library";
}
leaf trx_mode {
type string;
description "name of the transponder mode (to be read from equipment library";
}
list effective-freq-slot {
key "N";
uses effective-freq-slot ;
}
leaf spacing {
mandatory true;
type decimal64 {
fraction-digits 1;
}
units Hz;
description
"It is the spacing between channels assuming full load with
same channels as the requested one. multiple of 12.5 GHz";
}
leaf max-nb-of-channel{
type int32;
description "Nb of channel to take into account for the full load case.
";
}
leaf output-power{
type decimal64 {
fraction-digits 5;
}
units W;
description "optical power setting to be used for the propagation";
}
leaf path_bandwidth{
type decimal64 {
fraction-digits 5;
}
mandatory true;
units bit/s;
description "Capacity required";
}
}
identity SNR-bandwidth {
base path-metric-type;
description
"A metric that records SNR in signal bandwidth";
}
identity OSNR-bandwidth {
base path-metric-type;
description
"A metric that records OSNR in signal bandwidth";
}
identity SNR-0.1nm {
base path-metric-type;
description
"A metric that records SNR in 0.1nm";
}
identity OSNR-0.1nm {
base path-metric-type;
description
"A metric that records OSNR in 0.1nm";
}
identity reference_power {
base path-metric-type;
description
"to be revised";
}
identity path_bandwidth {
base path-metric-type;
description
"to be revised";
}
grouping transponder{
leaf transponder-type {
type string ;
description
"transponder type.";
}
leaf transponder-mode {
type string ;
description
"transponder mode.";
}
}
grouping hop-attribute{
description
"This grouping defines the hop attribute parameters for request or response";
choice hop-type{
case tsp {
container transponder{
uses transponder ;
}
}
case regen {
container regenerator{
leaf regenerator-id{
type string ;
}
uses transponder ;
}
}
case pow {
container optical-power{
leaf optical-power{
type decimal64 {
fraction-digits 5;
}
units W;
description "not used yet. hop output (input??) power";
}
}
}
}
}
identity path-metric-type {
description
"Base identity for path metric type";
}
identity route-usage-type {
description
"Base identity for route usage";
}
identity route-include-ero {
base route-usage-type;
description
"Include ERO from route";
}
identity route-exclude-ero {
base route-usage-type;
description
"Exclude ERO from route";
}
identity route-exclude-srlg {
base route-usage-type;
description
"Exclude SRLG from route";
}
typedef te-hop-type {
type enumeration {
enum LOOSE {
description
"loose hop in an explicit path";
}
enum STRICT {
description
"strict hop in an explicit path";
}
}
description
"enumerated type for specifying loose or strict
paths";
reference "RFC3209: section-4.3.2";
}
typedef te-path-disjointness {
type bits {
bit node {
position 0;
description "Node disjoint.";
}
bit link {
position 1;
description "Link disjoint.";
}
bit srlg {
position 2;
description "SRLG (Shared Risk Link Group) disjoint.";
}
}
description
"Type of the resource disjointness for a TE tunnel path.";
reference
"RFC4872: RSVP-TE Extensions in Support of End-to-End
Generalized Multi-Protocol Label Switching (GMPLS)
Recovery";
} // te-path-disjointness
typedef accumulated-metric-type {
type union {
type uint64;
type decimal64 {
fraction-digits 2;
}
}
description
"type useable for accumulative-value";
}
grouping path-route-objects {
description
"List of EROs to be included or excluded when performing
the path computation.";
container explicit-route-objects {
description
"Container for the route object list";
list route-object-include-exclude {
description
"List of explicit route objects to include or
exclude in path computation";
leaf explicit-route-usage {
type identityref {
base route-usage-type;
}
description "Explicit-route usage.";
}
key "index";
uses explicit-route-hop ;
}
}
}
grouping generic-path-disjointness {
description "Path disjointness grouping";
leaf disjointness {
type te-path-disjointness;
description
"The type of resource disjointness.
Under primary path, disjointness level applies to
all secondary LSPs. Under secondary, disjointness
level overrides the one under primary";
}
}
grouping common-path-constraints-attributes {
description
"Common path constraints configuration grouping";
uses common-constraints_config;
}
grouping generic-path-constraints {
description
"Global named path constraints configuration
grouping";
container path-constraints {
description "TE named path constraints container";
uses common-path-constraints-attributes;
}
}
grouping explicit-route-hop {
description
"The explicit route subobject grouping";
leaf index {
type uint32;
description "ERO subobject index";
}
choice type {
description
"The explicit route subobject type";
case num-unnum-hop {
container num-unnum-hop {
leaf node-id {
//type te-node-id;
type string;
description
"The identifier of a node in the TE topology.";
}
leaf link-tp-id {
//type te-tp-id;
type string;
description
"TE link termination point identifier. The combination
of TE link ID and the TE node ID is used to identify an
unnumbered TE link.";
}
leaf hop-type {
type te-hop-type;
description "strict or loose hop";
}
description
"Numbered and Unnumbered link/node explicit route
subobject";
}
}
case label {
container label-hop {
description "Label hop type";
uses effective-freq-slot;
}
description
"The Label ERO subobject";
}
case hop-attribute{
uses gnpypc:hop-attribute ;
}
}
}
grouping common-constraints_config {
description
"Common constraints grouping that can be set on
a constraint set or directly on the tunnel";
container te-bandwidth {
uses gnpy-specific-parameters ;
description
"A requested bandwidth to use for path computation";
}
}
grouping end-points {
description
"Common grouping to define the TE tunnel end-points";
leaf source {
type string;
description "TE tunnel source address.";
}
leaf destination {
type string;
description "P2P tunnel destination address";
}
leaf src-tp-id {
type string;
description "TE tunnel source termination point identifier.";
}
leaf dst-tp-id {
type string;
description "TE tunnel destination termination point
identifier.";
}
}
grouping synchronization-info {
description "Information for sync";
list synchronization {
key "synchronization-id";
description "sync list";
leaf synchronization-id {
type string;
description "index";
}
container svec {
description
"Synchronization VECtor";
leaf relaxable {
type boolean;
default true;
description
"If this leaf is true, path computation process is free
to ignore svec content.
otherwise it must take into account this svec.";
}
uses generic-path-disjointness;
leaf-list request-id-number {
type string;
description "This list reports the set of M path computation requests that must be synchronized.";
}
}
}
}
grouping path-metric {
description "TE path metric type";
leaf metric-type {
type identityref {
base path-metric-type;
}
description "TE path metric type";
}
leaf accumulative-value {
type decimal64 {
fraction-digits 2;
}
description "TE path metric accumulative value";
}
}
grouping generic-path-properties {
description "TE generic path properties grouping";
container path-properties {
config false;
description "The TE path properties";
list path-metric {
key metric-type;
uses path-metric;
}
list z-a-path-metric {
key metric-type;
uses path-metric;
}
list path-route-objects {
description
"Container for the list of route objects either returned by
the computation engine or actually used by an LSP";
container path-route-object {
description
"List of route objects either returned by the computation
engine or actually used by an LSP";
uses explicit-route-hop;
}
}
}
}
grouping path-info {
uses generic-path-properties;
description "Path computation output information";
}
// adding some blocking reasons and info on path in case of blocking
grouping no-path-info {
description "no-path-info";
container no-path {
presence "Response without path information, due to failure
performing the path computation";
leaf no-path {
type string;
mandatory true ;
description
"returned blocking reasons:
NO_PATH
NO_COMPUTED_SNR
NO_FEASIBLE_BAUDRATE_WITH_SPACING
NO_PATH_WITH_CONSTRAINT
NO_FEASIBLE_MODE
MODE_NOT_FEASIBLE
NO_SPECTRUM
";
}
uses generic-path-properties ;
description "if path computation cannot identify a path,
rpc returns no path.";
}
}
grouping service {
list path-request {
key "request-id";
description "request-list";
leaf request-id {
type string;
mandatory true;
description "Each path computation request is uniquely identified by the request-id-number.";
}
leaf bidirectional {
type boolean;
mandatory true;
description "Specify the bidirectionality of the path";
}
uses end-points;
uses path-route-objects;
uses generic-path-constraints;
}
uses synchronization-info;
}
grouping result {
list response {
key response-id;
config false;
description "response";
leaf response-id {
type string;
description
"The list key that has to reuse request-id-number.";
}
choice response-type {
config false;
description "response-type";
case no-path-case {
uses no-path-info;
}
case path-case {
uses path-info;
description "Path computation service.";
}
}
}
}
}

View File

@@ -0,0 +1,632 @@
module gnpy-path-computation {
yang-version 1.1;
namespace "gnpy:gnpy-path-computation";
prefix "gnpypc";
organization
"Telecom Infra Project OOPT PSE Working Group";
contact
"WG Web: <https://github.com/Telecominfraproject/oopt-gnpy>
contact: <mailto:ahmed.triki@orange.com>
contact: <mailto:esther.lerouzic@orange.com>
";
description "YANG model for gnpy path computation simplified for - 2020 - candi preversion";
revision "2025-01-20" {
description
"Add tx_power";
reference
"YANG model for path computation with gnpy inputs";
}
revision "2022-12-01" {
description
"draft for detecon - GNPy API";
reference
"YANG model for path computation with gnpy inputs";
}
grouping effective-freq-slot{
/* content copied from ietf-flexi-grid-media-channel, because only M and N are needed
from the initial grouping.
*/
description "The effective frequency slot is an attribute
of a media channel and, being a frequency slot, it is
described by its nominal central frequency and slot
width";
reference "rfc7698";
leaf N {
type union {
type int32;
type empty;
}
description
"Is used to determine the Nominal Central
Frequency. The set of nominal central frequencies
can be built using the following expression:
f = 193.1 THz + n x 0.00625 THz,
where 193.1 THz is ITU-T ''anchor frequency'' for
transmission over the C band, n is a positive or
negative integer including 0.";
reference "rfc7698";
}
leaf M {
type union {
type uint32;
type empty;
}
description
"Is used to determine the slot width. A slot width
is constrained to be M x SWG (that is, M x 12.5 GHz),
where M is an integer greater than or equal to 1.";
reference "rfc7698";
}
}
grouping gnpy-specific-parameters{
description
"This grouping defines the gnpy specific parameters for requests.";
leaf technology {
type string;
default "flexi-grid";
description
"Data plane technology type.";
}
leaf trx_type {
type string ;
mandatory true;
description "name of the transceiver type (to be read from equipment library";
}
leaf trx_mode {
type union {
type string;
type empty;
}
description "name of the transceiver mode (to be read from equipment library";
}
list effective-freq-slot {
key "N";
uses effective-freq-slot ;
}
leaf spacing {
mandatory true;
type decimal64 {
fraction-digits 1;
}
units Hz;
description
"It is the spacing between channels assuming full load with
same channels as the requested one. multiple of 12.5 GHz";
}
leaf max-nb-of-channel{
type union {
type int32;
type empty;
}
description "Nb of channel to take into account for the full load case.
";
}
leaf output-power{
type union {
type decimal64 {
fraction-digits 5;
}
type empty;
}
units W;
description "optical power setting to be used for the propagation";
}
leaf tx_power{
type union {
type decimal64 {
fraction-digits 5;
}
type empty;
}
units W;
description "optical power out of transceiver";
}
leaf path_bandwidth{
type decimal64 {
fraction-digits 1;
}
mandatory true;
units bit/s;
description "Capacity required";
}
}
identity SNR-bandwidth {
base path-metric-type;
description
"A metric that records SNR in signal bandwidth";
}
identity OSNR-bandwidth {
base path-metric-type;
description
"A metric that records OSNR in signal bandwidth";
}
identity SNR-0.1nm {
base path-metric-type;
description
"A metric that records SNR in 0.1nm";
}
identity OSNR-0.1nm {
base path-metric-type;
description
"A metric that records OSNR in 0.1nm";
}
identity lowest_SNR-0.1nm {
base path-metric-type;
description
"A metric that records the lowest SNR in 0.1nm in spectrum";
}
identity PDL_penalty {
base path-metric-type;
description
"A metric that records the PDL penalty.";
}
identity PMD_penalty {
base path-metric-type;
description
"A metric that records the PMD penalty.";
}
identity CD_penalty {
base path-metric-type;
description
"A metric that records the CD penalty.";
}
identity reference_power {
base path-metric-type;
description
"to be revised";
}
identity path_bandwidth {
base path-metric-type;
description
"to be revised";
}
grouping transponder{
leaf transponder-type {
type string ;
description
"transceiver type.";
}
leaf transponder-mode {
type string ;
description
"transceiver mode.";
}
}
grouping hop-attribute{
description
"This grouping defines the hop attribute parameters for request or response";
choice hop-type{
case tsp {
container transponder {
uses transponder ;
}
}
case regen {
container regenerator{
leaf regenerator-id{
type string ;
}
uses transponder ;
}
}
case pow {
container optical-power{
leaf optical-power{
type decimal64 {
fraction-digits 5;
}
units W;
description "not used yet. hop output (input??) power";
}
}
}
}
}
identity no-path-type {
description
"base for blocking reasons";
}
identity NO_PATH {
base no-path-type;
}
identity NO_PATH_WITH_CONSTRAINT {
base no-path-type;
}
identity NO_FEASIBLE_BAUDRATE_WITH_SPACING {
base no-path-type;
}
identity NO_COMPUTED_SNR {
base no-path-type;
}
identity MODE_NOT_FEASIBLE {
base no-path-type;
}
identity NO_FEASIBLE_MODE {
base no-path-type;
}
identity NO_SPECTRUM {
base no-path-type;
}
identity NOT_ENOUGH_RESERVED_SPECTRUM {
base no-path-type;
}
identity path-metric-type {
description
"Base identity for path metric type";
}
identity route-usage-type {
description
"Base identity for route usage";
}
identity route-include-ero {
base route-usage-type;
description
"Include ERO from route";
}
identity route-exclude-ero {
base route-usage-type;
description
"Exclude ERO from route";
}
identity route-exclude-srlg {
base route-usage-type;
description
"Exclude SRLG from route";
}
typedef te-hop-type {
type enumeration {
enum LOOSE {
description
"loose hop in an explicit path";
}
enum STRICT {
description
"strict hop in an explicit path";
}
}
description
"enumerated type for specifying loose or strict
paths";
reference "RFC3209: section-4.3.2";
}
typedef te-path-disjointness {
type bits {
bit node {
position 0;
description "Node disjoint.";
}
bit link {
position 1;
description "Link disjoint.";
}
bit srlg {
position 2;
description "SRLG (Shared Risk Link Group) disjoint.";
}
}
description
"Type of the resource disjointness for a TE tunnel path.";
reference
"RFC4872: RSVP-TE Extensions in Support of End-to-End
Generalized Multi-Protocol Label Switching (GMPLS)
Recovery";
} // te-path-disjointness
typedef accumulated-metric-type {
type union {
type uint64;
type decimal64 {
fraction-digits 2;
}
}
description
"type useable for accumulative-value";
}
grouping path-route-objects {
description
"List of EROs to be included or excluded when performing
the path computation.";
container explicit-route-objects {
description
"Container for the route object list";
list route-object-include-exclude {
description
"List of explicit route objects to include or
exclude in path computation";
leaf explicit-route-usage {
type identityref {
base route-usage-type;
}
description "Explicit-route usage.";
}
key "index";
uses explicit-route-hop ;
}
}
}
grouping generic-path-disjointness {
description "Path disjointness grouping";
leaf disjointness {
type te-path-disjointness;
description
"The type of resource disjointness.
Under primary path, disjointness level applies to
all secondary LSPs. Under secondary, disjointness
level overrides the one under primary";
}
}
grouping common-path-constraints-attributes {
description
"Common path constraints configuration grouping";
uses common-constraints_config;
}
grouping generic-path-constraints {
description
"Global named path constraints configuration
grouping";
container path-constraints {
description "TE named path constraints container";
uses common-path-constraints-attributes;
}
}
grouping explicit-route-hop {
description
"The explicit route subobject grouping";
leaf index {
type uint32;
description "ERO subobject index";
}
choice subobject-type {
description
"The explicit route subobject type";
case num-unnum-hop {
container num-unnum-hop {
leaf node-id {
//type te-node-id;
type string;
description
"The identifier of a node in the TE topology.";
}
leaf link-tp-id {
//type te-tp-id;
type string;
description
"TE link termination point identifier. The combination
of TE link ID and the TE node ID is used to identify an
unnumbered TE link.";
}
leaf hop-type {
type te-hop-type;
description "strict or loose hop";
}
description
"Numbered and Unnumbered link/node explicit route
subobject";
}
}
case label {
list label-hop {
description "Label hop type";
config false;
uses effective-freq-slot;
}
description
"The Label ERO subobject";
}
case hop-attribute{
uses gnpypc:hop-attribute ;
}
}
}
grouping common-constraints_config {
description
"Common constraints grouping that can be set on
a constraint set or directly on the tunnel";
container te-bandwidth {
uses gnpy-specific-parameters ;
description
"A requested bandwidth to use for path computation";
}
}
grouping end-points {
description
"Common grouping to define the TE tunnel end-points";
leaf source {
type string;
description "TE tunnel source address.";
}
leaf destination {
type string;
description "P2P tunnel destination address";
}
leaf src-tp-id {
type string;
description "TE tunnel source termination point identifier.";
}
leaf dst-tp-id {
type string;
description "TE tunnel destination termination point
identifier.";
}
}
grouping synchronization-info {
description "Information for sync";
list synchronization {
key "synchronization-id";
description "sync list";
leaf synchronization-id {
type string;
description "index";
}
container svec {
description
"Synchronization VECtor";
leaf relaxable {
type boolean;
default true;
description
"If this leaf is true, path computation process is free
to ignore svec content.
otherwise it must take into account this svec.";
}
uses generic-path-disjointness;
leaf-list request-id-number {
type string;
description "This list reports the set of M path computation requests that must be synchronized.";
}
}
}
}
grouping service {
list path-request {
key "request-id";
description "request-list";
leaf request-id {
type string;
mandatory true;
description "Each path computation request is uniquely identified by the request-id-number.";
}
leaf bidirectional {
type boolean;
mandatory true;
description "Specify the bidirectionality of the path";
}
uses end-points;
uses path-route-objects;
uses generic-path-constraints;
}
uses synchronization-info;
}
grouping accumulated-metric-object {
leaf metric-type {
type identityref {
base path-metric-type;
}
}
leaf accumulative-value {
type union {
type decimal64 {
fraction-digits 1;
}
type decimal64 {
fraction-digits 2;
}
type decimal64 {
fraction-digits 6;
}
type string;
}
}
}
grouping response-path-property {
list path-metric {
uses accumulated-metric-object;
}
list z-a-path-metric {
uses accumulated-metric-object;
}
}
grouping response-path-route-object {
list path-route-objects {
container path-route-object {
uses explicit-route-hop ;
}
}
}
grouping response {
list response {
config false;
key response-id;
leaf response-id {
type string;
mandatory true;
description "Each path computation response is uniquely identified by the response-id number.";
}
container path-properties {
uses response-path-property;
uses response-path-route-object;
}
container no-path {
leaf no-path {
type identityref {
base no-path-type;
}
}
container path-properties {
uses response-path-property;
uses response-path-route-object;
}
}
}
}
container services {
uses service;
}
container responses {
uses response;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,771 @@
module ietf-routing-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
prefix rt-types;
import ietf-yang-types {
prefix yang;
}
import ietf-inet-types {
prefix inet;
}
organization
"IETF RTGWG - Routing Area Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/rtgwg/>
WG List: <mailto:rtgwg@ietf.org>
Editors: Xufeng Liu
<mailto:Xufeng_Liu@jabail.com>
Yingzhen Qu
<mailto:yingzhen.qu@huawei.com>
Acee Lindem
<mailto:acee@cisco.com>
Christian Hopps
<mailto:chopps@chopps.org>
Lou Berger
<mailto:lberger@labn.com>";
description
"This module contains a collection of YANG data types
considered generally useful for routing protocols.
Copyright (c) 2017 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 8294; see
the RFC itself for full legal notices.";
revision 2017-12-04 {
description "Initial revision.";
reference
"RFC 8294: Common YANG Data Types for the Routing Area.
Section 3.";
}
/*** Identities related to MPLS/GMPLS ***/
identity mpls-label-special-purpose-value {
description
"Base identity for deriving identities describing
special-purpose Multiprotocol Label Switching (MPLS) label
values.";
reference
"RFC 7274: Allocating and Retiring Special-Purpose MPLS
Labels.";
}
identity ipv4-explicit-null-label {
base mpls-label-special-purpose-value;
description
"This identity represents the IPv4 Explicit NULL Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity router-alert-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Router Alert Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity ipv6-explicit-null-label {
base mpls-label-special-purpose-value;
description
"This identity represents the IPv6 Explicit NULL Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity implicit-null-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Implicit NULL Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity entropy-label-indicator {
base mpls-label-special-purpose-value;
description
"This identity represents the Entropy Label Indicator.";
reference
"RFC 6790: The Use of Entropy Labels in MPLS Forwarding.
Sections 3 and 10.1.";
}
identity gal-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Generic Associated Channel
(G-ACh) Label (GAL).";
reference
"RFC 5586: MPLS Generic Associated Channel.
Sections 4 and 10.";
}
identity oam-alert-label {
base mpls-label-special-purpose-value;
description
"This identity represents the OAM Alert Label.";
reference
"RFC 3429: Assignment of the 'OAM Alert Label' for
Multiprotocol Label Switching Architecture (MPLS)
Operation and Maintenance (OAM) Functions.
Sections 3 and 6.";
}
identity extension-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Extension Label.";
reference
"RFC 7274: Allocating and Retiring Special-Purpose MPLS
Labels. Sections 3.1 and 5.";
}
/*** Collection of types related to routing ***/
typedef router-id {
type yang:dotted-quad;
description
"A 32-bit number in the dotted-quad format assigned to each
router. This number uniquely identifies the router within
an Autonomous System.";
}
/*** Collection of types related to VPNs ***/
typedef route-target {
type string {
pattern
'(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
+ '42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
+ '42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
+ '42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
+ '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
+ '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
+ '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
+ '655[0-2][0-9]|'
+ '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(2:(429496729[0-5]|42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|'
+ '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|'
+ '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(6(:[a-fA-F0-9]{2}){6})|'
+ '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
+ '[0-9a-fA-F]{1,12})';
}
description
"A Route Target is an 8-octet BGP extended community
initially identifying a set of sites in a BGP VPN
(RFC 4364). However, it has since taken on a more general
role in BGP route filtering. A Route Target consists of two
or three fields: a 2-octet Type field, an administrator
field, and, optionally, an assigned number field.
According to the data formats for types 0, 1, 2, and 6 as
defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
pattern is defined as:
0:2-octet-asn:4-octet-number
1:4-octet-ipv4addr:2-octet-number
2:4-octet-asn:2-octet-number
6:6-octet-mac-address
Additionally, a generic pattern is defined for future
Route Target types:
2-octet-other-hex-number:6-octet-hex-number
Some valid examples are 0:100:100, 1:1.1.1.1:100,
2:1234567890:203, and 6:26:00:08:92:78:00.";
reference
"RFC 4360: BGP Extended Communities Attribute.
RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 5668: 4-Octet AS Specific BGP Extended Community.
RFC 7432: BGP MPLS-Based Ethernet VPN.";
}
typedef ipv6-route-target {
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]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
}
description
"An IPv6 Route Target is a 20-octet BGP IPv6 Address
Specific Extended Community serving the same function
as a standard 8-octet Route Target, except that it only
allows an IPv6 address as the global administrator.
The format is <ipv6-address:2-octet-number>.
Two valid examples are 2001:db8::1:6544 and
2001:db8::5eb1:791:6b37:17958.";
reference
"RFC 5701: IPv6 Address Specific BGP Extended Community
Attribute.";
}
typedef route-target-type {
type enumeration {
enum import {
value 0;
description
"The Route Target applies to route import.";
}
enum export {
value 1;
description
"The Route Target applies to route export.";
}
enum both {
value 2;
description
"The Route Target applies to both route import and
route export.";
}
}
description
"Indicates the role a Route Target takes in route filtering.";
reference
"RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
}
typedef route-distinguisher {
type string {
pattern
'(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
+ '42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
+ '42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
+ '42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
+ '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
+ '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
+ '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
+ '655[0-2][0-9]|'
+ '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(2:(429496729[0-5]|42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|'
+ '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|'
+ '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(6(:[a-fA-F0-9]{2}){6})|'
+ '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
+ '[0-9a-fA-F]{1,12})';
}
description
"A Route Distinguisher is an 8-octet value used to
distinguish routes from different BGP VPNs (RFC 4364).
A Route Distinguisher will have the same format as a
Route Target as per RFC 4360 and will consist of
two or three fields: a 2-octet Type field, an administrator
field, and, optionally, an assigned number field.
According to the data formats for types 0, 1, 2, and 6 as
defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
pattern is defined as:
0:2-octet-asn:4-octet-number
1:4-octet-ipv4addr:2-octet-number
2:4-octet-asn:2-octet-number
6:6-octet-mac-address
Additionally, a generic pattern is defined for future
route discriminator types:
2-octet-other-hex-number:6-octet-hex-number
Some valid examples are 0:100:100, 1:1.1.1.1:100,
2:1234567890:203, and 6:26:00:08:92:78:00.";
reference
"RFC 4360: BGP Extended Communities Attribute.
RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 5668: 4-Octet AS Specific BGP Extended Community.
RFC 7432: BGP MPLS-Based Ethernet VPN.";
}
typedef route-origin {
type string {
pattern
'(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
+ '42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
+ '42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
+ '42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
+ '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
+ '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
+ '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
+ '655[0-2][0-9]|'
+ '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(2:(429496729[0-5]|42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|'
+ '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|'
+ '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(6(:[a-fA-F0-9]{2}){6})|'
+ '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
+ '[0-9a-fA-F]{1,12})';
}
description
"A Route Origin is an 8-octet BGP extended community
identifying the set of sites where the BGP route
originated (RFC 4364). A Route Origin will have the same
format as a Route Target as per RFC 4360 and will consist
of two or three fields: a 2-octet Type field, an
administrator field, and, optionally, an assigned number
field.
According to the data formats for types 0, 1, 2, and 6 as
defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
pattern is defined as:
0:2-octet-asn:4-octet-number
1:4-octet-ipv4addr:2-octet-number
2:4-octet-asn:2-octet-number
6:6-octet-mac-address
Additionally, a generic pattern is defined for future
Route Origin types:
2-octet-other-hex-number:6-octet-hex-number
Some valid examples are 0:100:100, 1:1.1.1.1:100,
2:1234567890:203, and 6:26:00:08:92:78:00.";
reference
"RFC 4360: BGP Extended Communities Attribute.
RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 5668: 4-Octet AS Specific BGP Extended Community.
RFC 7432: BGP MPLS-Based Ethernet VPN.";
}
typedef ipv6-route-origin {
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]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
}
description
"An IPv6 Route Origin is a 20-octet BGP IPv6 Address
Specific Extended Community serving the same function
as a standard 8-octet route, except that it only allows
an IPv6 address as the global administrator. The format
is <ipv6-address:2-octet-number>.
Two valid examples are 2001:db8::1:6544 and
2001:db8::5eb1:791:6b37:17958.";
reference
"RFC 5701: IPv6 Address Specific BGP Extended Community
Attribute.";
}
/*** Collection of types common to multicast ***/
typedef ipv4-multicast-group-address {
type inet:ipv4-address {
pattern '(2((2[4-9])|(3[0-9]))\.).*';
}
description
"This type represents an IPv4 multicast group address,
which is in the range of 224.0.0.0 to 239.255.255.255.";
reference
"RFC 1112: Host Extensions for IP Multicasting.";
}
typedef ipv6-multicast-group-address {
type inet:ipv6-address {
pattern '(([fF]{2}[0-9a-fA-F]{2}):).*';
}
description
"This type represents an IPv6 multicast group address,
which is in the range of ff00::/8.";
reference
"RFC 4291: IP Version 6 Addressing Architecture. Section 2.7.
RFC 7346: IPv6 Multicast Address Scopes.";
}
typedef ip-multicast-group-address {
type union {
type ipv4-multicast-group-address;
type ipv6-multicast-group-address;
}
description
"This type represents a version-neutral IP multicast group
address. The format of the textual representation implies
the IP version.";
}
typedef ipv4-multicast-source-address {
type union {
type enumeration {
enum * {
description
"Any source address.";
}
}
type inet:ipv4-address;
}
description
"Multicast source IPv4 address type.";
}
typedef ipv6-multicast-source-address {
type union {
type enumeration {
enum * {
description
"Any source address.";
}
}
type inet:ipv6-address;
}
description
"Multicast source IPv6 address type.";
}
/*** Collection of types common to protocols ***/
typedef bandwidth-ieee-float32 {
type string {
pattern
'0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
+ '1(\.([0-9a-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
+ '1[01][0-9]|0?[0-9]?[0-9])?)';
}
description
"Bandwidth in IEEE 754 floating-point 32-bit binary format:
(-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
where Exponent uses 8 bits and Fraction uses 23 bits.
The units are octets per second.
The encoding format is the external hexadecimal-significant
character sequences specified in IEEE 754 and ISO/IEC C99.
The format is restricted to be normalized, non-negative, and
non-fraction: 0x1.hhhhhhp{+}d, 0X1.HHHHHHP{+}D, or 0x0p0,
where 'h' and 'H' are hexadecimal digits and 'd' and 'D' are
integers in the range of [0..127].
When six hexadecimal digits are used for 'hhhhhh' or
'HHHHHH', the least significant digit must be an even
number. 'x' and 'X' indicate hexadecimal; 'p' and 'P'
indicate a power of two. Some examples are 0x0p0, 0x1p10,
and 0x1.abcde2p+20.";
reference
"IEEE Std 754-2008: IEEE Standard for Floating-Point
Arithmetic.
ISO/IEC C99: Information technology - Programming
Languages - C.";
}
typedef link-access-type {
type enumeration {
enum broadcast {
description
"Specify broadcast multi-access network.";
}
enum non-broadcast-multiaccess {
description
"Specify Non-Broadcast Multi-Access (NBMA) network.";
}
enum point-to-multipoint {
description
"Specify point-to-multipoint network.";
}
enum point-to-point {
description
"Specify point-to-point network.";
}
}
description
"Link access type.";
}
typedef timer-multiplier {
type uint8;
description
"The number of timer value intervals that should be
interpreted as a failure.";
}
typedef timer-value-seconds16 {
type union {
type uint16 {
range "1..65535";
}
type enumeration {
enum infinity {
description
"The timer is set to infinity.";
}
enum not-set {
description
"The timer is not set.";
}
}
}
units "seconds";
description
"Timer value type, in seconds (16-bit range).";
}
typedef timer-value-seconds32 {
type union {
type uint32 {
range "1..4294967295";
}
type enumeration {
enum infinity {
description
"The timer is set to infinity.";
}
enum not-set {
description
"The timer is not set.";
}
}
}
units "seconds";
description
"Timer value type, in seconds (32-bit range).";
}
typedef timer-value-milliseconds {
type union {
type uint32 {
range "1..4294967295";
}
type enumeration {
enum infinity {
description
"The timer is set to infinity.";
}
enum not-set {
description
"The timer is not set.";
}
}
}
units "milliseconds";
description
"Timer value type, in milliseconds.";
}
typedef percentage {
type uint8 {
range "0..100";
}
description
"Integer indicating a percentage value.";
}
typedef timeticks64 {
type uint64;
description
"This type is based on the timeticks type defined in
RFC 6991, but with 64-bit width. It represents the time,
modulo 2^64, in hundredths of a second between two epochs.";
reference
"RFC 6991: Common YANG Data Types.";
}
typedef uint24 {
type uint32 {
range "0..16777215";
}
description
"24-bit unsigned integer.";
}
/*** Collection of types related to MPLS/GMPLS ***/
typedef generalized-label {
type binary;
description
"Generalized Label. Nodes sending and receiving the
Generalized Label are aware of the link-specific
label context and type.";
reference
"RFC 3471: Generalized Multi-Protocol Label Switching (GMPLS)
Signaling Functional Description. Section 3.2.";
}
typedef mpls-label-special-purpose {
type identityref {
base mpls-label-special-purpose-value;
}
description
"This type represents the special-purpose MPLS label values.";
reference
"RFC 3032: MPLS Label Stack Encoding.
RFC 7274: Allocating and Retiring Special-Purpose MPLS
Labels.";
}
typedef mpls-label-general-use {
type uint32 {
range "16..1048575";
}
description
"The 20-bit label value in an MPLS label stack as specified
in RFC 3032. This label value does not include the
encodings of Traffic Class and TTL (Time to Live).
The label range specified by this type is for general use,
with special-purpose MPLS label values excluded.";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
typedef mpls-label {
type union {
type mpls-label-special-purpose;
type mpls-label-general-use;
}
description
"The 20-bit label value in an MPLS label stack as specified
in RFC 3032. This label value does not include the
encodings of Traffic Class and TTL.";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
/*** Groupings **/
grouping mpls-label-stack {
description
"This grouping specifies an MPLS label stack. The label
stack is encoded as a list of label stack entries. The
list key is an identifier that indicates the relative
ordering of each entry, with the lowest-value identifier
corresponding to the top of the label stack.";
container mpls-label-stack {
description
"Container for a list of MPLS label stack entries.";
list entry {
key "id";
description
"List of MPLS label stack entries.";
leaf id {
type uint8;
description
"Identifies the entry in a sequence of MPLS label
stack entries. An entry with a smaller identifier
value precedes an entry with a larger identifier
value in the label stack. The value of this ID has
no semantic meaning other than relative ordering
and referencing the entry.";
}
leaf label {
type rt-types:mpls-label;
description
"Label value.";
}
leaf ttl {
type uint8;
description
"Time to Live (TTL).";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
leaf traffic-class {
type uint8 {
range "0..7";
}
description
"Traffic Class (TC).";
reference
"RFC 5462: Multiprotocol Label Switching (MPLS) Label
Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
Field.";
}
}
}
}
grouping vpn-route-targets {
description
"A grouping that specifies Route Target import-export rules
used in BGP-enabled VPNs.";
reference
"RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 4664: Framework for Layer 2 Virtual Private Networks
(L2VPNs).";
list vpn-target {
key "route-target";
description
"List of Route Targets.";
leaf route-target {
type rt-types:route-target;
description
"Route Target value.";
}
leaf route-target-type {
type rt-types:route-target-type;
mandatory true;
description
"Import/export type of the Route Target.";
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

11
samples/fake_sample.py Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Examples of api calls
"""
# for the moment just launch gnpy to check everything is OK
from gnpy.tools.cli_examples import transmission_main_example
transmission_main_example()

View File

@@ -3,8 +3,29 @@
# @Author: Esther Le Rouzic
# @Date: 2025-02-03
from pathlib import Path
import subprocess
import pytest # noqa: F401
YANG_DIR = Path(__file__).parent.parent / 'gnpyapi' / 'yang'
SAMPLE_DIR = Path(__file__).parent.parent / 'samples'
def test_sample():
"""Just for the ci
"""
assert True
res = subprocess.run(['python', SAMPLE_DIR / 'fake_sample.py'],
stdout=subprocess.PIPE, check=True)
if res.returncode != 0:
assert False, f'gnpy call failed: exit code {res.returncode}'
def test_pyang():
"""Verify that yang models pss pyang
"""
res = subprocess.run(['pyang', '-f', 'tree', '--tree-line-length', '69',
'-p', YANG_DIR, YANG_DIR / 'gnpy-api@2021-01-06.yang'],
stdout=subprocess.PIPE, check=True)
if res.returncode != 0:
assert False, f'pyang failed: exit code {res.returncode}'