sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +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.app.ydt; |
| 18 | |
| 19 | import org.onosproject.yangutils.datamodel.YangSchemaNode; |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 20 | import org.onosproject.yms.ydt.YdtContext; |
| 21 | import org.onosproject.yms.ydt.YdtContextOperationType; |
| 22 | |
| 23 | import java.util.List; |
| 24 | |
| 25 | /** |
| 26 | * Abstraction of an entity which represents YANG application data tree context |
| 27 | * information. This context information will be used by protocol to obtain |
| 28 | * the information associated with YDT application node. This is used when |
| 29 | * protocol is walking the application data tree in both visitor and listener |
| 30 | * mechanism. |
| 31 | */ |
| 32 | public interface YdtAppContext { |
| 33 | |
| 34 | /** |
| 35 | * Returns the context of parent node. |
| 36 | * |
| 37 | * @return context of parent node |
| 38 | */ |
| 39 | YdtAppContext getParent(); |
| 40 | |
| 41 | /** |
| 42 | * Sets the context of parent node. |
| 43 | * |
| 44 | * @param parent node |
| 45 | */ |
| 46 | void setParent(YdtAppContext parent); |
| 47 | |
| 48 | /** |
| 49 | * Returns the context of first child. |
| 50 | * |
| 51 | * @return context of first child |
| 52 | */ |
| 53 | YdtAppContext getFirstChild(); |
| 54 | |
| 55 | /** |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 56 | * Returns the context of last child. |
| 57 | * |
| 58 | * @return context of last child |
| 59 | */ |
| 60 | YdtAppContext getLastChild(); |
| 61 | |
| 62 | /** |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 63 | * Returns the context of next sibling. |
| 64 | * |
| 65 | * @return context of next sibling |
| 66 | */ |
| 67 | YdtAppContext getNextSibling(); |
| 68 | |
| 69 | /** |
| 70 | * Sets the context of next sibling. |
| 71 | * |
| 72 | * @param nextSibling node |
| 73 | */ |
| 74 | void setNextSibling(YdtAppContext nextSibling); |
| 75 | |
| 76 | /** |
| 77 | * Returns the context of previous sibling. |
| 78 | * |
| 79 | * @return context of previous sibling |
| 80 | */ |
| 81 | YdtAppContext getPreviousSibling(); |
| 82 | |
| 83 | /** |
| 84 | * Sets the context of previous sibling. |
| 85 | * |
| 86 | * @param preSibling node |
| 87 | */ |
| 88 | void setPreviousSibling(YdtAppContext preSibling); |
| 89 | |
| 90 | /** |
| 91 | * Returns the app tree operation type. |
| 92 | * |
| 93 | * @return app tree operation type |
| 94 | */ |
| 95 | YdtAppNodeOperationType getOperationType(); |
| 96 | |
| 97 | /** |
| 98 | * Set the app tree operation type. |
| 99 | * |
| 100 | * @param opType app tree operation type |
| 101 | */ |
| 102 | void setOperationType(YdtAppNodeOperationType opType); |
| 103 | |
| 104 | /** |
| 105 | * Returns the list of nodes with operation type delete. |
| 106 | * |
| 107 | * @return list of nodes with operation type delete |
| 108 | */ |
| 109 | List<YdtContext> getDeleteNodes(); |
| 110 | |
| 111 | /** |
| 112 | * Adds the ydt node with operation type delete in module delete node list. |
| 113 | * |
| 114 | * @param node ydt node with operation type delete/remove |
| 115 | */ |
| 116 | void addDeleteNode(YdtNode node); |
| 117 | |
| 118 | /** |
| 119 | * Returns application's root ydtContext. |
| 120 | * |
| 121 | * @return YdtContext of application root node |
| 122 | */ |
| 123 | YdtContext getModuleContext(); |
| 124 | |
| 125 | /** |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 126 | * Returns the YangSchemaNode of augmenting application. |
| 127 | * |
| 128 | * @return YangSchemaNode of augmenting application |
| 129 | */ |
| 130 | YangSchemaNode getAugmentingSchemaNode(); |
| 131 | |
| 132 | /** |
| 133 | * Sets the YangSchemaNode of augmenting application root node. |
| 134 | * |
| 135 | * @param schemaNode YangSchemaNode of augmenting application module |
| 136 | */ |
| 137 | void setAugmentingSchemaNode(YangSchemaNode schemaNode); |
| 138 | |
| 139 | /** |
| 140 | * Adds a last child to ydt application data tree. |
| 141 | * |
| 142 | * @param newChild name of child to be added |
| 143 | */ |
| 144 | void addChild(YdtAppContext newChild); |
| 145 | |
| 146 | /** |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 147 | * Updates the app tree operation type. |
| 148 | * <p> |
| 149 | * If earlier operation type was OTHER_EDIT and now operation type came as |
| 150 | * DELETE_ONLY or vice-versa, then update operation type to BOTH. |
| 151 | * |
| 152 | * @param opType ydt current context operation type |
| 153 | */ |
| 154 | void updateAppOperationType(YdtContextOperationType opType); |
| 155 | |
| 156 | /** |
| 157 | * Sets the application data for given request. If in requested parameters |
| 158 | * schemaNode is not null then appData will be set with |
| 159 | * augmentedSchemaData else with moduleSchemaData object. |
| 160 | * |
| 161 | * @param moduleNode module node of requested app |
| 162 | * @param schemaNode augmented schema node of requested context |
| 163 | */ |
| 164 | void setAppData(YdtNode moduleNode, YangSchemaNode schemaNode); |
| 165 | |
| 166 | /** |
| 167 | * Returns the app data for current context. |
| 168 | * |
| 169 | * @return app data |
| 170 | */ |
| 171 | AppData getAppData(); |
| 172 | |
| 173 | /** |
| 174 | * Returns the yang schema for requested node. |
| 175 | * |
| 176 | * @return schema node |
| 177 | */ |
| 178 | YangSchemaNode getYangSchemaNode(); |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 179 | } |