c56243b3fa9e7067ea934d6bcf37a6d4dd94b21f
[controller.git] / opendaylight / md-sal / messagebus-api / src / main / yang / event-source.yang
1 module event-source {
2     yang-version 1;
3     namespace "urn:cisco:params:xml:ns:yang:messagebus:eventsource";
4     prefix "eventsource";
5
6     import event-aggregator { prefix aggr; }
7     import network-topology { prefix nt; revision-date "2013-10-21"; }
8     import opendaylight-inventory {prefix inv; revision-date "2013-08-19"; }
9     import yang-ext {prefix ext; revision-date "2013-07-09"; }
10
11     organization "Cisco Systems, Inc.";
12     contact "Robert Gallas";
13
14     description
15         "Base model for a topology where individual nodes can produce events.
16
17         Module implementing event source topology and encapped notification.
18
19         Copyright (c)2014 Cisco Systems, Inc. All rights reserved.
20
21         This program and the accompanying materials are made available
22         under the terms of the Eclipse Public License v1.0 which
23         accompanies this distribution, and is available at
24         http://www.eclipse.org/legal/epl-v10.html";
25
26     revision "2014-12-02" {
27         description "first revision";
28     }
29
30     // FIXME: expand this
31     typedef join-topic-status {
32         type enumeration {
33             enum up;
34             enum down;
35         }
36         description "Object status";
37     }
38
39     // FIXME: migrate to topology
40     typedef node-ref {
41         type leafref {
42             path "/inv:nodes/inv:node/inv:id";
43         }
44     }
45
46     typedef event-source-status {
47         type enumeration {
48             enum active;
49             enum inactive;
50             enum deactive;
51         }
52         description "Status of event source
53                        - active: event source is publishing notification,
54                        - inactive: event source stopped publishing of notifications temporarily
55                        - deactive: event source stopped publishing of notifications permanently" ;
56     }
57
58     grouping topology-event-source-type {
59         container topology-event-source {
60             presence "indicates an event source-aware topology";
61         }
62     }
63
64     rpc join-topic {
65         input {
66             leaf node {
67                ext:context-reference "inv:node-context";
68                type "instance-identifier";
69             }
70             leaf topic-id {
71                 type aggr:topic-id;
72                 description "in current implementation notification-pattern is defined by topic-id.
73                              By persisting topic definition we could omit notification-pattern";
74             }
75             leaf notification-pattern {
76                 type aggr:notification-pattern;
77             }
78         }
79
80         output {
81             leaf status {
82                 type join-topic-status;
83             }
84         }
85     }
86
87     notification event-source-status-notification {
88
89         description
90             "Notification of change event source status.";
91
92         leaf status {
93             type event-source-status;
94             mandatory true;
95             description "Current status of event source.";
96         }
97
98     }
99
100     augment "/nt:network-topology/nt:topology/nt:topology-types" {
101         uses topology-event-source-type;
102     }
103
104     augment "/nt:network-topology/nt:topology/nt:node" {
105         when "../../nt:topology-types/topology-event-source";
106         leaf event-source-node {
107             type node-ref;
108         }
109     }
110 }