Add WG4 yangs published 2023-03 (v11)
[scp/oam/modeling.git] / data-model / yang / published / o-ran / ru-fh / o-ran-software-management@2022-12-05.yang
diff --git a/data-model/yang/published/o-ran/ru-fh/o-ran-software-management@2022-12-05.yang b/data-model/yang/published/o-ran/ru-fh/o-ran-software-management@2022-12-05.yang
new file mode 100644 (file)
index 0000000..c47408d
--- /dev/null
@@ -0,0 +1,700 @@
+module o-ran-software-management {
+  yang-version 1.1;
+  namespace "urn:o-ran:software-management:1.0";
+  prefix o-ran-swm;
+
+  import ietf-inet-types {
+    prefix "inet";
+    revision-date 2013-07-15;
+  }
+
+  import ietf-hardware {
+    prefix "hw";
+  }
+
+  import o-ran-hardware {
+    prefix "o-ran-hw";
+  }
+
+  import o-ran-file-management {
+    prefix "o-ran-file-mgmt";
+  }
+
+  import o-ran-wg4-features {
+    prefix "or-feat";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.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 2021 the O-RAN Alliance.
+
+    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 O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2022-12-05" {
+    description
+      "version 11.0.0
+
+      1) SW Install timeout
+      2) check integrity directly after download";
+
+    reference "ORAN-WG4.M.0-v11.00";
+  }
+
+  revision "2022-08-15" {
+    description
+      "version 9.1.0
+
+      1) clarified description statements
+      2) style guide corrections
+      3) changed import prefix for o-ran-file-management";
+
+    reference "ORAN-WG4.M.0-v09.00";
+  }
+
+  revision "2022-04-18" {
+    description
+      "version 9.0.0
+
+      1) aded new parameter build-content-download";
+
+    reference "ORAN-WG4.M.0-v09.00";
+  }
+
+  revision "2021-12-01" {
+    description
+      "version 8.0.0
+
+      1) typographical corrections in descriptions
+      2) new option to use IANA private enterprise number as vendor-code";
+
+    reference "ORAN-WG4.M.0-v08.00";
+  }
+  revision "2021-07-26" {
+    description
+      "version 7.0.0
+
+      1) added FTPES support";
+
+    reference "ORAN-WG4.M.0-v07.00";
+  }
+
+  revision "2021-03-22" {
+    description
+      "version 1.1.0
+
+      1) typographical corrections in descriptions.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-07-03" {
+    description
+      "version 1.0.2
+
+      1) backward compatible changes to correct sFTP Server Authentication .
+      2) simplifying file management and authentication to reuse from o-ran-file-management module
+      3) minor fixes according to lack of descriptions
+      4) removal of not used grouping
+      5) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+
+  // groupings
+
+  grouping slot-group {
+    description
+      "Contains information about each software slot and its content.";
+    list software-slot {
+      key name;
+      min-elements 2;
+
+      description
+        "Information about available software-slots, their status, state and content.";
+
+      leaf name {
+        type string;
+
+        description
+          "Name of the software slot. This shall be unique to identify the software-slot.";
+      }
+
+      leaf status {
+        type enumeration {
+          enum VALID {
+            description
+              "Slot contains software considered as proven valid";
+          }
+          enum INVALID {
+            description
+              "Software in the slot is considered by O-RU as invalid (e.g. wrong CRC).
+              O-RU prohibits activation of slot with such status.";
+          }
+          enum EMPTY {
+            description
+              "Slot does not contain software package. O-RU prohibits activation of slot
+              with such status.";
+          }
+        }
+        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 writeability 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/o-ran-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..5;
+          pattern '(.{1,2})|(\d{1,5})';
+        }
+        config false;
+
+        description
+          "Unique code of the vendor. This is derived from manifest file.
+
+          This may be a 1 or two upper case characters or a 1-5 digit IANA Private Enterprise Number.";
+      }
+
+      leaf build-id {
+        type string;
+        config false;
+
+        description
+          "Identity associated with the software. 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 string;
+        description "The vendor-specific version string of the software build.";
+      }
+
+      list files {
+        key "name";
+        config false;
+
+        description "List of all the files present in the software slot.";
+
+        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.";
+        }
+      }
+    }
+  }
+
+  grouping download-input {
+    description
+      "Grouping for SW download RPC input";
+    leaf remote-file-path {
+      type inet:uri;
+      mandatory true;
+      description
+        "URI of the software image including username.
+        The following format is possible:
+        When file download is via sftp, the format shall be of the form
+        sftp://<username>@<host>[:<port>]/path
+        When file transfer is via FTPES, the format shall be of the form
+        ftpes://<username>@<host>[:port]/path
+
+        Note, ftpes is not an IANA registered URI scheme, but used here to signal
+        that a file transfer should be performed over FTPES.";
+    }
+
+
+    uses o-ran-file-mgmt:credential-information;
+  }
+
+  grouping download-output {
+    description
+      "Grouping for SW download RPC 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 file download";
+    }
+    leaf error-message {
+      when "../status = 'FAILED'";
+      type string;
+
+      description
+        "Detailed error Message when the status is FAILED.";
+    }
+
+    leaf notification-timeout {
+      type int32 {range "1..max";}
+      units seconds;
+      default 30;
+
+      description
+        "Notification timeout is the time NETCONF client shall
+        wait for a 'download-event' notification from O-RU. If there is no
+        'download-event' notification received within notification-timeout,
+        NETCONF client shall assume the download timeout/failure, and follow necessary steps.";
+    }
+  }
+
+  grouping install-input {
+    description
+      "Grouping for SW installation RPC 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.";
+    }
+
+    leaf-list file-names {
+      type string;
+
+      description
+        "Names of the files within software package to be installed";
+    }
+  }
+
+  grouping install-output {
+    description
+      "Grouping for SW installation RPC 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 installation to software slot.";
+    }
+    leaf error-message {
+      when "../status = 'FAILED'";
+      type string;
+
+      description
+        "Detailed error Message when the status is FAILED.";
+    }
+
+    leaf sw-install-timeout {
+      type int32 {range "1..max";}
+      units seconds;
+
+      description
+        "Optional timeout indicated by O-RU after which time
+        an 'install-event' notification will be sent indicating
+        the installation procedure has timed out.";
+    }
+  }
+
+  grouping activate-input {
+    description
+      "Grouping for SW activation RPC input";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+      }
+      must "/software-inventory/software-slot[name = current()][status = 'VALID']" {
+        error-message "software activation may be requested only on VALID slot!";
+      }
+      mandatory true;
+
+      description
+        "Slot name on which software has to be activated.";
+    }
+  }
+
+  grouping activate-output {
+    description
+      "Grouping for SW activation RPC 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 {range "1..max";}
+      units seconds;
+      default 30;
+
+      description
+        "Timeout on client waiting for the activate event";
+    }
+  }
+
+  grouping download-notification {
+    description
+      "Grouping for notification event structure for download completion";
+    leaf file-name {
+      type string;
+      mandatory true;
+
+      description
+        "File name of transferred software file.";
+    }
+
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed successfully";
+        }
+        enum AUTHENTICATION_ERROR {
+          description "Source available, wrong credentials";
+        }
+        enum PROTOCOL_ERROR {
+          description "SFTP or FTPES errors";
+        }
+        enum FILE_NOT_FOUND {
+          description "Source not available.";
+        }
+        enum APPLICATION_ERROR {
+          description "Application related errors";
+        }
+        enum TIMEOUT {
+          description "Timeout waiting for download";
+        }
+        enum INTEGRITY_ERROR {
+          description "File is corrupted";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+
+  grouping install-notification {
+    description
+      "Grouping for 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 successfully";
+        }
+        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";
+        }
+        enum TIMEOUT {
+          description "Install operation timed out";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+
+  grouping activation-notification {
+    description
+      "Grouping for 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 successfully";
+        }
+        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";
+    }
+  }
+
+  // top-level container
+
+  container software-inventory {
+    config false;
+    description
+      "Contains information about each software slot and its content as well as information related to
+      software processing.";
+
+    uses slot-group;
+
+    leaf build-content-download {
+      type empty;
+      description
+        "An optional leaf used to indicate that the O-RU requires separate download procedures to be
+        re-used for downloading individual files in a software build, instead of a single archived package.";
+    }
+
+    leaf integrity-check-at-download-enabled {
+      if-feature or-feat:INTEGRITY-CHECK-AT-SW-DOWNLOAD;
+      type empty;
+      description "Presence of this node enables O-RU to perform integrity check at file download.";
+    }
+
+  }
+    // RPC statements
+
+  rpc software-download {
+    description
+      "RPC needed to perform software download operation.";
+
+    input {
+      uses download-input;
+    }
+    output {
+      uses download-output;
+    }
+  }
+
+  rpc software-install {
+    description
+      "Install a previously downloaded software.";
+
+    input {
+      uses install-input;
+    }
+    output {
+      uses install-output;
+    }
+  }
+
+  rpc software-activate {
+    description
+      "Activate a previously installed software.";
+    input {
+      uses activate-input;
+    }
+    output {
+      uses activate-output;
+    }
+  }
+
+    // notification definitions
+  notification download-event {
+    description "Notification event structure for download completion";
+    uses download-notification;
+
+  }
+
+  notification install-event {
+    description "Notification event structure for installation completion";
+    uses install-notification;
+  }
+
+  notification activation-event {
+    description "Notification event structure for activation completion";
+    uses activation-notification;
+  }
+}