Persisting a list element to a parent list (ep2)
[cps.git] / cps-service / src / test / resources / bookstore.yang
1 module stores {
2     yang-version 1.1;
3     namespace "org:onap:ccsdk:sample";
4
5     prefix book-store;
6
7     revision "2020-09-15" {
8         description
9         "Sample Model";
10     }
11
12     typedef year {
13         type uint16 {
14             range "1000..9999";
15         }
16     }
17
18     list invoice {
19         key "ProductID";
20         leaf ProductID {
21             type uint64;
22             mandatory "true";
23             description
24             "Unique product ID. Example: 001";
25         }
26         leaf ProductName {
27             type string;
28             mandatory "true";
29             description
30             "Name of the Product";
31         }
32         leaf price {
33             type uint64;
34             mandatory "true";
35             description
36             "Price of book";
37         }
38         leaf stock {
39             type boolean;
40             default "false";
41             description
42             "Book in stock or not. Example value: true";
43         }
44     }
45
46     container bookstore {
47
48         leaf bookstore-name {
49             type string;
50         }
51
52     list categories {
53
54         key "code";
55
56         leaf code {
57             type string;
58         }
59
60         leaf name {
61             type string;
62         }
63
64         list books {
65             key title;
66
67             leaf title {
68                 type string;
69             }
70             leaf lang {
71                 type string;
72             }
73             leaf-list authors {
74                 type string;
75             }
76             leaf pub_year {
77                 type year;
78             }
79             leaf price {
80                 type uint64;
81             }
82         }
83     }
84     }
85 }