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