Refactor folder structure.
[sim/o1-interface.git] / ntsimulator / yang / x-ran / xran-software-management.yang
diff --git a/ntsimulator/yang/x-ran/xran-software-management.yang b/ntsimulator/yang/x-ran/xran-software-management.yang
new file mode 100644 (file)
index 0000000..0759cd6
--- /dev/null
@@ -0,0 +1,539 @@
+module xran-software-management {
+  yang-version 1.1;
+  namespace "urn:xran:software-management:1.0";
+  prefix xran-swm;
+
+  import ietf-inet-types {
+    prefix "inet";
+    revision-date 2013-07-15;
+  }
+
+  import ietf-hardware {
+    prefix "hw";
+  }
+
+  import xran-hardware {
+    prefix "xran-hw";
+  }
+
+  organization "xRAN Forum";
+
+  contact
+    "www.xran.org";
+
+  description
+    "This module defines operations and configuration for the management of software packages.
+    This module is derived out of opencpe-firmware-mgmt@2014-02-06.yang
+
+    Copyright 2018 the xRAN Forum.
+
+    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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the xRAN Forum nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2018-07-20" {
+    description
+      "version 1.0.0 - First release of the xRAN YANG M-Plane models.
+
+      This version of the model supports v01.00 of the corrsponding xRAN
+      M-Plane Specification.";
+    reference "XRAN-FH.MP.0-v01.00";
+  }
+
+  // typedef statements
+
+  container software-inventory {
+    config false;
+    description
+      "Contains information about each software slot and its content.";
+
+    list software-slot {
+      key name;
+      min-elements 2;
+
+      description
+        "Information about available software-slots and their software.";
+
+      leaf name {
+        type string;
+
+        description
+          "Name of the software package. This shall be unique to identify the software-slot.";
+      }
+
+      leaf status {
+        type enumeration {
+          enum VALID {
+            description
+              "Slot Contains software build considered as proven valid";
+          }
+          enum INVALID {
+            description
+              "software build is not currently used by RU. The software is considered by RU as damaged (e.g. wrong CRC)";
+          }
+          enum EMPTY {
+            description
+              "W slot does not contain software package.";
+          }
+        }
+        config false;
+        mandatory true;
+
+        description "Indicates the status of the software slot";
+      }
+
+      leaf active {
+          type boolean;
+      must "../status = 'VALID'";
+        config false;
+          description
+            "informs if software stored in particular slot is activated at the moment";
+      }
+
+      leaf running {
+          type boolean;
+      must "../status = 'VALID'";
+        config false;
+          description
+            "informs if software stored in particular slot is used at the moment";
+      }
+
+      leaf access {
+        type enumeration {
+          enum READ_ONLY {
+            description
+              "slot intended only for factory software,
+              activation of such software slot means getting back to factory defaults";
+          }
+          enum READ_WRITE {
+            description
+              "slot used for updating software";
+          }
+        }
+        default READ_WRITE;
+        config false;
+
+        description
+          "Indicates the writability of the slot.
+          A Read-Only software slot is one which has a factory installed software-slot";
+      }
+
+      leaf product-code {
+        type leafref {
+               path "/hw:hardware/hw:component/xran-hw:product-code";
+               }
+        config false;
+
+        description "product code provided by the vendor, specific to the product. This is derived from manifest file.";
+      }
+
+      leaf vendor-code {
+        type string {
+          length 1..2;
+        }
+        config false;
+
+        description
+          "Unique code of the vendor. This is derived from manifest file.";
+      }
+
+      leaf build-id {
+        type string;
+        config false;
+
+        description
+          "Identity associated with the software build. This is derived from manifest file.";
+      }
+
+      leaf build-name {
+        type string;
+        config false;
+
+        description
+          "Name of the build. This is derived from manifest file.";
+      }
+
+      leaf build-version {
+        type leafref{
+               path "/hw:hardware/hw:component/hw:software-rev";
+               }
+        description "Version of the software build. This is derived from manifest file.";
+      }
+
+      list files {
+        key "name";
+        config false;
+
+        description "List of all the files present in the software package.";
+
+        leaf name {
+          type string;
+
+          description
+            "Name of the file installed in the slot.";
+        }
+
+        leaf version {
+          type string;
+
+          description
+            "Version of the file installed in the slot";
+        }
+        leaf local-path {
+          type string;
+          mandatory true;
+
+          description
+            "Complete path of the file stored locally";
+        }
+
+        leaf integrity {
+          type enumeration {
+            enum OK {
+              description "OK - indicates that file integrity is correct";
+            }
+            enum NOK {
+              description "NOK - indicates corrupted file";
+            }
+          }
+          config false;
+
+          description
+            "Result of the file integrity check (checksum calculation) during installation.";
+        }
+      }
+    }
+  }
+    // rpc statements
+
+  rpc software-download {
+    description
+      "Rpc needed to perform software download operation.";
+
+    input {
+      leaf remote-file-path {
+        type inet:uri;
+        mandatory true;
+        description
+          "URI of the software image including username.
+          The following format is possible:
+          sftp://<username>@<host>[:<port>]";
+      }
+
+      choice credentials {
+        description
+          "Type of authentication to use for software downloads.";
+
+        case password {
+          container password {
+            presence true;
+            leaf password {
+              type string;
+              mandatory true;
+
+              description
+                "password needed for authentication.";
+            }
+
+            description
+              "password authentication method in use";
+          }
+        }
+        case certificate {
+          container certificate {
+            presence true;
+            description
+              "certificate authentication method in use";
+          }
+        }
+      }
+    }
+    output {
+      leaf status {
+        type enumeration {
+          enum STARTED {
+            description
+              "Operation has been started without error.";
+          }
+          enum FAILED {
+            description
+              "Operation cannot be started because of error, more detailed information can be found in error-message.";
+          }
+        }
+        mandatory true;
+
+        description
+          "Status of the software files download";
+      }
+      leaf error-message {
+        when "../status = 'FAILED'";
+        type string;
+
+        description
+          "Detailed error Message when the status is failed.";
+      }
+
+      leaf notification-timeout {
+        type int32;
+        units seconds;
+        default 30;
+
+        description
+          "Notification timeout is the time NETCONF client shall
+          wait for a 'download-event' notification from RU. If there is no
+          'download-event' notification received within notification-timeout,
+          NETCONF client shall assume the download timeout/failure, and follow necessary steps.";
+      }
+    }
+  }
+
+  rpc software-install {
+    description
+      "Install a previously downloaded software package.";
+
+    input {
+      leaf slot-name {
+        type leafref {
+          path "/software-inventory/software-slot/name";
+          }
+        must "/software-inventory/software-slot[name = current()][active = 'false' and running = 'false']" {
+          error-message "software-install may be requested only against active::false and running::false slot!";
+        }
+        mandatory true;
+
+        description
+          "software-slot to which the software shall be installed to.";
+      }
+
+      leaf-list file-names {
+        type string;
+
+        description
+          "Names of the files within software package to be installed";
+      }
+    }
+    output {
+      leaf status {
+        type enumeration {
+          enum STARTED {
+            description
+              "Operation has been started without error.";
+          }
+          enum FAILED {
+            description
+              "Operation cannot be started because of error, more detailed information can be found in error-message.";
+          }
+        }
+        mandatory true;
+
+        description
+          "Status of the software package install.";
+      }
+      leaf error-message {
+        when "../status = 'FAILED'";
+        type string;
+
+        description
+          "Detailed error Message when the status is failed.";
+      }
+    }
+  }
+
+  rpc software-activate {
+    description
+      "Activate a previously installed software.";
+    input {
+      leaf slot-name {
+        type leafref {
+          path "/software-inventory/software-slot/name";
+        }
+        mandatory true;
+
+        description
+          "Slot name on which software has to be activated.";
+      }
+    }
+    output {
+      leaf status {
+        type enumeration {
+          enum STARTED {
+            description
+              "Operation has been started without error.";
+          }
+          enum FAILED {
+            description
+              "Operation cannot be started because of error, more detailed information can be found in error-message.";
+          }
+        }
+        mandatory true;
+
+        description
+          "Status of the software files activation";
+      }
+      leaf error-message {
+        when "../status = 'FAILED'";
+        type string;
+
+        description
+          "Detailed error Message when the status is failed.";
+      }
+
+      leaf notification-timeout {
+        type int32;
+        units seconds;
+        default 30;
+
+        description
+          "Timeout on client waiting for the activate event";
+      }
+    }
+  }
+
+    // notification definitions
+  notification download-event {
+    description "Notification event structure for download completion";
+    leaf file-name {
+      type string;
+      mandatory true;
+
+      description
+        "File name of downloaded software package";
+    }
+
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed succesfully";
+        }
+        enum AUTHENTICATION_ERROR {
+          description "source available, wrong credentials";
+        }
+        enum PROTOCOL_ERROR {
+          description "SFTP errors";
+        }
+        enum FILE_NOT_FOUND {
+          description "source not available.";
+        }
+        enum APPLICATION_ERROR {
+          description "Application related errors";
+        }
+        enum TIMEOUT {
+          description "Timeout waiting for download";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+
+  }
+
+  notification install-event {
+    description "Notification event structure for installation completion";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+      }
+
+      description
+        "Name of the slot to which software was installed.";
+    }
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed succesfully";
+        }
+        enum FILE_ERROR {
+          description "operation on the file resulted in in error, disk failure, not enough disk space,
+                      incompatible file format";
+        }
+        enum INTEGRITY_ERROR {
+          description "file is corrupted";
+        }
+        enum APPLICATION_ERROR {
+          description "operation failed due to internal reason";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+
+  notification activation-event {
+    description "Notification event structure for activation completion";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+      }
+
+      description
+        "Name of the slot which was activated";
+    }
+
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed succesfully";
+        }
+        enum APPLICATION_ERROR {
+          description
+            "Operation finished with error, more details can by found in error-message";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf return-code {
+      type uint8;
+
+      description
+        "status code return when the software is tried to activate";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+}