Merge " changes for REST API to make TZ specific parameters (transport zone name...
[genius.git] / alivenessmonitor / alivenessmonitor-api / src / main / yang / aliveness-monitor.yang
1 module aliveness-monitor {
2     namespace "urn:opendaylight:genius:alivenessmonitor";
3     prefix alivenessmon;
4
5     import ietf-inet-types {
6         prefix inet;
7         revision-date "2013-07-15";
8     }
9
10     import ietf-yang-types {
11         prefix yang;
12         revision-date "2013-07-15";
13     }
14
15     revision "2016-04-11" {
16         description "YANG model describes methods for monitoring endpoints.";
17     }
18
19 typedef ether-types {
20         type enumeration {
21              enum arp;
22              enum lldp;
23              enum bfd;
24          }
25     }
26
27     typedef monitoring-mode {
28         type enumeration {
29             enum one-one;
30         }
31     }
32
33     grouping endpoint {
34         choice endpoint-type {
35             case ip-address {
36                 leaf ip-address { type inet:ip-address; }
37             }
38             case interface {
39                  leaf mac-address { type yang:phys-address; }
40                  leaf interface-ip { type inet:ip-address; }
41                  leaf interface-name { type string; }
42             }
43             case host-name {
44                  leaf host-name { type string; }
45             }
46         }
47     }
48
49     grouping monitor-profile-params {
50         leaf monitor-interval { type uint32; } //Monitoring interval in milli-seconds
51         leaf monitor-window { type uint32; } //Number M of consecutive intervals to consider for monitoring
52         leaf failure-threshold { type uint32; } //Number N of missing messages in window to detect failure ("N out of M")
53         leaf protocol-type { type ether-types; }
54         uses bfd-params;
55     }
56
57     grouping bfd-params {
58         leaf min-rx {
59             description "The shortest interval, in milliseconds, at which this BFD session offers to receive BFD control messages. Defaults to 1000";
60             type uint32;
61         }
62         leaf min-tx {
63            description "The shortest interval, in milliseconds, at which this BFD session is willing to transmit BFD control messages. Defaults to 100";
64            type uint32;
65         }
66         leaf decay_min_rx {
67             description "An alternate receive interval, in milliseconds, that must be greater than or equal to bfd:min_rx. This
68                          feature may be disabled by setting a value of 0";
69             type uint32;
70         }
71         leaf forwarding_if_rx {
72             description "either true or false. True  to consider the interface capable of packet I/O as long as it continues to receive any  packets  (not  just  BFD  packets)";
73             type string;
74         }
75         leaf cpath_down {
76             description "Set to true to notify the remote endpoint that traffic should not be forwarded to this system for some reason other than a
77                          connectivity failure on the interface being monitored. Defaults to false";
78             type string;
79         }
80         leaf check_tnl_key {
81             description "either true or false. Set to true to make BFD accept only control messages with a tunnel key of zero.
82                          By default, BFD accepts control messages with any tunnel key.";
83             type string;
84         }
85     }
86
87     grouping monitor-params {
88         leaf mode { type monitoring-mode; }
89         container source { uses endpoint; }
90         container destination { uses endpoint; }
91         leaf profile-id { type uint32; }
92     }
93
94     // RPC Methods
95     rpc monitor-profile-create {
96         input {
97             container profile {
98                 uses monitor-profile-params;
99             }
100         }
101         output {
102             leaf profile-id { type uint32; }
103         }
104     }
105
106     rpc monitor-profile-get {
107             input {
108                 container profile {
109                     uses monitor-profile-params;
110                 }
111             }
112             output {
113                 leaf profile-id { type uint32; }
114             }
115         }
116
117     rpc monitor-start {
118         input {
119             container config {
120                 uses monitor-params;
121             }
122         }
123         output {
124             leaf monitor-id { type uint32; }
125         }
126     }
127
128     rpc monitor-pause {
129         input {
130             leaf monitor-id { type uint32; }
131         }
132     }
133
134     rpc monitor-unpause {
135         input {
136             leaf monitor-id { type uint32; }
137         }
138     }
139
140
141     rpc monitor-stop {
142         input {
143             leaf monitor-id { type uint32; }
144         }
145     }
146
147     rpc monitor-profile-delete {
148         input {
149             leaf profile-id { type uint32; }
150         }
151     }
152
153     // YANG Notifications
154     typedef liveness-state {
155          type enumeration {
156              enum up;
157              enum down;
158              enum unknown;
159          }
160     }
161
162     grouping liveness-event-state {
163         leaf monitor-id { type uint32; }
164         leaf monitor-state { type liveness-state; }
165     }
166
167     notification monitor-event {
168         container event-data {
169            uses liveness-event-state;
170         }
171     }
172
173     //Operational Model
174     container monitor-profiles {
175         config false;
176         list monitor-profile {
177             key "id";
178             leaf id { type uint32; }
179             uses monitor-profile-params;
180         }
181     }
182
183     container monitor-configs {
184         config false;
185         list monitoring-info {
186             key "id";
187             leaf id { type uint32; }
188             uses monitor-params;
189         }
190     }
191
192     typedef monitor-status {
193          type enumeration {
194              enum started;
195              enum paused;
196              enum stopped;
197          }
198     }
199
200     container monitoring-states {
201         config false;
202         list monitoring-state {
203             key "monitor-key";
204             leaf monitor-key { type string; } //Key to identify monitor-id from packet-in
205             leaf monitor-id { type uint32; }
206             leaf response-pending-count { type uint32; }
207             leaf request-count { type uint32; }
208             leaf state { type liveness-state; }
209             leaf status { type monitor-status; }
210         }
211     }
212
213     container monitorid-key-map {
214         config false;
215         list monitorid-key-entry {
216             key "monitor-id";
217             leaf monitor-id { type uint32; }
218             leaf monitor-key { type string; }
219         }
220     }
221
222     container interface-monitor-map {
223         config false;
224         list interface-monitor-entry {
225             key "interface-name";
226             leaf interface-name { type string; }
227             leaf-list monitor-ids { type uint32; }
228         }
229     }
230 }