huawei-patch

Manage patches.

  • Version: 2021-03-24

    huawei-patch@2021-03-24


    
      module huawei-patch {
    
        yang-version 1;
    
        namespace "urn:huawei:yang:huawei-patch";
    
        prefix patch;
    
        import ietf-yang-types {
          prefix yang;
        }
        import huawei-pub-type {
          prefix pub-type;
        }
        import ietf-inet-types {
          prefix inet;
        }
        import huawei-extension {
          prefix ext;
        }
    
        organization
          "Huawei Technologies Co., Ltd.";
    
        contact
          "Huawei Industrial Base
    Bantian, Longgang
    Shenzhen 518129
    People's Republic of China
    Website: http://www.huawei.com
    Email: support@huawei.com";
    
        description "Manage patches.";
    
        revision "2021-03-24" {
          description
            "Modify fail-reason node and modify check-patch node properties.";
          reference
            "Huawei private.";
    
        }
    
        revision "2021-03-15" {
          description
            "Add fail-reason node and modify operation-schedules.";
          reference
            "Huawei private.";
    
        }
    
        revision "2021-03-08" {
          description
            "Modify the threshold node properties.";
          reference
            "Huawei private.";
    
        }
    
        revision "2021-01-20" {
          description
            "Add check-type node and the enum of check-type. Add check-patch node.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-12-14" {
          description
            "Add cpu-usage-thresholds node.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-11-17" {
          description
            "Add the enum of the delete-type.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-06-29" {
          description "Modify node description.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-02-19" {
          description
            "Modify the name node of delete-patch node properties.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-01-16" {
          description
            "Modify the load-type node properties.";
          reference
            "Huawei private.";
    
        }
    
        revision "2019-11-27" {
          description "Initial revision.";
          reference
            "Huawei private.";
    
        }
    
        ext:task-name "patch";
    
        typedef patch-state {
          type enumeration {
            enum "not-exist" {
              value 0;
              description
                "The status of the current patch package is not exist.";
            }
            enum "running" {
              value 3;
              description
                "The status of the current patch package is running.";
            }
          }
          description
            "Status of the current patch package.";
        }
    
        typedef upgrade-mode {
          type enumeration {
            enum "reset-process" {
              value 0;
              description
                "Reset process to make the cold patch take effect.";
            }
            enum "reset-system" {
              value 1;
              description
                "Reset system to make the cold patch take effect.";
            }
            enum "reset-board" {
              value 2;
              description
                "Reset board to make the cold patch take effect.";
            }
            enum "reset-chassis" {
              value 3;
              description
                "Reset chassis to make the cold patch take effect.";
            }
          }
          description
            "Specify the operation method to make the cold patch take effect.";
        }
    
        typedef operation-type {
          type enumeration {
            enum "load-patch" {
              value 0;
              description
                "The operation type of patch operation is load-patch.";
            }
            enum "delete-patch" {
              value 1;
              description
                "The operation type of patch operation is uninstall-patch.";
            }
            enum "startup-next-patch" {
              value 2;
              description
                "The operation type of patch operation is startup-next-patch.";
            }
            enum "reset-startup-patch" {
              value 3;
              description
                "The operation type of patch operation is reset-startup-patch.";
            }
          }
          description
            "Specify patch operation type.";
        }
    
        typedef operation-status {
          type enumeration {
            enum "not-started" {
              value 0;
              description
                "The current status of patch operation is not started.";
            }
            enum "operating" {
              value 1;
              description
                "The current status of patch operation is operating.";
            }
            enum "successful" {
              value 2;
              description
                "The current status of patch operation is successful.";
            }
            enum "failed" {
              value 3;
              description
                "The current status of patch operation is failed.";
            }
          }
          description
            "Specify patch operation status.";
        }
    
        typedef schedule-query-type {
          type enumeration {
            enum "default" {
              value 0;
              description "Default mode.";
            }
            enum "hftp" {
              value 1;
              description "HFTP mode.";
            }
          }
          description "Progress query type.";
        }
    
        typedef file-type {
          type enumeration {
            enum "normal" {
              value 0;
              description
                "Normal patch package.";
            }
          }
          description "File type.";
        }
    
        typedef service-type {
          type enumeration {
            enum "patch" {
              value 7;
              description
                "Patch file path type.";
            }
          }
          description "Service type.";
        }
    
        typedef load-type {
          type enumeration {
            enum "run" {
              value 1;
              description "Run a patch package.";
            }
          }
          description
            "Specify the load type of a patch package.";
        }
    
        typedef delete-type {
          type enumeration {
            enum "all" {
              value 0;
              description
                "The action of deleting patch package is all.";
            }
            enum "single" {
              value 1;
              description
                "The action of deleting patch package is single.";
            }
          }
          description
            "Specify the action of deleting patch package.";
        }
    
        typedef transfer-type {
          type enumeration {
            enum "ftp" {
              value 0;
              description "FTP mode.";
            }
            enum "sftp" {
              value 1;
              description "SFTP mode.";
            }
          }
          description "Transfer type.";
        }
    
        typedef check-type {
          type enumeration {
            enum "startup" {
              value 0;
              description
                "The action of checking patch package is a startup patch package.";
            }
            enum "specified-file" {
              value 1;
              description
                "The action of checking patch package is a specified patch package.";
            }
          }
          description
            "Specify the action of checking a patch package.";
        }
    
        typedef fail-reason {
          type enumeration {
            enum "file-not-exist" {
              value 0;
              description
                "The failure of patch operation is file-not-exist.";
            }
            enum "filename-check-failed" {
              value 1;
              description
                "The failure of patch operation is filename-check-failed.";
            }
            enum "integrity-check-failed" {
              value 2;
              description
                "The failure of patch operation is integrity-check-failed.";
            }
            enum "file-check-failed" {
              value 3;
              description
                "The failure of patch operation is file-check-failed.";
            }
            enum "file-not-match" {
              value 4;
              description
                "The failure of patch operation is file-not-match.";
            }
            enum "system-busy" {
              value 5;
              description
                "The failure of patch operation is system-busy.";
            }
            enum "insufficient-storage-space" {
              value 6;
              description
                "The failure of patch operation is insufficient-storage-space.";
            }
            enum "operation-failed" {
              value 7;
              description
                "The failure of patch operation is operation-failed.";
            }
          }
          description "Patch operation failure.";
        }
    
        container patch {
          description "Manage patches.";
          container cpu-usage-thresholds {
            description
              "List of Configuration of the CPU overload threshold used.";
            list cpu-usage-threshold {
              ext:operation-exclude "create|delete";
              key "slot";
              description
                "Configure or cancel the CPU overload threshold used for patch installation or uninstallation.";
              leaf slot {
                type string {
                  length "1..49";
                }
                description
                  "Specifies the slot ID of the board for which the CPU usage threshold is to be set.";
              }
    
              leaf threshold {
                type uint32 {
                  range "70..100";
                }
                units "%";
                mandatory true;
                description "Cpu threshold.";
              }
            }  // list cpu-usage-threshold
          }  // container cpu-usage-thresholds
    
          container patch-infos {
            config false;
            description
              "List of operational data of a patch packet information.";
            list patch-info {
              key "name";
              description
                "Operational data of a patch packet information.";
              leaf name {
                type string {
                  length "5..63";
                }
                description
                  "Name of the current patch package.";
              }
    
              leaf version {
                type string {
                  length "1..63";
                }
                description
                  "Version of the current patch package.";
              }
    
              leaf state {
                type patch-state;
                description
                  "Status of the current patch package.";
              }
    
              leaf runtime {
                type yang:date-and-time;
                description
                  "Run time of the current patch package.";
              }
    
              leaf path {
                type string {
                  length "1..127";
                }
                description
                  "Path of the current patch package.";
              }
    
              container operations {
                config false;
                description
                  "List of operational state of making the cold patch take effect.";
                list operation {
                  key "position";
                  description
                    "Operational state of making the cold patch take effect.";
                  leaf position {
                    type string {
                      length "1..50";
                    }
                    description
                      "Object to make the cold patch take effect.";
                  }
    
                  leaf position-type {
                    type string {
                      length "1..50";
                    }
                    description
                      "Object type to make the cold patch take effect.";
                  }
    
                  leaf upgrade-mode {
                    type upgrade-mode;
                    description
                      "Operating method to make the cold patch take effect.";
                  }
                }  // list operation
              }  // container operations
            }  // list patch-info
          }  // container patch-infos
    
          container next-startup-patchs {
            config false;
            description
              "List of operational data of next startup patch packet informations.";
            list next-startup-patch {
              key "name";
              description
                "Operational data of a patch startup packet information.";
              leaf name {
                type string {
                  length "5..63";
                }
                description
                  "Name of a next startup patch package.";
              }
            }  // list next-startup-patch
          }  // container next-startup-patchs
    
          container operation-schedules {
            config false;
            description
              "List of operational state of patch.";
            list operation-schedule {
              key "phase";
              description
                "Operational state of patch.";
              leaf phase {
                type operation-type;
                description
                  "Patch operation type.";
              }
    
              leaf name {
                type string {
                  length "5..63";
                }
                description
                  "Name of a patch package.";
              }
    
              leaf status {
                type operation-status;
                description
                  "Patch operation status.";
              }
    
              leaf schedule {
                type pub-type:percent;
                description
                  "Value of the patch operation process.";
              }
    
              leaf fail-reason {
                when "../status = 'failed'";
                type fail-reason;
                description
                  "Cause of the patch operation failure.";
              }
            }  // list operation-schedule
          }  // container operation-schedules
    
          container download-package-schedule {
            config false;
            description
              "Operational data of package downloading progress.";
            leaf name {
              type string {
                length "1..127";
              }
              description "File name.";
            }
    
            leaf status {
              type operation-status;
              description
                "Package downloading status.";
            }
    
            leaf schedule {
              type pub-type:percent;
              description
                "The schedule of file download, for example, progress (%).";
            }
    
            leaf transfer-index {
              type uint32;
              description "Transfer index.";
            }
    
            leaf query-type {
              type schedule-query-type;
              description "Progress query type.";
            }
          }  // container download-package-schedule
    
          container download-package-load-path {
            config false;
            description
              "Operational data of load path before downloading a normal patch package.";
            leaf file-type {
              type file-type;
              description "File type.";
            }
    
            leaf service-type {
              type service-type;
              description "Service type.";
            }
    
            leaf file-path {
              type string {
                length "0..128";
              }
              description
                "File path. If the value of file-type node is normal, the file path of normal patch will be /.";
            }
          }  // container download-package-load-path
        }  // container patch
    
        rpc load-patch {
          ext:node-ref "/file-operation/dirs/dir";
          description "Load a patch package.";
          input {
            leaf name {
              type string {
                length "5..127";
              }
              mandatory true;
              description
                "Specify the full path name of a patch package.";
            }
    
            leaf load-type {
              type load-type;
              mandatory true;
              description
                "Specify the load type of a patch package.";
            }
          }
        }  // rpc load-patch
    
        rpc startup-next-patch {
          ext:node-ref "/file-operation/dirs/dir";
          description
            "Startup a patch package that will be used at the next startup.";
          input {
            leaf name {
              type string {
                length "5..127";
              }
              mandatory true;
              description
                "Specify the full path name of a patch package that will be used at the next startup.";
            }
          }
        }  // rpc startup-next-patch
    
        rpc delete-patch {
          ext:node-ref "/patch/patch-infos/patch-info";
          description "Delete patch package.";
          input {
            leaf delete-type {
              type delete-type;
              default "all";
              description
                "Specify the action of deleting patch package.";
            }
    
            leaf name {
              when "../delete-type != 'all'";
              type string {
                length "5..127";
              }
              mandatory true;
              description
                "Specify full path name of a patch package.";
            }
          }
        }  // rpc delete-patch
    
        rpc reset-startup-patch {
          ext:node-ref "/patch/next-startup-patchs/next-startup-patch";
          description
            "Delete a patch packet that will be used at the next startup.";
          input {
            leaf delete-type {
              type delete-type;
              default "all";
              description
                "Specify the action of reset patch package.";
            }
    
            leaf name {
              when "../delete-type != 'all'";
              type string {
                length "5..127";
              }
              mandatory true;
              description
                "Specify the full path name of a patch package that will be used at the next startup.";
            }
          }
        }  // rpc reset-startup-patch
    
        rpc download-patch-file {
          description
            "Download patch package by FTP or SFTP.";
          input {
            leaf server-ip {
              type inet:ipv4-address-no-zone;
              mandatory true;
              description "Server address.";
            }
    
            leaf user-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description "User name.";
            }
    
            leaf password {
              type pub-type:password-extend {
                length "1..255";
              }
              mandatory true;
              description
                "Password of FTP or SFTP server.";
            }
    
            leaf server-port {
              type uint32 {
                range "1..65535";
              }
              mandatory true;
              description "Server port.";
            }
    
            leaf file-name {
              type string {
                length "5..128";
              }
              mandatory true;
              description "Package name.";
            }
    
            leaf transfer-type {
              type transfer-type;
              description "Transfer type.";
            }
          }
        }  // rpc download-patch-file
    
        rpc check-patch {
          description "Check a patch package.";
          input {
            leaf check-type {
              type check-type;
              mandatory true;
              description
                "Specify the action of checking patch package.";
            }
    
            leaf name {
              when "../check-type != 'startup'";
              type string {
                length "5..127";
              }
              mandatory true;
              description
                "Name of a patch package.";
            }
          }
    
          output {
            container result-infos {
              description
                "List of checking patch package result.";
              list result-info {
                key "name";
                description
                  "Result information of check a patch package.";
                leaf name {
                  type string {
                    length "5..127";
                  }
                  description
                    "Name of a patch package.";
                }
    
                leaf result {
                  type string {
                    length "1..255";
                  }
                  description
                    "Result of check a patch package.";
                }
              }  // list result-info
            }  // container result-infos
          }
        }  // rpc check-patch
      }  // module huawei-patch
    

© 2023 YumaWorks, Inc. All rights reserved.