87ebfc0290e738da390329c7765e8695b9d108d6
[netconf.git] / netconf / callhome-model / src / main / yang / odl-netconf-callhome-server.yang
1 module odl-netconf-callhome-server {
2
3   namespace "urn:opendaylight:params:xml:ns:yang:netconf-callhome-server";
4   prefix "callhome";
5
6   organization
7    "OpenDaylight Project";
8
9   contact
10    "netconf-dev@lists.opendaylight.org";
11
12   description
13    "This module defines the northbound interface for OpenDaylight NETCONF Callhome.";
14
15   revision 2024-01-29 {
16     description
17       "A number of improvements to the sematics of this model. In concrete terms:
18        - every device now has to have a transport
19        - previously-deprecated 'ssh-host-key' is now obsolete
20        - 'credentials; is obsoleted as well
21        - 'host-key' is now a dedicated typedef based on 'type binary'";
22   }
23
24   revision 2023-04-28 {
25     description "This revision integrates device-status leaf, formerly hosted in callhome-device.yang";
26   }
27
28   revision 2020-10-15 {
29     description
30      "This revision adds connectivity details for one of the supported transport protocols";
31     reference
32      "RFC 8071: NETCONF Call Home and RESTCONF Call Home";
33   }
34
35   revision "2016-11-09" {
36     description "Initial version";
37   }
38
39   typedef ssh-public-key {
40     description "An SSH public key encoded in RFC4253 format";
41     reference "RFC4253 section 6.6";
42     type binary {
43       // Note: the format requires at least 8 bytes for length of the algo and its bytes
44       length "8..max";
45     }
46   }
47
48   grouping credentials {
49     container credentials {
50       presence "Credentials to device.";
51       leaf username {
52         mandatory true;
53         description "Username to be used for authentication";
54         type string {
55           length "1..max";
56         }
57       }
58       leaf-list passwords {
59         description "Passwords to be used for authentication.";
60         type string;
61       }
62     }
63   }
64
65   container netconf-callhome-server {
66     description "Settings for call home server administration";
67
68     container global {
69       presence "global credentials are enabled.";
70       uses credentials;
71       leaf accept-all-ssh-keys {
72         type boolean;
73         default false;
74       }
75
76       leaf mount-point-naming-strategy {
77         type enumeration {
78           enum IP_PORT;
79           enum IP_ONLY;
80         }
81         default IP_PORT;
82         description "Mount name will be chosen as per this strategy in the absence of per device settings. Default is IP_PORT";
83       }
84     }
85
86     container allowed-devices {
87       description "A list of allowed devices";
88       list device {
89         key unique-id;
90         leaf unique-id {
91           description "Identifier of device, which will be used to identify device.";
92           type string;
93         }
94
95         choice transport {
96           description "Provides connectivity details for one of the supported transport protocols";
97           mandatory true;
98
99           case ssh {
100             container ssh-client-params {
101               leaf host-key {
102                 mandatory true;
103                 description "Public key which device will use during connection.";
104                 type ssh-public-key;
105               }
106               uses credentials;
107             }
108           }
109           case tls {
110             container tls-client-params {
111               leaf certificate-id {
112                 mandatory true;
113                 description "Certificate identifier which will be used during two-way TLS authentication.";
114                 type string;
115               }
116               leaf key-id {
117                 mandatory true;
118                 description "Key identifier inside the NetConf keystore which will be used during two-way TLS authentication.";
119                 type string;
120               }
121             }
122           }
123         }
124         unique transport/ssh/ssh-client-params/host-key;
125         unique transport/tls/tls-client-params/certificate-id;
126
127         leaf device-status {
128           config false;
129           type enumeration {
130             enum CONNECTED;
131             enum FAILED_AUTH_FAILURE;
132             enum FAILED_NOT_ALLOWED;
133             enum FAILED;
134             enum DISCONNECTED;
135           }
136           default DISCONNECTED;
137         }
138
139         leaf ssh-host-key {
140           description "Obsolete, a 'host-key' from the 'ssh-client-params' containers should be used instead.";
141           status obsolete;
142           type string;
143         }
144         unique ssh-host-key;
145         uses credentials {
146           status obsolete;
147         }
148       }
149     }
150   }
151 }