ddaa602ba2d1173ae429bded138499300039a548
[netconf.git] / restconf / restconf-nb-bierman02 / src / test / resources / jukebox / example-jukebox@2015-04-04.yang
1 module example-jukebox {
2
3       namespace "http://example.com/ns/example-jukebox";
4       prefix "jbox";
5
6       organization "Example, Inc.";
7       contact "support at example.com";
8       description "Example Jukebox Data Model Module";
9       revision "2015-04-04" {
10         description "Initial version.";
11         reference "example.com document 1-4673";
12       }
13
14       identity genre {
15         description "Base for all genre types";
16       }
17
18       // abbreviated list of genre classifications
19       identity alternative {
20         base genre;
21         description "Alternative music";
22       }
23       identity blues {
24         base genre;
25         description "Blues music";
26       }
27       identity country {
28         base genre;
29         description "Country music";
30       }
31       identity jazz {
32         base genre;
33         description "Jazz music";
34       }
35       identity pop {
36         base genre;
37         description "Pop music";
38       }
39       identity rock {
40         base genre;
41         description "Rock music";
42       }
43
44       container jukebox {
45         presence
46           "An empty container indicates that the jukebox
47            service is available";
48
49         description
50           "Represents a jukebox resource, with a library, playlists,
51            and a play operation.";
52
53         container library {
54
55           description "Represents the jukebox library resource.";
56
57           list artist {
58             key name;
59
60             description
61               "Represents one artist resource within the
62                jukebox library resource.";
63
64             leaf name {
65               type string {
66                 length "1 .. max";
67               }
68               description "The name of the artist.";
69             }
70
71             list album {
72               key name;
73
74               description
75                 "Represents one album resource within one
76                  artist resource, within the jukebox library.";
77
78               leaf name {
79                 type string {
80                   length "1 .. max";
81                 }
82                 description "The name of the album.";
83               }
84
85               leaf genre {
86                 type identityref { base genre; }
87                 description
88                   "The genre identifying the type of music on
89                    the album.";
90               }
91
92               leaf year {
93                 type uint16 {
94                   range "1900 .. max";
95                 }
96                 description "The year the album was released";
97               }
98
99               container admin {
100                 description
101                   "Administrative information for the album.";
102
103                 leaf label {
104                   type string;
105                   description "The label that released the album.";
106                 }
107                 leaf catalogue-number {
108                   type string;
109                   description "The album's catalogue number.";
110                 }
111               }
112
113               list song {
114                 key name;
115
116                 description
117                   "Represents one song resource within one
118                    album resource, within the jukebox library.";
119
120                 leaf name {
121                   type string {
122                      length "1 .. max";
123                   }
124                   description "The name of the song";
125                 }
126                 leaf location {
127                   type string;
128                   mandatory true;
129                   description
130                    "The file location string of the
131                     media file for the song";
132                 }
133                 leaf format {
134                   type string;
135                   description
136                     "An identifier string for the media type
137                      for the file associated with the
138                      'location' leaf for this entry.";
139                 }
140                 leaf length {
141                   type uint32;
142                   units "seconds";
143                   description
144                     "The duration of this song in seconds.";
145                 }
146               }   // end list 'song'
147             }   // end list 'album'
148           }  // end list 'artist'
149
150           leaf artist-count {
151              type uint32;
152              units "songs";
153              config false;
154              description "Number of artists in the library";
155           }
156           leaf album-count {
157              type uint32;
158              units "albums";
159              config false;
160              description "Number of albums in the library";
161           }
162           leaf song-count {
163              type uint32;
164              units "songs";
165              config false;
166              description "Number of songs in the library";
167           }
168         }  // end library
169
170         list playlist {
171           key name;
172
173           description
174             "Example configuration data resource";
175
176           leaf name {
177             type string;
178             description
179               "The name of the playlist.";
180           }
181           leaf description {
182             type string;
183             description
184               "A comment describing the playlist.";
185           }
186
187           list song {
188             key index;
189             ordered-by user;
190
191             description
192               "Example nested configuration data resource";
193
194             leaf index {    // not really needed
195               type uint32;
196               description
197                 "An arbitrary integer index for this playlist song.";
198             }
199             leaf id {
200               type leafref {
201                 path "/jbox:jukebox/jbox:library/jbox:artist/" +
202                      "jbox:album/jbox:song/jbox:name";
203               }
204               mandatory true;
205               description
206                 "Song identifier. Must identify an instance of
207                  /jukebox/library/artist/album/song/name.";
208             }
209           }
210         }
211
212         container player {
213           description
214             "Represents the jukebox player resource.";
215
216           leaf gap {
217             type decimal64 {
218               fraction-digits 1;
219               range "0.0 .. 2.0";
220             }
221             units "tenths of seconds";
222             description "Time gap between each song";
223           }
224         }
225       }
226
227       rpc play {
228         description "Control function for the jukebox player";
229         input {
230           leaf playlist {
231             type string;
232             mandatory true;
233             description "playlist name";
234           }
235
236           leaf song-number {
237             type uint32;
238             mandatory true;
239             description "Song number in playlist to play";
240           }
241         }
242       }
243    }