Prevent NPE for Credentials
[netconf.git] / apps / netconf-topology / src / main / yang / netconf-node-topology.yang
1 module netconf-node-topology {
2     namespace "urn:opendaylight:netconf-node-topology";
3     prefix "nettop";
4     yang-version 1.1;
5
6     import network-topology { prefix nt; revision-date 2013-10-21; }
7     import yang-ext { prefix ext; revision-date "2013-07-09";}
8     import netconf-node-optional { prefix nno; }
9     import odl-netconf-device { prefix ond; }
10
11     revision 2024-06-11 {
12         description "Update the YANG model to version 1.1 and modify the rpc-credentials
13           choice within the rpc-credentials grouping to be mandatory";
14     }
15
16     revision 2023-11-21 {
17         description "Separated RPC create-device input credentials from odl-netconf-device";
18     }
19
20     revision 2022-12-25 {
21         description "Refactored into odl-netconf-device";
22     }
23
24     revision "2015-01-14" {
25         description "Initial revision of Topology model";
26     }
27
28     grouping netconf-node-fields {
29       uses ond:connection-parameters;
30       uses ond:netconf-schema-storage;
31       uses ond:datastore-access;
32     }
33
34     grouping rpc-username-password {
35         leaf username {
36             type string;
37         }
38
39         leaf password {
40             type string;
41         }
42     }
43
44     grouping rpc-credentials {
45         choice rpc-credentials {
46             mandatory true;
47             case login-pw {
48                 description "login-password credentials, encrypted.";
49
50                 container login-password {
51                     uses rpc-username-password;
52                 }
53             }
54             case login-pw-unencrypted {
55                 description "login-password credentials, not encrypted.";
56
57                 container login-password-unencrypted {
58                     uses rpc-username-password;
59                 }
60             }
61             case key-auth {
62                 description "key-based authentication, use the id for the pair thats stored in the keystore.";
63
64                 container key-based {
65                     leaf key-id {
66                         type string;
67                     }
68
69                     leaf username {
70                         type string;
71                     }
72                 }
73             }
74         }
75     }
76
77     rpc create-device {
78         status deprecated;
79         input {
80             uses rpc-credentials;
81             uses netconf-node-fields;
82             uses nno:netconf-node-augmented-optional-fields;
83             leaf node-id {
84                 type string;
85             }
86         }
87     }
88
89     rpc delete-device {
90         status deprecated;
91         input {
92             leaf node-id {
93                 type string;
94             }
95         }
96     }
97
98     augment "/nt:network-topology/nt:topology/nt:topology-types" {
99         container topology-netconf {
100             presence "The presence of the container node indicates a network
101                       of NETCONF devices";
102         }
103     }
104
105     augment "/nt:network-topology/nt:topology/nt:node" {
106         when "../../nt:topology-types/topology-netconf";
107         ext:augment-identifier "netconf-node";
108
109         uses ond:credentials;
110         uses netconf-node-fields;
111         uses ond:connection-oper;
112         ext:mount;
113     }
114 }