Sync Common folder
[transportpce.git] / ordmodels / common / src / main / yang / org-openroadm-user-mgmt@2017-12-15.yang
1 module org-openroadm-user-mgmt {
2   namespace "http://org/openroadm/user-mgmt";
3   prefix org-openroadm-user-mgmt;
4
5   organization
6     "Open ROADM MSA";
7   contact
8     "OpenROADM.org";
9   description
10     "YANG definitions of user managements.
11        
12       Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, 
13       AT&T Intellectual Property.  All other rights reserved.
14       
15       Redistribution and use in source and binary forms, with or without modification, 
16       are permitted provided that the following conditions are met:
17       
18       * Redistributions of source code must retain the above copyright notice, this 
19         list of conditions and the following disclaimer.
20       * Redistributions in binary form must reproduce the above copyright notice, 
21         this list of conditions and the following disclaimer in the documentation and/or 
22         other materials provided with the distribution.
23       * Neither the Members of the Open ROADM MSA Agreement nor the names of its 
24         contributors may be used to endorse or promote products derived from this software 
25         without specific prior written permission.
26       
27       THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS'' 
28       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
29       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
30       IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT, 
31       INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
32       NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, 
33       OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
34       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
35       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
36       POSSIBILITY OF SUCH DAMAGE";
37
38   revision 2017-12-15 {
39     description
40       "Version 2.2";
41   }
42   revision 2017-09-29 {
43     description
44       "Version 2.1";
45   }
46   revision 2017-06-26 {
47     description
48       "Version 2.0";
49   }
50   revision 2016-10-14 {
51     description
52       "Version 1.2";
53   }
54
55   typedef username-type {
56     type string {
57       length "3..32";
58       pattern "[a-z][a-z0-9]{2,31}" {
59         error-message
60           "A username must begin with a lowercase letter, The remainder 
61            of the string may contain lowercase letters, or numbers 0 through 9.";
62       }
63     }
64     description
65       "The user name string identifying this entry.";
66   }
67
68   typedef password-type {
69     type string {
70       length "8..128";
71       pattern "[a-zA-Z0-9!$%\\^()\\[\\]_\\-~{}.+]*" {
72         error-message "Password content does not meet the requirements";
73       }
74     }
75     description
76       "The password for this entry. This shouldn't be in clear text 
77        The Password must contain at least 2 characters from 
78        each of the following groups: 
79        a) Lower case alphabetic (a-z) 
80        b) Upper case alphabetic (A-Z) 
81        c) Numeric 0-9 
82        d) Special characters Allowed !$%^()[]_-~{}.+ 
83        Password must not contain Username.";
84   }
85
86   grouping user-profile {
87     list user {
88       key "name";
89       description
90         "The list of local users configured on this device.";
91       leaf name {
92         type username-type;
93         description
94           "The user name string identifying this entry.";
95       }
96       leaf password {
97         type password-type;
98         description
99           "The password for this entry.";
100       }
101       leaf group {
102         type enumeration {
103           enum "sudo";
104         }
105         description
106           "The group to which the user is associated to.";
107       }
108     }
109   }
110
111   rpc chg-password {
112     input {
113       leaf currentPassword {
114         type password-type;
115         mandatory true;
116         description
117           "provide the current password";
118       }
119       leaf newPassword {
120         type password-type;
121         mandatory true;
122         description
123           "provide a new password";
124       }
125       leaf newPasswordConfirm {
126         type password-type;
127         mandatory true;
128         description
129           "re-enter the new password ";
130       }
131     }
132     output {
133       leaf status {
134         type enumeration {
135           enum "Successful" {
136             value 1;
137           }
138           enum "Failed" {
139             value 2;
140           }
141         }
142         mandatory true;
143         description
144           "Successful or Failed";
145       }
146       leaf status-message {
147         type string;
148         description
149           "Gives a more detailed reason for success / failure";
150       }
151     }
152   }
153 }