VinodKumarS-Huawei | af9c7a7 | 2016-08-30 19:43:39 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
VinodKumarS-Huawei | af9c7a7 | 2016-08-30 19:43:39 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yms.ynh; |
| 18 | |
| 19 | import org.onosproject.yms.ydt.YdtContext; |
| 20 | |
| 21 | /** |
| 22 | * Represents YANG notification which is a subject of YANG based event. |
| 23 | * |
| 24 | * YMS add themselves as a listener to applications. Application sends |
| 25 | * their notification in YANG utils generated notification. YMS obtains |
| 26 | * the module/sub-module schema tree in which this notification is contained |
| 27 | * and then convert this data to an abstract tree notation (YDT) with root |
| 28 | * node as the logical node with name "yangnotification" it contains |
| 29 | * module/sub-module node in which notification is contained. |
| 30 | * It sends the same to all the protocol who has added them as a listener |
| 31 | * as a YANG notification. |
| 32 | * |
| 33 | * This class represents YANG notification which contains the |
| 34 | * notification context in abstract tree notation. |
| 35 | */ |
| 36 | public class YangNotification { |
| 37 | |
| 38 | /** |
| 39 | * YANG notification in form of abstract tree notation (YDT) |
| 40 | * Root node of notification root context will be logical node with |
| 41 | * name as "yangnotification", it contains module/sub-module node |
| 42 | * in which notification is contained. |
| 43 | */ |
| 44 | YdtContext notificationRootContext; |
| 45 | |
| 46 | /** |
| 47 | * Creates an instance of YANG notification subject. |
| 48 | * |
| 49 | * @param notificationContext logical root node with name as |
| 50 | * "yangnotification" |
| 51 | */ |
| 52 | public YangNotification(YdtContext notificationContext) { |
| 53 | this.notificationRootContext = notificationContext; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Assign the YANG modeled notification data. |
| 58 | * |
| 59 | * @param notificationRootContext YANG data tree containing the data for |
| 60 | * the notification |
| 61 | */ |
| 62 | public void setNotificationRootContext(YdtContext notificationRootContext) { |
| 63 | this.notificationRootContext = notificationRootContext; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Returns YANG notification data. |
| 68 | * |
| 69 | * @return YANG data tree containing the data for the notification |
| 70 | */ |
| 71 | public YdtContext getNotificationRootContext() { |
| 72 | return notificationRootContext; |
| 73 | } |
| 74 | } |