huawei-file-operation

Indicate file system management.

  • Version: 2021-09-17

    huawei-file-operation@2021-09-17


    
      module huawei-file-operation {
    
        yang-version 1;
    
        namespace
          "urn:huawei:yang:huawei-file-operation";
    
        prefix file-operation;
    
        import ietf-yang-types {
          prefix yang;
        }
        import huawei-pub-type {
          prefix pub-type;
        }
        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
          "Indicate file system management.";
    
        revision "2021-09-17" {
          description
            "Modify leafref path of the leaf file-name of rpc.";
          reference
            "Huawei private.";
    
        }
    
        revision "2021-06-17" {
          description
            "Modify leafref path of the leaf node dir-name.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-08-12" {
          description
            "Modify data type of the node size from int32 to uint32.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-04-02" {
          description "YANG check.";
          reference
            "Huawei private.";
    
        }
    
        revision "2020-02-13" {
          description
            "Add leaf node of copy-file and delete-file.";
          reference
            "Huawei private.";
    
        }
    
        revision "2019-12-20" {
          description "Modify node description.";
          reference
            "Huawei private.";
    
        }
    
        revision "2019-12-09" {
          description "Initial revision.";
          reference
            "Huawei private.";
    
        }
    
        ext:task-name "rpm";
    
        typedef delete-type {
          type enumeration {
            enum "unreserved" {
              value 0;
              description
                "Delete file permanently. The deleted file cannot be restored.";
            }
          }
          description
            "Specify the action of deleting file.";
        }
    
        typedef overwrite-type {
          type enumeration {
            enum "overwrite" {
              value 0;
              description
                "Overwrite the file with same name as the destination file while compressing or decompressing.";
            }
            enum "not-overwrite" {
              value 1;
              description
                "Not to overwrite the file with same name as the destination file while compressing or decompressing.";
            }
          }
          description
            "The overwrite strategy when there exists a file with same name as the destination file, should be overwrite or not-overwrite.";
        }
    
        typedef reset-recycle-type {
          type enumeration {
            enum "all" {
              value 0;
              description
                "Delete all files in the recycle bin.";
            }
          }
          description
            "Specify the action type of reseting the recycle bin.";
        }
    
        container file-operation {
          config false;
          description
            "Indicate file system management.";
          container dirs {
            description
              "List of operational data of file information.";
            list dir {
              key "file-name dir-name";
              description
                "Operational data of file information.";
              leaf file-name {
                type string {
                  length "1..255";
                }
                description
                  "Name of a folder or file.";
              }
    
              leaf dir-name {
                type string {
                  length "1..255";
                }
                description
                  "Name of the current folder. You can also specify a subfolder path to query the files in the subfolder.";
              }
    
              leaf attribute {
                type string {
                  length "1..16";
                }
                description
                  "Attributes of a folder or file.";
              }
    
              leaf modify-time {
                type yang:date-and-time;
                description
                  "Last modified time of a folder or file.";
              }
    
              leaf size {
                type uint32;
                units "Byte";
                description
                  "Size of a folder or file. Integer type and the size of a folder is expressed as 4096.";
              }
            }  // list dir
          }  // container dirs
    
          container disk-usages {
            description
              "List of operational data of disk space information.";
            list disk-usage {
              key "name";
              description
                "Operational data of disk space information.";
              leaf name {
                type string {
                  length "1..64";
                }
                description
                  "Name of a file system partition.";
              }
    
              leaf path {
                type string {
                  length "1..64";
                }
                description
                  "Directory of a file system partition.";
              }
    
              leaf total-size {
                type string {
                  length "1..32";
                }
                units "kB";
                description
                  "Total size of a file system partition.";
              }
    
              leaf free-size {
                type string {
                  length "1..32";
                }
                units "kB";
                description
                  "Size of the free space in a file system partition.";
              }
    
              leaf usage {
                type pub-type:percent;
                description
                  "Usage of a file system partition.";
              }
            }  // list disk-usage
          }  // container disk-usages
        }  // container file-operation
    
        rpc reset-recycle-bin {
          description
            "Delete all files in the recycle bin.";
          input {
            leaf reset-type {
              type reset-recycle-type;
              description
                "Delete all files in the recycle bin.";
            }
          }
        }  // rpc reset-recycle-bin
    
        rpc copy-file {
          ext:node-ref "/file-operation/dirs/dir";
          description
            "Copy a file. A folder, however, cannot be copied.";
          input {
            leaf src-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a source file name that can be listed in a full directory or a relative directory.";
            }
    
            leaf des-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a destination file name that can be listed in a full path or a relative path.";
            }
    
            leaf all {
              type boolean;
              description
                "Copy a file to both of the main board and slave board. A folder, however, cannot be copied.";
            }
          }
        }  // rpc copy-file
    
        rpc delete-file {
          ext:node-ref "/file-operation/dirs/dir";
          description
            "Delete file permanently. A folder, however, cannot be deleted.";
          input {
            leaf file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a file name that can be listed in a full directory or a relative directory.";
            }
    
            leaf delete-type {
              type delete-type;
              mandatory true;
              description
                "Specify the action of deleting file.";
            }
    
            leaf all {
              type boolean;
              description
                "Delete a file of the main board and slave board permanently. A folder, however, cannot be deleted.";
            }
          }
        }  // rpc delete-file
    
        rpc zip-file {
          ext:node-ref "/file-operation/dirs/dir";
          description
            "Compress a file. A folder, however, cannot be compressed.";
          input {
            leaf src-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a source file name that can be listed in a full directory or a relative directory.";
            }
    
            leaf des-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a destination file name that can be listed in a full directory or a relative directory.";
            }
    
            leaf overwrite-type {
              type overwrite-type;
              default "not-overwrite";
              description
                "Specify the overwrite strategy when there exists a file with same name as the destination file, should be overwrite or not-overwrite.";
            }
          }
        }  // rpc zip-file
    
        rpc unzip-file {
          ext:node-ref "/file-operation/dirs/dir";
          description
            "Decompress a file. A folder, however, cannot be decompressed.";
          input {
            leaf src-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a source file name that can be listed in a full directory or a relative directory.";
            }
    
            leaf des-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a destination file name that can be listed in a full path or a relative path.";
            }
    
            leaf overwrite-type {
              type overwrite-type;
              default "not-overwrite";
              description
                "Specify the overwrite strategy when there exists a file with same name as the destination file, should be overwrite or not-overwrite.";
            }
          }
        }  // rpc unzip-file
    
        rpc move-file {
          ext:node-ref "/file-operation/dirs/dir";
          description
            "Move a file. A folder, however, cannot be moved.";
          input {
            leaf src-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a source file name that can be listed in a full directory or a relative directory.";
            }
    
            leaf des-file-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a destination file name that can be listed in a full directory or a relative directory.";
            }
          }
        }  // rpc move-file
    
        rpc rename {
          ext:node-ref "/file-operation/dirs/dir";
          description "Rename a file or folder.";
          input {
            leaf src-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a source file or folder name that can be listed in a full directory or a relative directory.";
            }
    
            leaf des-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a destination file or folder name that can be listed in a full directory or a relative directory.";
            }
          }
        }  // rpc rename
    
        rpc make-dir {
          ext:node-ref "/file-operation/dirs/dir";
          description "Create a folder.";
          input {
            leaf dir-name {
              type string {
                length "1..255";
              }
              mandatory true;
              description
                "Specify a folder that will be created.";
            }
          }
        }  // rpc make-dir
    
        rpc remove-dir {
          ext:node-ref "/file-operation/dirs/dir";
          description "Remove a folder.";
          input {
            leaf dir-name {
              type leafref {
                path "/file-operation/dirs/dir/file-name";
              }
              mandatory true;
              description
                "Specify a folder that will be removed.";
            }
          }
        }  // rpc remove-dir
      }  // module huawei-file-operation
    

© 2023 YumaWorks, Inc. All rights reserved.