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