Add supoprt for D release use-case.
[sim/o1-interface.git] / ntsimulator / deploy / o-ran-ru-fh / yang / o-ran-usermgmt@2020-12-10.yang
1 module o-ran-usermgmt {
2   yang-version 1.1;
3   namespace "urn:o-ran:user-mgmt:1.0";
4   prefix "o-ran-usermgmt";
5
6   import ietf-netconf-acm {
7     prefix nacm;
8     reference
9       "RFC 8341: Network Configuration Access Control Model";
10   }
11
12   organization "O-RAN Alliance";
13
14   contact
15     "www.o-ran.org";
16
17   description
18     "This module defines the user management model for the O-RAN Equipment.
19
20     Copyright 2019 the O-RAN Alliance.
21
22     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
23     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25     ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26     LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32     POSSIBILITY OF SUCH DAMAGE.
33
34     Redistribution and use in source and binary forms, with or without
35     modification, are permitted provided that the following conditions are met:
36
37     * Redistributions of source code must retain the above copyright notice,
38     this list of conditions and the above disclaimer.
39     * Redistributions in binary form must reproduce the above copyright notice,
40     this list of conditions and the above disclaimer in the documentation
41     and/or other materials provided with the distribution.
42     * Neither the Members of the O-RAN Alliance nor the names of its
43     contributors may be used to endorse or promote products derived from
44     this software without specific prior written permission.";
45
46   revision "2020-12-10" {
47     description
48       "version 1.2.0
49
50       1) updated description for enabled leaf";
51
52     reference "ORAN-WG4.M.0-v01.00";
53   }
54
55   revision "2019-07-03" {
56     description
57       "version 1.1.0
58
59       1) change name leaf to type nacm:user-name-type
60       2) added account-type to qualify when password is required ";
61
62     reference "ORAN-WG4.M.0-v01.00";
63   }
64
65   revision "2019-02-04" {
66     description
67       "version 1.0.0
68
69       1) imported model from xRAN
70       2) changed namespace and reference from xran to o-ran";
71
72     reference "ORAN-WG4.M.0-v01.00";
73   }
74
75   typedef password-type {
76     type string {
77       length "8..128";
78       pattern "[a-zA-Z0-9!$%\\^()\\[\\]_\\-~{}.+]*" {
79         error-message "Password content does not meet the requirements";
80       }
81     }
82     description
83       "The password for this entry. This shouldn't be in clear text
84        The Password must contain at least 2 characters from
85        each of the following groups:
86        a) Lower case alphabetic (a-z)
87        b) Upper case alphabetic (A-Z)
88        c) Numeric 0-9
89        d) Special characters Allowed !$%^()[]_-~{}.+
90        Password must not contain Username.";
91   }
92
93   grouping user-list {
94     list user {
95       key "name";
96       description
97         "The list of local users configured on this device.";
98       leaf name {
99         type nacm:user-name-type;
100         description
101           "The user name string identifying this entry.
102
103           NOTE: o-ran-usermgmt:user-profile/user/name is
104           identical to nacm:nacm/groups/group/user-name
105           but the current schema is preserved for backwards
106           compatibility.";
107       }
108       leaf account-type {
109         type enumeration {
110           enum PASSWORD {
111             description "the user-name is for password based authentication";
112           }
113           enum CERTIFICATE {
114             description "the user-name is for certificate based authentciation";
115           }
116         }
117         default "PASSWORD";
118       }
119
120       leaf password {
121         nacm:default-deny-all;
122         type password-type;
123         description
124           "The password for this entry.
125
126           This field is only valid when account-type is NOT set to CERTIFICATE,
127           i.e., when account-type is NOT present or present and set to
128           PASSWORD.";
129       }
130       leaf enabled {
131         type boolean;
132         description
133           "Indicates whether an account is enabled or disabled.
134
135            A NETCONF Server shall reject a configuration that attempts to
136            enable a Password account for an account where the password leaf
137            is not configured.
138
139            This validation statement is included in the YANG description and
140            not in a MUST statement to preserve backwards compatibility.";
141       }
142     }
143   }
144
145   container users {
146     // checkAS
147     // must "user/enabled='true'" {
148     //   error-message "At least one account needs to be enabled.";
149     // }
150
151     //TAKE NOTE - any configuration with zero enabled users is invalid.
152     //This will typically be the case when using a simulated NETCONF Server
153     //and so this constraint should be removed when operating in those scenarios
154
155     //The config data base of the O-RAN equipment should ensure that the user
156     //default account is enabled on factory restart
157
158     description "list of user accounts";
159     uses user-list;
160   }
161
162   rpc chg-password {
163     nacm:default-deny-all;
164     input {
165       leaf currentPassword {
166         type password-type;
167         mandatory true;
168         description
169           "provide the current password";
170       }
171       leaf newPassword {
172         type password-type;
173         mandatory true;
174         description
175           "provide a new password";
176       }
177       leaf newPasswordConfirm {
178         type password-type;
179         mandatory true;
180         description
181           "re-enter the new password ";
182       }
183     }
184     output {
185       leaf status {
186         type enumeration {
187           enum "Successful" {
188             value 1;
189           }
190           enum "Failed" {
191             value 2;
192           }
193         }
194         mandatory true;
195         description
196           "Successful or Failed";
197       }
198       leaf status-message {
199         type string;
200         description
201           "Gives a more detailed reason for success / failure";
202       }
203     }
204   }
205
206 }