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