fix gnpy model
[transportpce.git] / api / src / main / yang / gnpy-network-topology@2022-06-15.yang
diff --git a/api/src/main/yang/gnpy-network-topology@2022-06-15.yang b/api/src/main/yang/gnpy-network-topology@2022-06-15.yang
new file mode 100644 (file)
index 0000000..36db565
--- /dev/null
@@ -0,0 +1,352 @@
+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 -
+    The license used for all the yang files of GNPy is BSD 3-Clause License
+
+    BSD 3-Clause License
+
+    Copyright (c) 2018, Telecom Infra Project
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    * Neither the name of the copyright holder nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
+
+  revision 2022-06-15 {
+    description
+      "change fraction digits from 2 to 5 for loss_coef leaf";
+    reference
+      "YANG model for api input for path computation with gnpy";
+  }
+
+  revision 2022-02-21 {
+    description
+      "draft for GNPy4TPCE preversion - non official version relevant for v2.4 GNPy file format";
+    reference
+      "YANG model for api 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";
+  }
+
+  revision 2019-01-03 {
+    description
+      "first draft for GNPy4TPCE preversion - non official version relevant for v1.2 GNPy file format";
+    reference
+      "YANG model for api 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 5;
+      }
+      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";
+        }
+      }
+    }
+  }
+}