HTTP server and client.
Version: 2020-07-21
module huawei-http { yang-version 1; namespace "urn:huawei:yang:huawei-http"; prefix http; import huawei-extension { prefix ext; } import huawei-ssl { prefix ssl; } import huawei-acl { prefix acl; } import huawei-pub-type { prefix pub-type; } import ietf-inet-types { prefix inet; } import huawei-network-instance { prefix ni; } 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 "HTTP server and client."; revision "2020-07-21" { description "Initial revision."; reference "Huawei private."; } ext:task-name "https"; typedef http-server-type { type enumeration { enum "restconf" { value 1; description "Restconf: restconf service type."; } } description "HTTP service type."; } typedef httpc-trans-cmd-type { type enumeration { enum "upload" { value 1; description "Upload local files to the remote server."; } enum "download" { value 2; description "Download files from the remote server to the client."; } } description "FTP client transfer command type."; } typedef httpc-transfer-status-type { type enumeration { enum "init" { value 0; description "Indicates that the transfer status is initializing."; } enum "processing" { value 1; description "Indicates that the transfer status is transferring."; } enum "failed" { value 2; description "Indicates that the transfer status is failed."; } enum "canceled" { value 3; description "Indicates that the transfer status is canceled."; } enum "succeeded" { value 4; description "Indicates that the transfer is successful."; } } description "HTTP client download transfer-status type."; } container http { description "HTTP."; container comp-enable { description "Configure HTTP enable."; leaf comp-enable { type boolean; default "false"; description "Enable/disable HTTP function."; } } // container comp-enable container client { when "../comp-enable/comp-enable = 'true'"; description "Configure HTTP client."; leaf ssl-policy-name { type leafref { path "/ssl:ssl/ssl:ssl-policys/ssl:ssl-policy/ssl:policy-name"; } description "SSL policy name."; } leaf ssl-verify-type { when "../ssl-policy-name"; type boolean; default "false"; description "Enable/disable SSL verify peer."; } leaf source-interface-name { type pub-type:if-name; description "Users can configure the source interface for outgoing connections by specifying the source interface name."; } } // container client container servers { when "../comp-enable/comp-enable = 'true'"; description "List of HTTP server configuration."; list server { key "server-type"; description "Configure HTTP server."; leaf server-type { type http-server-type; description "HTTP server type."; } leaf server-enable { type boolean; must "../secure-enable != 'true' or (../secure-enable = 'true' and ../server-enable = 'false')"; default "false"; description "Enable/disable HTTP server."; } leaf secure-enable { type boolean; must "../server-enable != 'true' or (../server-enable = 'true' and ../secure-enable = 'false')"; default "false"; description "Enable/disable HTTP secure server."; } leaf server-port { type uint32 { range "80 | 1025..65535"; } default "80"; description "HTTP server port."; } leaf secure-port { type uint32 { range "443 | 1025..65535"; } default "443"; description "HTTP secure server port."; } leaf acl-name { type leafref { path "/acl:acl/acl:groups/acl:group/acl:identity"; } must "/acl:acl/acl:groups/acl:group[acl:identity=current()]/acl:type='basic' or /acl:acl/acl:groups/acl:group[acl:identity=current()]/acl:type='advance'"; description "HTTP server ACL name or number for IPv4 connections."; } leaf ssl-policy-name { type leafref { path "/ssl:ssl/ssl:ssl-policys/ssl:ssl-policy/ssl:policy-name"; } must "../secure-enable = 'true' "; description "SSL policy name."; } leaf ssl-verify-type { when "../secure-enable = 'true' and ../ssl-policy-name"; type boolean; default "false"; description "Enable/disable SSL verify."; } leaf idle-timeout { type uint32 { range "1..60"; } default "20"; description "Idle timeout."; } leaf max-tcp-num { type uint32 { range "1..30"; } default "30"; description "Maximum number of sessions can be connected to server for each IP address."; } } // list server } // container servers container server-source { when "../comp-enable/comp-enable = 'true' and count(../servers/server[server-type = 'restconf']) > 0 "; description "Configure http server interfaces."; leaf src-interface { when "../all-interface = 'false'"; type pub-type:if-name; description "Specify the source interface name. The specified source interface must exist and an IP address must be configured on the interface."; } leaf all-interface { type boolean; default "false"; description "Enable/disable specify all interfaces."; } } // container server-source container httpc-transfer-results { config false; description "List of HTTP transfer file result."; list httpc-transfer-result { key "operation-type file-url"; max-elements 40; description "HTTP transfer file result state."; leaf operation-type { type httpc-trans-cmd-type; description "Specify the type of the operation to be performed."; } leaf file-url { type string { length "1..255"; } description "Download/upload file URL."; } leaf transfer-status { type httpc-transfer-status-type; description "Indicates that the transfer status."; } leaf percentage { type uint32 { range "0..100"; } description "Show the transfer percentage."; } leaf error-tag { type uint32; description "Show the error code when http transfer failed."; } } // list httpc-transfer-result } // container httpc-transfer-results } // container http rpc httpc-transfer-file { description "HTTP client transfer file."; input { leaf operation-type { type httpc-trans-cmd-type; mandatory true; description "Specify the type of the operation to be performed."; } leaf file-url { type string { length "1..255"; } mandatory true; description "Download/upload file URL."; } leaf file-full-path { type string { length "1..255"; } mandatory true; description "Download/upload file full path including file name."; } leaf ssl-policy-name { type leafref { path "/ssl:ssl/ssl:ssl-policys/ssl:ssl-policy/ssl:policy-name"; } description "SSL policy name."; } leaf ssl-verify { type boolean; must "../ssl-policy-name"; description "Enable/disable SSL verify."; } leaf user-name { type string { length "1..127"; } description "Specifies the authentication user name for file transfer."; } leaf password { type pub-type:password-extend; description "Specifies the authentication password for file transfer."; } leaf source-ipv4-address { type inet:ipv4-address-no-zone; description "Specifies the source IPv4 address of the server connection."; } leaf vpn-name { type leafref { path "/ni:network-instance/ni:instances/ni:instance/ni:name"; } description "Specifies the VPN name of the server connection."; } leaf verify-dns { type boolean; default "false"; description "Enable/disable verify domain name."; } leaf async { type boolean; must "../operation-type = 'download'"; description "The async node specifies asynchronous transmission."; } leaf cancel { type boolean; must "../operation-type = 'download'"; description "The cancel node specifies the cancellation of an asynchronous transmission operation."; } } } // rpc httpc-transfer-file } // module huawei-http
© 2023 YumaWorks, Inc. All rights reserved.