Fix tests imports
[netconf.git] / transport / transport-http / src / main / yang / ietf-http-server@2023-04-17.yang
1 module ietf-http-server {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-http-server";
4   prefix https;
5
6   import iana-crypt-hash {
7     prefix ianach;
8     reference
9       "RFC 7317: A YANG Data Model for System Management";
10   }
11
12   import ietf-netconf-acm {
13     prefix nacm;
14     reference
15       "RFC 8341: Network Configuration Access Control Model";
16   }
17
18   import ietf-tcp-server {
19     prefix tcps;
20     reference
21       "RFC DDDD: YANG Groupings for TCP Clients and TCP Servers";
22   }
23
24   import ietf-tls-server {
25     prefix tlss;
26     reference
27       "RFC FFFF: YANG Groupings for TLS Clients and TLS Servers";
28   }
29
30   organization
31     "IETF NETCONF (Network Configuration) Working Group";
32
33   contact
34     "WG Web:   https://datatracker.ietf.org/wg/netconf
35      WG List:  NETCONF WG list <mailto:netconf@ietf.org>
36      Author:   Kent Watsen <mailto:kent+ietf@watsen.net>";
37
38   description
39     "This module defines reusable groupings for HTTP servers that
40      can be used as a basis for specific HTTP server instances.
41
42      Copyright (c) 2023 IETF Trust and the persons identified
43      as authors of the code. All rights reserved.
44
45      Redistribution and use in source and binary forms, with
46      or without modification, is permitted pursuant to, and
47      subject to the license terms contained in, the Revised
48      BSD License set forth in Section 4.c of the IETF Trust's
49      Legal Provisions Relating to IETF Documents
50      (https://trustee.ietf.org/license-info).
51
52      This version of this YANG module is part of RFC GGGG
53      (https://www.rfc-editor.org/info/rfcGGGG); see the RFC
54      itself for full legal notices.
55
56      The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
57      'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
58      'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
59      are to be interpreted as described in BCP 14 (RFC 2119)
60      (RFC 8174) when, and only when, they appear in all
61      capitals, as shown here.";
62
63   revision 2023-04-17 {
64     description
65       "Initial version";
66     reference
67       "RFC GGGG: YANG Groupings for HTTP Clients and HTTP Servers";
68   }
69
70   // Features
71
72   feature client-auth-supported {
73     description
74       "Indicates that the server supports configuring HTTP
75        servers to authenticate HTTP clients.  HTTP-level client
76        authentication may not be needed when client authentication
77        is expected to occur only at another protocol layer (e.g.,
78        TLS).";
79   }
80
81   feature local-users-supported {
82     if-feature "client-auth-supported";
83     description
84       "Indicates that the server supports configuring client
85        authentication with its own database of local users, as
86        opposed to in an application specific location.";
87   }
88
89   feature basic-auth {
90     if-feature "local-users-supported";
91     description
92       "Indicates that the server supports configuring 'basic'
93        authentication credentials in its local user database.";
94     reference
95       "RFC 7617: The 'Basic' HTTP Authentication Scheme";
96   }
97
98   feature tcp-supported {
99     description
100       "Indicates that the server supports configuring HTTP
101        servers to listen for HTTP 1.1/2.0 connections over TCP.";
102     reference
103       "RFC 9110: HTTP Semantics";
104   }
105
106   feature tls-supported {
107     description
108       "Indicates that the server supports configuring HTTP
109        servers to listen for HTTP 1.1/2.0 connections over TLS.";
110     reference
111       "RFC 9110: HTTP Semantics";
112   }
113
114   // Groupings
115
116   grouping http-server-grouping {
117     description
118       "A reusable grouping for configuring an HTTP server.
119
120        Note that this grouping uses fairly typical descendant
121        node names such that a stack of 'uses' statements will
122        have name conflicts.  It is intended that the consuming
123        data model will resolve the issue (e.g., by wrapping
124        the 'uses' statement in a container called
125        'http-server-parameters').  This model purposely does
126        not do this itself so as to provide maximum flexibility
127        to consuming models.";
128
129     leaf server-name {
130       nacm:default-deny-write;
131       type string;
132       description
133         "The value of the 'Server' header field.  If not set, then
134          underlying software's default value is used.  Set to the
135          empty string to disable.";
136     }
137
138     container client-authentication {
139       if-feature "client-auth-supported";
140       nacm:default-deny-write;
141       presence
142         "Indicates that HTTP based client authentication is
143          configured.  This statement is present so the mandatory
144          descendant nodes do not imply that this node must be
145          configured.";
146       description
147         "Configures how the HTTP server can authenticate HTTP
148          clients.  The HTTP server will request that the HTTP
149          client send authentication when needed.";
150       container users {
151         if-feature "local-users-supported";
152         description
153           "A list of locally configured users.";
154         list user {
155           key "user-id";
156           description
157             "The list of local users configured on this device.";
158           leaf user-id {
159             type string;
160             description
161               "The user-id for the authenticating client.";
162           }
163           choice auth-type {
164             mandatory true;
165             description
166               "The authentication type.";
167             case basic {
168               container basic {
169                 if-feature "basic-auth";
170                 leaf user-id {
171                   type string;
172                   description
173                     "The user-id for the authenticating client.";
174                 }
175                 leaf password {
176                   nacm:default-deny-write;
177                   type ianach:crypt-hash;
178                   description
179                     "The password for the authenticating client.";
180                 }
181                 description
182                   "The 'basic' HTTP scheme credentials.";
183                 reference
184                   "RFC 7617:
185                     The 'Basic' HTTP Authentication Scheme";
186               }
187             }
188           }
189         }
190       }
191     } // container client-authentication
192   } // grouping http-server-grouping
193
194   grouping http-server-stack-grouping {
195     description
196       "A grouping that defines common HTTP-based protocol stacks.";
197     choice transport {
198       mandatory true;
199       description
200         "Choice amongst various transports type.  TCP, with and
201          without TLS are defined here, with 'feature' statements
202          so that they may be disabled.  Other transports MAY be
203          augmented in as 'case' statements by future efforts.";
204       case tcp {
205         if-feature "tcp-supported";
206         container tcp {
207           description
208             "Container for TCP-based HTTP protocols.";
209           container tcp-server-parameters {
210             description
211               "A wrapper around the TCP parameters to avoid
212                name collisions.";
213             uses tcps:tcp-server-grouping;
214           }
215           container http-server-parameters {
216             description
217               "A wrapper around the HTTP parameters to avoid
218                name collisions.";
219             uses http-server-grouping;
220           }
221         }
222       }
223       case tls {
224         if-feature "tls-supported";
225         container tls {
226           description
227             "Container for TLS-based HTTP protocols.";
228           container tcp-server-parameters {
229             description
230               "A wrapper around the TCP parameters to avoid
231                name collisions.";
232             uses tcps:tcp-server-grouping;
233           }
234           container tls-server-parameters {
235             description
236               "A wrapper around the TLS parameters to avoid
237                name collisions.";
238             uses tlss:tls-server-grouping;
239           }
240           container http-server-parameters {
241             description
242               "A wrapper around the HTTP parameters to avoid
243                name collisions.";
244             uses http-server-grouping;
245           }
246         }
247       }
248     }
249   } // http-server-stack-grouping
250
251 }