Adding IdManager/LockManager and related Changes
[vpnservice.git] / lockmanager / lockmanager-api / src / main / yang / lock-manager.yang
1 module lock-manager {
2     namespace "urn:opendaylight:vpnservice:lockmanager";
3     prefix lockmgr;
4
5     revision "2015-08-19" {
6         description "YANG model describes methods that ensure locking while accessing the datastore";
7     }
8
9     typedef time-units {
10       type enumeration {
11         enum days;
12         enum hours;
13         enum microseconds;
14         enum milliseconds;
15         enum minutes;
16         enum nanoseconds;
17         enum seconds;
18       }
19     }
20
21     container locks {
22       description "Holds the list of lock name and lock owner";
23       list lock {
24         key "lock-name";
25         leaf lock-name {
26             type string;
27             mandatory true;
28         }
29         leaf lock-owner {
30             type string;
31             mandatory true;
32         }
33       }
34     }
35
36     rpc lock {
37         description "Method that checks if its locked already. If not adds the lock to the list of locks. Else tries until it acquires the lock";
38         input {
39              leaf lock-name {
40                 type string;
41                 mandatory true;
42              }
43         }
44     }
45
46     rpc try-lock {
47         description "Method that checks if its locked already. If not adds the lock to the list of locks. Else tries for the specified time";
48         input {
49              leaf lock-name {
50                 type string;
51                 mandatory true;
52              }
53              leaf time {
54                 type uint32;
55              }
56              leaf time-unit {
57                 type time-units;
58              }
59         }
60     }
61
62     rpc unlock {
63         description "Method that removes the lock from the list of locks";
64         input {
65              leaf lock-name {
66                 type string;
67                 mandatory true;
68              }
69         }
70     }
71 }