Gaurav Agrawal | b102b01 | 2016-08-02 12:52:48 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
Gaurav Agrawal | b102b01 | 2016-08-02 12:52:48 +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.ydt; |
| 18 | |
| 19 | import java.util.Set; |
| 20 | |
| 21 | /** |
| 22 | * Abstraction of an entity which represents YANG data tree context |
| 23 | * information. This context information will be used protocol to obtain |
| 24 | * the information associated with YDT node. This is used when protocol is |
| 25 | * walking the data tree in both visitor and listener mechanism. |
| 26 | */ |
| 27 | public interface YdtContext { |
| 28 | |
| 29 | /** |
| 30 | * Returns the node name. |
| 31 | * |
| 32 | * @return node name |
| 33 | */ |
| 34 | String getName(); |
| 35 | |
| 36 | /** |
| 37 | * Returns the node namespace. |
| 38 | * |
| 39 | * @return node namespace |
| 40 | */ |
| 41 | String getNamespace(); |
| 42 | |
| 43 | /** |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 44 | * Returns module name as namespace. |
| 45 | * |
| 46 | * @return module name |
| 47 | */ |
| 48 | String getModuleNameAsNameSpace(); |
| 49 | |
| 50 | /** |
Gaurav Agrawal | b102b01 | 2016-08-02 12:52:48 +0530 | [diff] [blame] | 51 | * Returns the YDT node extended context information corresponding to YDT |
| 52 | * node. |
| 53 | * |
| 54 | * @param <T> specifies YMS operation specific extended information |
| 55 | * associated with YDT context. It will be |
| 56 | * YdtContextOperationType in case extended information type |
| 57 | * is EDIT_REQUEST and will be YdtContextResponseInfo in case |
| 58 | * extended information type is RESPONSE. |
| 59 | * @return YdtContextOperationType YDT node operation type |
| 60 | */ |
| 61 | <T> T getYdtContextExtendedInfo(); |
| 62 | |
| 63 | /** |
| 64 | * Returns YANG data tree extended information type. This is used to |
| 65 | * identify the type of extended information applicable for YDT node. |
| 66 | * |
| 67 | * @return type of extended information |
| 68 | */ |
| 69 | YdtExtendedInfoType getYdtExtendedInfoType(); |
| 70 | |
| 71 | /** |
| 72 | * Returns the type of YDT entity. This type will be used by protocols to |
| 73 | * identify the nature of node and can implement it accordingly. |
| 74 | * |
| 75 | * @return YDT entity type |
| 76 | */ |
| 77 | YdtType getYdtType(); |
| 78 | |
| 79 | /** |
| 80 | * Returns the context of parent node. |
| 81 | * |
| 82 | * @return context of parent node |
| 83 | */ |
| 84 | YdtContext getParent(); |
| 85 | |
| 86 | /** |
| 87 | * Returns the context of first child. |
| 88 | * |
| 89 | * @return context of first child |
| 90 | */ |
| 91 | YdtContext getFirstChild(); |
| 92 | |
| 93 | /** |
| 94 | * Returns the context of last child. |
| 95 | * |
| 96 | * @return context of last child |
| 97 | */ |
| 98 | YdtContext getLastChild(); |
| 99 | |
| 100 | /** |
| 101 | * Returns the context of next sibling. |
| 102 | * |
| 103 | * @return context of next sibling |
| 104 | */ |
| 105 | YdtContext getNextSibling(); |
| 106 | |
| 107 | /** |
| 108 | * Returns the context of previous sibling. |
| 109 | * |
| 110 | * @return context of previous sibling |
| 111 | */ |
| 112 | YdtContext getPreviousSibling(); |
| 113 | |
| 114 | /** |
| 115 | * Returns value of node, this is only valid for single instance leaf |
| 116 | * node, to obtain the nature of the node protocols need to use |
| 117 | * getYdtType(). |
| 118 | * |
| 119 | * @return value of node |
| 120 | */ |
| 121 | String getValue(); |
| 122 | |
| 123 | /** |
| 124 | * Returns set of values of a node, this is only valid for multi instance |
| 125 | * leaf node, to obtain the nature of the node protocols need to use |
| 126 | * getYdtType(). |
| 127 | * |
| 128 | * @return value of YDT leaf |
| 129 | */ |
| 130 | Set<String> getValueSet(); |
| 131 | } |