Update YANG models for OpenFronthaul M-Plane.
[sim/o1-interface.git] / ntsimulator / deploy / o-ran-ru-fh / yang / o-ran-software-management.yang
@@ -17,7 +17,11 @@ module o-ran-software-management {
   }
 
   import o-ran-file-management {
-    prefix "o-ran-fm";
+    prefix "o-ran-file-mgmt";
+  }
+
+  import o-ran-wg4-features {
+    prefix "or-feat";
   }
 
   organization "O-RAN Alliance";
@@ -29,7 +33,7 @@ module o-ran-software-management {
     "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 2019 the O-RAN Alliance.
+    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
@@ -55,6 +59,63 @@ module o-ran-software-management {
     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
@@ -78,6 +139,8 @@ module o-ran-software-management {
     reference "ORAN-WG4.M.0-v01.00";
   }
 
+
+
   // groupings
 
   grouping slot-group {
@@ -88,28 +151,30 @@ module o-ran-software-management {
       min-elements 2;
 
       description
-        "Information about available software-slots and their software.";
+        "Information about available software-slots, their status, state and content.";
 
       leaf name {
         type string;
 
         description
-          "Name of the software package. This shall be unique to identify the software-slot.";
+          "Name of the software slot. This shall be unique to identify the software-slot.";
       }
 
       leaf status {
         type enumeration {
           enum VALID {
             description
-              "Slot Contains software build considered as proven valid";
+              "Slot contains software considered as proven valid";
           }
           enum INVALID {
             description
-              "software build is not currently used by O-RU. The software is considered by O-RU as damaged (e.g. wrong CRC)";
+              "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
-              "W slot does not contain software package.";
+              "Slot does not contain software package. O-RU prohibits activation of slot
+              with such status.";
           }
         }
         config false;
@@ -131,7 +196,7 @@ module o-ran-software-management {
       must "../status = 'VALID'";
         config false;
           description
-            "informs if software stored in particular slot is used at the moment";
+            "Informs if software stored in particular slot is used at the moment";
       }
 
       leaf access {
@@ -150,7 +215,7 @@ module o-ran-software-management {
         config false;
 
         description
-          "Indicates the writability of the slot.
+          "Indicates the writeability of the slot.
           A Read-Only software slot is one which has a factory installed software-slot";
       }
 
@@ -165,12 +230,15 @@ module o-ran-software-management {
 
       leaf vendor-code {
         type string {
-          length 1..2;
+          length 1..5;
+          pattern '(.{1,2})|(\d{1,5})';
         }
         config false;
 
         description
-          "Unique code of the vendor. This is derived from manifest file.";
+          "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 {
@@ -178,7 +246,7 @@ module o-ran-software-management {
         config false;
 
         description
-          "Identity associated with the software build. This is derived from manifest file.";
+          "Identity associated with the software. This is derived from manifest file.";
       }
 
       leaf build-name {
@@ -198,7 +266,7 @@ module o-ran-software-management {
         key "name";
         config false;
 
-        description "List of all the files present in the software package.";
+        description "List of all the files present in the software slot.";
 
         leaf name {
           type string;
@@ -241,22 +309,29 @@ module o-ran-software-management {
 
   grouping download-input {
     description
-      "Grouping for sw download rpc input";
+      "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:
-        sftp://<username>@<host>[:<port>]/path";
+        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-fm:credential-information;
+
+    uses o-ran-file-mgmt:credential-information;
   }
 
   grouping download-output {
     description
-      "Grouping for sw download rpc output";
+      "Grouping for SW download RPC output";
     leaf status {
       type enumeration {
         enum STARTED {
@@ -271,18 +346,18 @@ module o-ran-software-management {
       mandatory true;
 
       description
-        "Status of the software files download";
+        "Status of the software file download";
     }
     leaf error-message {
       when "../status = 'FAILED'";
       type string;
 
       description
-        "Detailed error Message when the status is failed.";
+        "Detailed error Message when the status is FAILED.";
     }
 
     leaf notification-timeout {
-      type int32;
+      type int32 {range "1..max";}
       units seconds;
       default 30;
 
@@ -296,7 +371,7 @@ module o-ran-software-management {
 
   grouping install-input {
     description
-      "Grouping for sw installation rpc input";
+      "Grouping for SW installation RPC input";
     leaf slot-name {
       type leafref {
         path "/software-inventory/software-slot/name";
@@ -307,7 +382,7 @@ module o-ran-software-management {
       mandatory true;
 
       description
-        "software-slot to which the software shall be installed to.";
+        "Software slot to which the software shall be installed.";
     }
 
     leaf-list file-names {
@@ -320,7 +395,7 @@ module o-ran-software-management {
 
   grouping install-output {
     description
-      "Grouping for sw installation rpc output";
+      "Grouping for SW installation RPC output";
     leaf status {
       type enumeration {
         enum STARTED {
@@ -335,20 +410,30 @@ module o-ran-software-management {
       mandatory true;
 
       description
-        "Status of the software package install.";
+        "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.";
+        "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";
+      "Grouping for SW activation RPC input";
     leaf slot-name {
       type leafref {
         path "/software-inventory/software-slot/name";
@@ -365,7 +450,7 @@ module o-ran-software-management {
 
   grouping activate-output {
     description
-      "Grouping for sw activation rpc output";
+      "Grouping for SW activation RPC output";
     leaf status {
       type enumeration {
         enum STARTED {
@@ -387,11 +472,11 @@ module o-ran-software-management {
       type string;
 
       description
-        "Detailed error Message when the status is failed.";
+        "Detailed error Message when the status is FAILED.";
     }
 
     leaf notification-timeout {
-      type int32;
+      type int32 {range "1..max";}
       units seconds;
       default 30;
 
@@ -408,23 +493,23 @@ module o-ran-software-management {
       mandatory true;
 
       description
-        "File name of downloaded software package";
+        "File name of transferred software file.";
     }
 
     leaf status {
       type enumeration {
         enum COMPLETED {
           description
-            "Operation completed succesfully";
+            "Operation completed successfully";
         }
         enum AUTHENTICATION_ERROR {
-          description "source available, wrong credentials";
+          description "Source available, wrong credentials";
         }
         enum PROTOCOL_ERROR {
-          description "SFTP errors";
+          description "SFTP or FTPES errors";
         }
         enum FILE_NOT_FOUND {
-          description "source not available.";
+          description "Source not available.";
         }
         enum APPLICATION_ERROR {
           description "Application related errors";
@@ -432,6 +517,9 @@ module o-ran-software-management {
         enum TIMEOUT {
           description "Timeout waiting for download";
         }
+        enum INTEGRITY_ERROR {
+          description "File is corrupted";
+        }
       }
 
       description
@@ -461,17 +549,20 @@ module o-ran-software-management {
       type enumeration {
         enum COMPLETED {
           description
-            "Operation completed succesfully";
+            "Operation completed successfully";
         }
         enum FILE_ERROR {
-          description "operation on the file resulted in in error, disk failure, not enough disk space,
+          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";
+          description "File is corrupted";
         }
         enum APPLICATION_ERROR {
-          description "operation failed due to internal reason";
+          description "Operation failed due to internal reason";
+        }
+        enum TIMEOUT {
+          description "Install operation timed out";
         }
       }
 
@@ -503,7 +594,7 @@ module o-ran-software-management {
       type enumeration {
         enum COMPLETED {
           description
-            "Operation completed succesfully";
+            "Operation completed successfully";
         }
         enum APPLICATION_ERROR {
           description
@@ -518,7 +609,7 @@ module o-ran-software-management {
       type uint8;
 
       description
-        "status code return when the software is tried to activate";
+        "Status code return when the software is tried to activate";
     }
     leaf error-message {
       when "../status != 'COMPLETED'";
@@ -529,21 +620,35 @@ module o-ran-software-management {
     }
   }
 
-  // top level container
+  // top-level container
 
   container software-inventory {
     config false;
     description
-      "Contains information about each software slot and its content.";
+      "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 statements
 
   rpc software-download {
     description
-      "Rpc needed to perform software download operation.";
+      "RPC needed to perform software download operation.";
 
     input {
       uses download-input;
@@ -555,7 +660,7 @@ module o-ran-software-management {
 
   rpc software-install {
     description
-      "Install a previously downloaded software package.";
+      "Install a previously downloaded software.";
 
     input {
       uses install-input;