+module ietf-network-topology {\r
+ yang-version 1;\r
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";\r
+ prefix lnk;\r
+\r
+ import ietf-inet-types {\r
+ prefix inet;\r
+ }\r
+ import ietf-network {\r
+ prefix nd;\r
+ }\r
+\r
+ organization "TBD";\r
+ contact\r
+ "WILL-BE-DEFINED-LATER";\r
+ description\r
+ "This module defines a common base model for network topology, \r
+ augmenting the base network model with links to connect nodes, \r
+ as well as termination points to terminate links on nodes.";\r
+\r
+ revision 2015-06-08 {\r
+ description\r
+ "Initial revision.";\r
+ reference "draft-ietf-i2rs-yang-network-topo-01";\r
+ }\r
+\r
+ typedef link-id {\r
+ type inet:uri;\r
+ description\r
+ "An identifier for a link in a topology.\r
+ The identifier may be opaque.\r
+ The identifier SHOULD be chosen such that the same link in a\r
+ real network topology will always be identified through the\r
+ same identifier, even if the model is instantiated in \r
+ separate datastores. An implementation MAY choose to capture\r
+ semantics in the identifier, for example to indicate the type\r
+ of link and/or the type of topology that the link is a part \r
+ of.";\r
+ }\r
+\r
+ typedef tp-id {\r
+ type inet:uri;\r
+ description\r
+ "An identifier for termination points on a node.\r
+ The identifier may be opaque.\r
+ The identifier SHOULD be chosen such that the same TP in a\r
+ real network topology will always be identified through the\r
+ same identifier, even if the model is instantiated in\r
+ separate datastores. An implementation MAY choose to capture\r
+ semantics in the identifier, for example to indicate the type\r
+ of TP and/or the type of node and topology that the TP is a \r
+ part of.";\r
+ }\r
+\r
+ grouping link-ref {\r
+ description\r
+ "References a link in a specific network.";\r
+ leaf link-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/../"+\r
+ "nd:network-ref]/link/link-id";\r
+ }\r
+ description\r
+ "A type for an absolute reference a link instance.\r
+ (This type should not be used for relative references.\r
+ In such a case, a relative path should be used instead.)";\r
+ }\r
+ uses nd:network-ref;\r
+ }\r
+\r
+ grouping tp-ref {\r
+ description\r
+ "References a termination point in a specific node.";\r
+ leaf tp-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/../"+\r
+ "nd:network-ref]/nd:node[nd:node-id=current()/../"+\r
+ "nd:node-ref]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "A type for an absolute reference to a termination point.\r
+ (This type should not be used for relative references.\r
+ In such a case, a relative path should be used instead.)";\r
+ }\r
+ uses nd:node-ref;\r
+ }\r
+\r
+ augment "/nd:network" {\r
+ description \r
+ "Add links to the network model.";\r
+ list link {\r
+ key "link-id";\r
+ description\r
+ "A Network Link connects a by Local (Source) node and\r
+ a Remote (Destination) Network Nodes via a set of the\r
+ nodes' termination points.\r
+ As it is possible to have several links between the same\r
+ source and destination nodes, and as a link could\r
+ potentially be re-homed between termination points, to\r
+ ensure that we would always know to distinguish between\r
+ links, every link is identified by a dedicated link\r
+ identifier.\r
+ Note that a link models a point-to-point link, not a\r
+ multipoint link.\r
+ Layering dependencies on links in underlay topologies are\r
+ not represented as the layering information of nodes and of\r
+ termination points is sufficient.";\r
+ container source {\r
+ description\r
+ "This container holds the logical source of a particular\r
+ link.";\r
+ leaf source-node {\r
+ type leafref {\r
+ path "../../../nd:node/nd:node-id";\r
+ }\r
+ mandatory true;\r
+ description\r
+ "Source node identifier, must be in same topology.";\r
+ }\r
+ leaf source-tp {\r
+ type leafref {\r
+ path "../../../nd:node[nd:node-id=current()/../"+\r
+ "source-node]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "Termination point within source node that terminates\r
+ the link.";\r
+ }\r
+ }\r
+ container destination {\r
+ description\r
+ "This container holds the logical destination of a\r
+ particular link.";\r
+ leaf dest-node {\r
+ type leafref {\r
+ path "../../../nd:node/nd:node-id";\r
+ }\r
+ mandatory true;\r
+ description\r
+ "Destination node identifier, must be in the same\r
+ network.";\r
+ }\r
+ leaf dest-tp {\r
+ type leafref {\r
+ path "../../../nd:node[nd:node-id=current()/../"+\r
+ "dest-node]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "Termination point within destination node that\r
+ terminates the link.";\r
+ }\r
+ }\r
+ leaf link-id {\r
+ type link-id;\r
+ description\r
+ "The identifier of a link in the topology.\r
+ A link is specific to a topology to which it belongs.";\r
+ }\r
+ list supporting-link {\r
+ key "network-ref link-ref";\r
+ description\r
+ "Identifies the link, or links, that this link\r
+ is dependent on.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "../../../nd:supporting-network/nd:network-ref";\r
+ }\r
+ description\r
+ "This leaf identifies in which underlay topology\r
+ supporting link is present.";\r
+ }\r
+ leaf link-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/.."+\r
+ "/network-ref]/link/link-id";\r
+ }\r
+ description\r
+ "This leaf identifies a link which is a part\r
+ of this link's underlay. Reference loops, in which\r
+ a link identifies itself as its underlay, either\r
+ directly or transitively, are not allowed.";\r
+ }\r
+ }\r
+ }\r
+ }\r
+ augment "/nd:network/nd:node" {\r
+ description\r
+ "Augment termination points which terminate links. \r
+ Termination points can ultimately be mapped to interfaces.";\r
+ list termination-point {\r
+ key "tp-id";\r
+ description\r
+ "A termination point can terminate a link.\r
+ Depending on the type of topology, a termination point\r
+ could, for example, refer to a port or an interface.";\r
+ leaf tp-id {\r
+ type tp-id;\r
+ description\r
+ "Termination point identifier.";\r
+ }\r
+ list supporting-termination-point {\r
+ key "network-ref node-ref tp-ref";\r
+ description\r
+ "The leaf list identifies any termination points that\r
+ the termination point is dependent on, or maps onto.\r
+ Those termination points will themselves be contained\r
+ in a supporting node.\r
+ This dependency information can be inferred from\r
+ the dependencies between links. For this reason,\r
+ this item is not separately configurable. Hence no\r
+ corresponding constraint needs to be articulated.\r
+ The corresponding information is simply provided by the\r
+ implementing system.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "../../../nd:supporting-node/nd:network-ref";\r
+ }\r
+ description\r
+ "This leaf identifies in which topology the\r
+ supporting termination point is present.";\r
+ }\r
+ leaf node-ref {\r
+ type leafref {\r
+ path "../../../nd:supporting-node/nd:node-ref";\r
+ }\r
+ description\r
+ "This leaf identifies in which node the supporting\r
+ termination point is present.";\r
+ }\r
+ leaf tp-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/../"+\r
+ "network-ref]/nd:node[nd:node-id=current()/../"+\r
+ "node-ref]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "Reference to the underlay node, must be in a\r
+ different topology";\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r