Added YANG models for base concepts in the controller
[controller.git] / opendaylight / sal / yang-prototype / model / model-topology / src / main / yang / topology.yang
diff --git a/opendaylight/sal/yang-prototype/model/model-topology/src/main/yang/topology.yang b/opendaylight/sal/yang-prototype/model/model-topology/src/main/yang/topology.yang
new file mode 100644 (file)
index 0000000..ad382c8
--- /dev/null
@@ -0,0 +1,160 @@
+module topology {
+    yang-version 1;
+    namespace "urn:ietf:params:xml:ns:yang:topology";
+    prefix "tp";
+
+    import ietf-inet-types { prefix "inet"; }
+    
+    organization "TBD";
+
+    contact "WILL-BE-DEFINED-LATER";
+
+    description "";
+    
+    revision 2013-06-11 {
+        description "Updated model with review comments. 
+            Removed top-level container network.
+            Moved network elements to separate module.";
+    }
+
+    typedef topology-id {
+        type inet:uri;
+    }
+
+    typedef node-id {
+        description "Node abstract identifier, schema for URI will be defined by augmentation";
+        type inet:uri;
+    }
+
+    typedef link-id {
+        description "Node abstract identifier, schema for URI will be defined by augmentation";
+        type inet:uri;
+    }
+
+    typedef tp-id {
+        type inet:uri;
+        description "identifier for termination points on a port";
+    }
+
+    typedef tp-ref {
+        type leafref {
+            path "/topologies/topology/nodes/node/termination-points/termination-point/tp-id";
+        }
+    }
+    typedef topology-ref {
+        type leafref {
+            path "/topologies/topology/topology-id";
+        }
+        description "This type is used for leafs that reference topology identifier instance.";
+        // currently not used
+    }
+
+    typedef node-ref {
+        type leafref {
+            path "/topologies/topology/nodes/node/node-id";
+        }
+        description "This type is used for leafs that reference a node instance.";
+    }
+
+    typedef link-ref {
+        type leafref {
+            path "/topologies/topology/links/link/link-id";
+        }
+        description "This type is used for leafs that reference a link instance.";
+        // currently not used
+    }
+
+    container topologies {
+        list topology {
+            description "
+                This is the model of abstract topology which contains only Network
+                Nodes and Network Links. Each topology MUST be identified by
+                unique topology-id for reason that the store could contain many
+                topologies.
+            ";
+            key "topology-id";
+            leaf topology-id {
+                type topology-id; 
+                description "
+                    It is presumed that datastore will contain many topologies. To
+                    distinguish between topologies it is vital to have UNIQUE
+                    topology identifier.
+                ";
+            }
+
+            container types {
+                description "
+                    The container for definition of topology types.
+                    The augmenting modules should add empty optional leaf 
+                    to this container to signalize topology type.
+                ";
+            }
+
+            container nodes {
+                list node {
+                    description "The list of network nodes defined for topology.";
+
+                    key "node-id";
+                    leaf node-id {
+                        type node-id;
+                        description "The Topology identifier of network-node.";
+                    }
+
+                    //leaf supporting-ne {
+                    //  type network-element-ref;
+                    //}
+                    
+                    container termination-points {
+                        list termination-point {
+                            key "tp-id";
+                            leaf tp-id {
+                                type tp-id;
+                            }
+                        }
+                    }
+                }
+            }
+    
+            container links {
+                list link {
+                    description "
+                        The Network Link which is defined by Local (Source) and
+                        Remote (Destination) Network Nodes. Every link MUST be
+                        defined either by identifier and his local and remote
+                        Network Nodes (in real applications it is common that many
+                        links are originated from one node and end up in same
+                        remote node). To ensure that we would always know to
+                        distinguish between links, every link SHOULD have
+                        identifier.
+                    ";
+                    key "link-id";
+    
+                    leaf link-id {
+                        type link-id;
+                        description "";
+                    }
+
+                    container source { 
+                        leaf source-node {
+                            type node-ref;
+                            description "Source node identifier.";
+                        }
+                        leaf source-tp {
+                            type tp-ref;
+                        }
+                    }
+                
+                    container destination { 
+                        leaf dest-node {
+                            type node-ref;
+                            description "Destination node identifier.";
+                        }
+                        leaf dest-tp {
+                            type tp-ref;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}