Add transport-{api,tcp}
[netconf.git] / transport / transport-tcp / src / main / yang / ietf-tcp-server@2022-05-24.yang
1 module ietf-tcp-server {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-tcp-server";
4   prefix tcps;
5
6   import ietf-inet-types {
7     prefix inet;
8     reference
9       "RFC 6991: Common YANG Data Types";
10   }
11
12   import ietf-tcp-common {
13     prefix tcpcmn;
14     reference
15       "RFC DDDD: YANG Groupings for TCP Clients and TCP Servers";
16   }
17
18   organization
19     "IETF NETCONF (Network Configuration) Working Group and the
20      IETF TCP Maintenance and Minor Extensions (TCPM) Working Group";
21
22   contact
23     "WG Web:   https://datatracker.ietf.org/wg/netconf
24                https://datatracker.ietf.org/wg/tcpm
25      WG List:  NETCONF WG list <mailto:netconf@ietf.org>
26                TCPM WG list <mailto:tcpm@ietf.org>
27      Authors:  Kent Watsen <mailto:kent+ietf@watsen.net>
28                Michael Scharf
29                <mailto:michael.scharf@hs-esslingen.de>";
30
31   description
32     "This module defines reusable groupings for TCP servers that
33      can be used as a basis for specific TCP server instances.
34
35      Copyright (c) 2022 IETF Trust and the persons identified
36      as authors of the code. All rights reserved.
37
38      Redistribution and use in source and binary forms, with
39      or without modification, is permitted pursuant to, and
40      subject to the license terms contained in, the Revised
41      BSD License set forth in Section 4.c of the IETF Trust's
42      Legal Provisions Relating to IETF Documents
43      (https://trustee.ietf.org/license-info).
44
45      This version of this YANG module is part of RFC DDDD
46      (https://www.rfc-editor.org/info/rfcDDDD); see the RFC
47      itself for full legal notices.
48
49      The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
50      'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
51      'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
52      are to be interpreted as described in BCP 14 (RFC 2119)
53      (RFC 8174) when, and only when, they appear in all
54      capitals, as shown here.";
55
56   revision 2022-05-24 {
57     description
58       "Initial version";
59     reference
60       "RFC DDDD: YANG Groupings for TCP Clients and TCP Servers";
61   }
62
63   // Features
64
65   feature tcp-server-keepalives {
66     description
67       "Per socket TCP keepalive parameters are configurable for
68        TCP servers on the server implementing this feature.";
69   }
70
71   // Groupings
72
73   grouping tcp-server-grouping {
74     description
75       "A reusable grouping for configuring a TCP server.
76
77        Note that this grouping uses fairly typical descendant
78        node names such that a stack of 'uses' statements will
79        have name conflicts.  It is intended that the consuming
80        data model will resolve the issue (e.g., by wrapping
81        the 'uses' statement in a container called
82        'tcp-server-parameters').  This model purposely does
83        not do this itself so as to provide maximum flexibility
84        to consuming models.";
85     leaf local-address {
86       type inet:ip-address;
87       mandatory true;
88       description
89         "The local IP address to listen on for incoming
90          TCP client connections.  INADDR_ANY (0.0.0.0) or
91          INADDR6_ANY (0:0:0:0:0:0:0:0 a.k.a. ::) MUST be
92          used when the server is to listen on all IPv4 or
93          IPv6 addresses, respectively.";
94     }
95     leaf local-port {
96       type inet:port-number;
97       default "0";
98       description
99         "The local port number to listen on for incoming TCP
100          client connections.  An invalid default value (0)
101          is used (instead of 'mandatory true') so that an
102          application level data model may 'refine' it with
103          an application specific default port number value.";
104     }
105     uses tcpcmn:tcp-common-grouping {
106       augment "keepalives" {
107         if-feature "tcp-server-keepalives";
108         description
109           "Add an if-feature statement so that implementations
110            can choose to support TCP server keepalives.";
111       }
112     }
113   }
114 }