BUG:5042 LLDP Tunnel Monitoring should update the interface operational
[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 "2010-09-24";
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-start {
69         input {
70             container config {
71                 uses monitor-params;
72             }
73         }
74         output {
75             leaf monitor-id { type uint32; }
76         }
77     }
78
79     rpc monitor-pause {
80         input {
81             leaf monitor-id { type uint32; }
82         }
83     }
84
85     rpc monitor-unpause {
86         input {
87             leaf monitor-id { type uint32; }
88         }
89     }
90
91
92     rpc monitor-stop {
93         input {
94             leaf monitor-id { type uint32; }
95         }
96     }
97
98     rpc monitor-profile-delete {
99         input {
100             leaf profile-id { type uint32; }
101         }
102     }
103
104     // YANG Notifications
105     typedef liveness-state {
106          type enumeration {
107              enum up;
108              enum down;
109              enum unknown;
110          }
111     }
112
113     grouping liveness-event-state {
114         leaf monitor-id { type uint32; }
115         leaf monitor-state { type liveness-state; }
116     }
117
118     notification monitor-event {
119         container event-data {
120            uses liveness-event-state;
121         }
122     }
123
124     //Operational Model
125     container monitor-profiles {
126         config false;
127         list monitor-profile {
128             key "id";
129             leaf id { type uint32; }
130             uses monitor-profile-params;
131         }
132     }
133
134     container monitor-configs {
135         config false;
136         list monitoring-info {
137             key "id";
138             leaf id { type uint32; }
139             uses monitor-params;
140         }
141     }
142
143     typedef monitor-status {
144          type enumeration {
145              enum started;
146              enum paused;
147              enum stopped;
148          }
149     }
150
151     container monitoring-states {
152         config false;
153         list monitoring-state {
154             key "monitor-key";
155             leaf monitor-key { type string; } //Key to identify monitor-id from packet-in
156             leaf monitor-id { type uint32; }
157             leaf response-pending-count { type uint32; }
158             leaf request-count { type uint32; }
159             leaf state { type liveness-state; }
160             leaf status { type monitor-status; }
161         }
162     }
163
164     container monitorid-key-map {
165         config false;
166         list monitorid-key-entry {
167             key "monitor-id";
168             leaf monitor-id { type uint32; }
169             leaf monitor-key { type string; }
170         }
171     }
172
173     container interface-monitor-map {
174         config false;
175         list interface-monitor-entry {
176             key "interface-name";
177             leaf interface-name { type string; }
178             leaf-list monitor-ids { type uint32; }
179         }
180     }
181 }