Split out odl-netconf-device.yang
[netconf.git] / netconf / sal-netconf-connector / src / main / yang / netconf-node-topology.yang
index 6dab3d6e1ae9afe0845ae44ae36230d7b5f10234..4614290a734f206a39fd1f8cac2d1a274625f036 100644 (file)
@@ -4,227 +4,55 @@ module netconf-node-topology {
 
     import network-topology { prefix nt; revision-date 2013-10-21; }
     import yang-ext { prefix ext; revision-date "2013-07-09";}
-    import ietf-inet-types { prefix inet; revision-date "2010-09-24"; }
+    import netconf-node-optional { prefix nno; revision-date "2019-06-14"; }
+    import odl-netconf-device { prefix ond; }
 
-    revision "2015-01-14" {
-        description "Initial revision of Topology model";
+    revision 2022-12-25 {
+        description "Refactored into odl-netconf-device";
     }
 
-    augment "/nt:network-topology/nt:topology/nt:topology-types" {
-        container topology-netconf {
-        }
+    revision "2015-01-14" {
+        description "Initial revision of Topology model";
     }
 
-    grouping netconf-node-credentials {
-
-        choice credentials {
-            config true;
-            case login-password {
-                leaf username {
-                    type string;
-                }
-
-                leaf password {
-                    type string;
-                }
-            }
-        }
+    grouping netconf-node-fields {
+      uses ond:credentials;
+      uses ond:connection-parameters;
+      uses ond:netconf-schema-storage;
     }
 
-    grouping netconf-node-connection-parameters {
-
-        leaf host {
-            type inet:host;
-        }
-
-        leaf port {
-            type inet:port-number;
-        }
-
-        leaf tcp-only {
-            config true;
-            type boolean;
-        }
-
-        container yang-module-capabilities {
-            config true;
-            leaf override {
-                type boolean;
-                default false;
-                description "Whether to override or merge this list of capabilities with capabilities from device";
-            }
-
-            leaf-list capability {
+    rpc create-device {
+        input {
+            uses netconf-node-fields;
+            uses nno:netconf-node-augmented-optional-fields;
+            leaf node-id {
                 type string;
-                description "Set a list of capabilities to override capabilities provided in device's hello message.
-                             Can be used for devices that do not report any yang modules in their hello message";
-            }
-        }
-
-        leaf reconnect-on-changed-schema {
-            config true;
-            type boolean;
-            default false;
-            description "If true, the connector would auto disconnect/reconnect when schemas are changed in the remote device.
-                         The connector subscribes (right after connect) to base netconf notifications and listens for netconf-capability-change notification";
-        }
-
-        leaf connection-timeout-millis {
-            description "Specifies timeout in milliseconds after which connection must be established.";
-            config true;
-            type uint32;
-            default 20000;
-        }
-
-        leaf default-request-timeout-millis {
-            description "Timeout for blocking operations within transactions.";
-            config true;
-            type uint32;
-            default 60000;
-        }
-
-        leaf max-connection-attempts {
-            description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
-            config true;
-            type uint32;
-            default 0; // retry forever
-        }
-
-        leaf between-attempts-timeout-millis {
-            description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by sleep-factor with every additional attempt";
-            config true;
-            type uint16;
-            default 2000;
-        }
-
-        leaf sleep-factor {
-            config true;
-            type decimal64 {
-                fraction-digits 1;
             }
-            default 1.5;
-        }
-
-        // Keepalive configuration
-        leaf keepalive-delay {
-            config true;
-            type uint32;
-            default 120;
-            description "Netconf connector sends keepalive RPCs while the session is idle, this delay specifies the delay between keepalive RPC in seconds
-                         If a value <1 is provided, no keepalives will be sent";
         }
     }
 
-    grouping netconf-node-connection-status {
-
-        leaf connection-status {
-            config false;
-            type enumeration {
-                enum connecting;
-                enum connected;
-                enum unable-to-connect;
-            }
-        }
-
-        container clustered-connection-status {
-            config false;
-            list node-status {
-                leaf node {
-                    type string;
-                }
-                leaf status {
-                    type enumeration {
-                        enum connected;
-                        enum unavailable;
-                        enum failed;
-                    }
-                }
-            }
-        }
-
-        leaf connected-message {
-            config false;
-            type string;
-        }
-
-        container available-capabilities {
-            config false;
-            leaf-list available-capability {
+    rpc delete-device {
+        input {
+            leaf node-id {
                 type string;
             }
         }
-
-        container unavailable-capabilities {
-            config false;
-            list unavailable-capability {
-                leaf capability {
-                    type string;
-                }
-
-                leaf failure-reason {
-                    type enumeration {
-                        enum missing-source;
-                        enum unable-to-resolve;
-                    }
-                }
-            }
-        }
-
-        container pass-through {
-            when "../connection-status = connected";
-            description
-                "When the underlying node is connected, its NETCONF context
-                is available verbatim under this container through the
-                mount extension.";
-        }
-
     }
 
-    grouping netconf-schema-storage {
-        leaf schema-cache-directory {
-            config true;
-            type string;
-            default "schema";
-            description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
-                         so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
-        }
-
-        container yang-library {
-            leaf yang-library-url {
-                config true;
-                type inet:uri;
-                description "Yang library to be plugged as additional source provider into the shared schema repository";
-            }
-
-            // credentials for basic http authentication
-            leaf username {
-                config true;
-                type string;
-            }
-
-            leaf password {
-                config true;
-                type string;
-            }
+    augment "/nt:network-topology/nt:topology/nt:topology-types" {
+        container topology-netconf {
+            presence "The presence of the container node indicates a network
+                      of NETCONF devices";
         }
     }
 
-    grouping netconf-node-fields {
-
-        uses netconf-node-credentials;
-
-        uses netconf-node-connection-parameters;
-
-        uses netconf-node-connection-status;
-
-        uses netconf-schema-storage;
-
-    }
-
     augment "/nt:network-topology/nt:topology/nt:node" {
         when "../../nt:topology-types/topology-netconf";
         ext:augment-identifier "netconf-node";
 
         uses netconf-node-fields;
+        uses ond:connection-oper;
+        uses nno:netconf-node-augmented-optional-fields;
+        ext:mount;
     }
 }