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