9a360f5180b964928308161abbf8ffeab7327dfc
[vpnservice.git] / alivenessmonitor / alivenessmonitor-api / src / main / yang / aliveness-monitor.yang
1 module aliveness-monitor {
2     namespace "urn:opendaylight:vpnservice:alivenessmonitor";
3     prefix alivenessmon;
4
5     import ietf-inet-types {
6         prefix inet;
7         revision-date "2013-07-15";
8     }
9
10     revision "2015-06-29" {
11         description "YANG model describes methods for monitoring endpoints.";
12     }
13
14     typedef ether-types {
15         type enumeration {
16              enum arp;
17              enum lldp;
18          }
19     }
20
21     typedef monitoring-mode {
22         type enumeration {
23             enum one-one;
24         }
25     }
26
27     grouping endpoint {
28         choice endpoint-type {
29             case ip-address {
30                 leaf ip-address { type inet:ip-address; }
31             }
32             case interface {
33                  leaf interface-ip { type inet:ip-address; }
34                  leaf interface-name { type string; }
35             }
36             case host-name {
37                  leaf host-name { type string; }
38             }
39         }
40     }
41
42     grouping monitor-profile-params {
43         leaf monitor-interval { type uint32; } //Monitoring interval in milli-seconds
44         leaf monitor-window { type uint32; } //Number M of consecutive intervals to consider for monitoring
45         leaf failure-threshold { type uint32; } //Number N of missing messages in window to detect failure ("N out of M")
46         leaf protocol-type { type ether-types; }
47     }
48
49     grouping monitor-params {
50         leaf mode { type monitoring-mode; }
51         container source { uses endpoint; }
52         container destination { uses endpoint; }
53         leaf profile-id { type uint32; }
54     }
55
56     // RPC Methods
57     rpc monitor-profile-create {
58         input {
59             container profile {
60                 uses monitor-profile-params;
61             }
62         }
63         output {
64             leaf profile-id { type uint32; }
65         }
66     }
67
68     rpc monitor-profile-get {
69             input {
70                 container profile {
71                     uses monitor-profile-params;
72                 }
73             }
74             output {
75                 leaf profile-id { type uint32; }
76             }
77         }
78
79     rpc monitor-start {
80         input {
81             container config {
82                 uses monitor-params;
83             }
84         }
85         output {
86             leaf monitor-id { type uint32; }
87         }
88     }
89
90     rpc monitor-pause {
91         input {
92             leaf monitor-id { type uint32; }
93         }
94     }
95
96     rpc monitor-unpause {
97         input {
98             leaf monitor-id { type uint32; }
99         }
100     }
101
102
103     rpc monitor-stop {
104         input {
105             leaf monitor-id { type uint32; }
106         }
107     }
108
109     rpc monitor-profile-delete {
110         input {
111             leaf profile-id { type uint32; }
112         }
113     }
114
115     // YANG Notifications
116     typedef liveness-state {
117          type enumeration {
118              enum up;
119              enum down;
120              enum unknown;
121          }
122     }
123
124     grouping liveness-event-state {
125         leaf monitor-id { type uint32; }
126         leaf monitor-state { type liveness-state; }
127     }
128
129     notification monitor-event {
130         container event-data {
131            uses liveness-event-state;
132         }
133     }
134
135     //Operational Model
136     container monitor-profiles {
137         config false;
138         list monitor-profile {
139             key "id";
140             leaf id { type uint32; }
141             uses monitor-profile-params;
142         }
143     }
144
145     container monitor-configs {
146         config false;
147         list monitoring-info {
148             key "id";
149             leaf id { type uint32; }
150             uses monitor-params;
151         }
152     }
153
154     typedef monitor-status {
155          type enumeration {
156              enum started;
157              enum paused;
158              enum stopped;
159          }
160     }
161
162     container monitoring-states {
163         config false;
164         list monitoring-state {
165             key "monitor-key";
166             leaf monitor-key { type string; } //Key to identify monitor-id from packet-in
167             leaf monitor-id { type uint32; }
168             leaf response-pending-count { type uint32; }
169             leaf request-count { type uint32; }
170             leaf state { type liveness-state; }
171             leaf status { type monitor-status; }
172         }
173     }
174
175     container monitorid-key-map {
176         config false;
177         list monitorid-key-entry {
178             key "monitor-id";
179             leaf monitor-id { type uint32; }
180             leaf monitor-key { type string; }
181         }
182     }
183
184     container interface-monitor-map {
185         config false;
186         list interface-monitor-entry {
187             key "interface-name";
188             leaf interface-name { type string; }
189             leaf-list monitor-ids { type uint32; }
190         }
191     }
192 }