blob: 8d8152b1a1f153a212e7245fbdc2a38bc3dfa1c8 [file] [log] [blame]
Gaurav Agrawalb102b012016-08-02 12:52:48 +05301/*
2 * Copyright 2016-present Open Networking Laboratory
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
17package org.onosproject.yms.ydt;
18
19import 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 */
27public 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 /**
44 * Returns the YDT node extended context information corresponding to YDT
45 * node.
46 *
47 * @param <T> specifies YMS operation specific extended information
48 * associated with YDT context. It will be
49 * YdtContextOperationType in case extended information type
50 * is EDIT_REQUEST and will be YdtContextResponseInfo in case
51 * extended information type is RESPONSE.
52 * @return YdtContextOperationType YDT node operation type
53 */
54 <T> T getYdtContextExtendedInfo();
55
56 /**
57 * Returns YANG data tree extended information type. This is used to
58 * identify the type of extended information applicable for YDT node.
59 *
60 * @return type of extended information
61 */
62 YdtExtendedInfoType getYdtExtendedInfoType();
63
64 /**
65 * Returns the type of YDT entity. This type will be used by protocols to
66 * identify the nature of node and can implement it accordingly.
67 *
68 * @return YDT entity type
69 */
70 YdtType getYdtType();
71
72 /**
73 * Returns the context of parent node.
74 *
75 * @return context of parent node
76 */
77 YdtContext getParent();
78
79 /**
80 * Returns the context of first child.
81 *
82 * @return context of first child
83 */
84 YdtContext getFirstChild();
85
86 /**
87 * Returns the context of last child.
88 *
89 * @return context of last child
90 */
91 YdtContext getLastChild();
92
93 /**
94 * Returns the context of next sibling.
95 *
96 * @return context of next sibling
97 */
98 YdtContext getNextSibling();
99
100 /**
101 * Returns the context of previous sibling.
102 *
103 * @return context of previous sibling
104 */
105 YdtContext getPreviousSibling();
106
107 /**
108 * Returns value of node, this is only valid for single instance leaf
109 * node, to obtain the nature of the node protocols need to use
110 * getYdtType().
111 *
112 * @return value of node
113 */
114 String getValue();
115
116 /**
117 * Returns set of values of a node, this is only valid for multi instance
118 * leaf node, to obtain the nature of the node protocols need to use
119 * getYdtType().
120 *
121 * @return value of YDT leaf
122 */
123 Set<String> getValueSet();
124}