Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / code-generator / code-generator-demo / src / main / resources / test-topology.yang
1 // vi: set smarttab sw=4 tabstop=4:
2 module abstract-topology {
3         yang-version 1;
4     namespace "pre:simple.test.demo";
5     prefix "tp";
6
7         import ietf-inet-types { prefix "inet"; }
8     import abstract-prefixes { prefix "abs-pref"; }
9     
10         organization "Cisco";
11
12     contact "WILL-BE-DEFINED-LATER";
13
14     description "
15                 This module contains the definitions of elements that creates network 
16                 topology i.e. definition of network nodes and links. This module is
17                 not designed to be used solely for network representation. This module
18                 SHOULD be used as base module in defining the network topology.
19         ";
20     
21     revision "2012-02-08" {
22         reference " WILL BE DEFINED LATER";
23     }
24
25     typedef topology-id-ref {
26         type leafref {
27                 path "/tp:topology/tp:topology-id";
28         }
29         description "This type is used for leafs that reference topology identifier instance.";
30     }
31
32         typedef network-node-id-ref {
33                 type leafref {
34                         path "/tp:topology/tp:network-nodes/tp:network-node/tp:node-id";
35                 }
36                 description "This type is used for leafs that reference network node instance.";
37         }
38
39         typedef link-id-ref {
40                 type leafref {
41                         path "/tp:topology/tp:network-links/tp:network-link/tp:link-id";
42                 }
43                 description "This type is used for leafs that reference network link instance.";
44         }
45
46         container topology {
47         description "
48                         This is the model of abstract topology which contains only Network
49                         Nodes and Network Links. Each topology MUST be identified by
50                         unique topology-id for reason that the store could contain many
51                         topologies.
52                 ";
53
54         leaf topology-id {
55             type inet:uri;
56             description "
57                                 It is presumed that datastore will contain many topologies. To
58                                 distinguish between topologies it is vital to have UNIQUE
59                                 topology identifier.
60                         ";
61         }
62
63         container network-nodes {
64                 list network-node {
65                     description "The list of network nodes defined for topology.";
66
67                         key "node-id";
68
69                         leaf node-id {
70                                 type inet:uri;
71                                 description "The Topology identifier of network-node.";
72                         }
73
74                     container attributes {
75                                         description "
76                                                 Additional attributes that can Network Node contains.
77                                         ";
78                                 }
79                 }
80         }
81         
82         container network-links {
83                 list network-link {
84                     description "
85                                         The Network Link which is defined by Local (Source) and
86                                         Remote (Destination) Network Nodes. Every link MUST be
87                                         defined either by identifier and his local and remote
88                                         Network Nodes (in real applications it is common that many
89                                         links are originated from one node and end up in same
90                                         remote node). To ensure that we would always know to
91                                         distinguish between links, every link SHOULD have
92                                         identifier.
93                                 ";
94                         key "link-id";
95
96                         leaf link-id {
97                                 type inet:uri;
98                                 description "";
99                         }
100
101                     container source {
102                                         leaf node-id {
103                                                 type node-id-ref;
104                                                 description "Source node identifier.";
105                                         }
106                                 }
107
108                                 container destination {
109                                         leaf node-id {
110                                                 type node-id-ref;
111                                                 description "Destination node identifier.";
112                                         }
113                                 }
114
115                                 container attributes {
116                                         description "Aditional attributes that can Network Link contains.";
117                                 }
118                     }
119         }
120     }
121
122     //TODO: add base operations
123 }