Sync Common folder
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-file-transfer@2017-12-15.yang
1 module org-openroadm-file-transfer {
2   namespace "http://org/openroadm/file-transfer";
3   prefix org-openroadm-file-txr;
4
5   import ietf-inet-types {
6     prefix inet;
7     revision-date 2013-07-15;
8   }
9   import org-openroadm-common-types {
10     prefix org-openroadm-common-types;
11     revision-date 2017-12-15;
12   }
13
14   organization
15     "Open ROADM MSA";
16   contact
17     "OpenROADM.org";
18   description
19     "YANG definitions for file management related rpcs.
20      
21      Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, 
22      AT&T Intellectual Property.  All other rights reserved.
23      
24      Redistribution and use in source and binary forms, with or without modification, 
25      are permitted provided that the following conditions are met:
26      
27      * Redistributions of source code must retain the above copyright notice, this 
28        list of conditions and the following disclaimer.
29      * Redistributions in binary form must reproduce the above copyright notice, 
30        this list of conditions and the following disclaimer in the documentation and/or 
31        other materials provided with the distribution.
32      * Neither the Members of the Open ROADM MSA Agreement nor the names of its 
33        contributors may be used to endorse or promote products derived from this software 
34        without specific prior written permission.
35      
36      THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS'' 
37      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
38      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
39      IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT, 
40      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
41      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, 
42      OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
43      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
44      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
45      POSSIBILITY OF SUCH DAMAGE.";
46
47   revision 2017-12-15 {
48     description
49       "Version 2.2";
50   }
51   revision 2017-09-29 {
52     description
53       "Version 2.1";
54   }
55   revision 2017-07-28 {
56     description
57       "Version 2.0.1 - added revision-date to imports";
58   }
59   revision 2017-06-26 {
60     description
61       "Version 2.0";
62   }
63   revision 2016-10-14 {
64     description
65       "Version 1.2";
66   }
67
68   rpc transfer {
69     description
70       "File transfer using FTP/SFTP";
71     input {
72       leaf action {
73         type enumeration {
74           enum "upload" {
75             description
76               "Specify the upload action. The NE (SFTP/FTP client) sends
77                the file identified by the local-file-path
78                to the remote-file-path.";
79           }
80           enum "download" {
81             description
82               "Specify the download action. The NE (SFTP/FTP client) retrieves
83                the file identified by the remote-file-path
84                to the local-file-path.";
85           }
86         }
87         mandatory true;
88         description
89           "Type of action - download/upload.";
90       }
91       leaf local-file-path {
92         type string;
93         mandatory true;
94         description
95           "Local file path.
96            Ex: /var/shared/example.txt";
97       }
98       leaf remote-file-path {
99         type inet:uri;
100         mandatory true;
101         description
102           "Remote file path. 
103            A URI for the remote file path.
104            
105            Format:sftp://user[:password]@host[:port]/path. 
106            Ex: sftp://test:verify@[2001:db8:0:1::10]:22/home/user/sample";
107       }
108     }
109     output {
110       uses org-openroadm-common-types:rpc-response-status;
111     }
112   }
113   rpc show-file {
114     description
115       "Show one or more files in the specified directory.";
116     input {
117       leaf filename {
118         type string {
119           length "1..255";
120         }
121         default "*";
122         description
123           "Specify file(s) to be listed (* is allowed as wild-card). ";
124       }
125     }
126     output {
127       leaf status {
128         type enumeration {
129           enum "Successful" {
130             value 1;
131           }
132           enum "Failed" {
133             value 2;
134           }
135         }
136         mandatory true;
137         description
138           "Successful or Failed";
139       }
140       leaf-list status-message {
141         type string;
142         description
143           "Gives a more detailed reason for success / failure";
144       }
145     }
146   }
147   rpc delete-file {
148     description
149       "Delete one or more files in the specified directory.";
150     input {
151       leaf filename {
152         type string {
153           length "1..255";
154         }
155         mandatory true;
156         description
157           "Specify file(s) to be deleted (* is allowed as wild-card).";
158       }
159     }
160     output {
161       uses org-openroadm-common-types:rpc-response-status;
162     }
163   }
164   notification transfer-notification {
165     description
166       "notification for transfer operation events.";
167     leaf local-file-path {
168       type string;
169       description
170         "Local file path used in transfer RPC.";
171     }
172     uses org-openroadm-common-types:extended-rpc-response-status;
173     container progress {
174       when "current()/../status = 'In-progress'";
175       description
176         "progress status when response is in-progress";
177       leaf bytes-transferred {
178         type uint64;
179         description
180           "bytes transferred.";
181       }
182       leaf percentage-complete {
183         type uint8;
184         description
185           "percentage completed.";
186       }
187     }
188   }
189 }