2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.api;
11 import java.util.Date;
12 import java.util.List;
13 import java.util.Optional;
15 import javax.annotation.Nonnull;
16 import javax.annotation.Nullable;
17 import javax.annotation.concurrent.Immutable;
18 import org.opendaylight.yangtools.concepts.SemVer;
19 import org.opendaylight.yangtools.yang.common.QNameModule;
20 import org.opendaylight.yangtools.yang.common.YangVersion;
23 * This interface contains the methods for getting the data from the YANG
26 * <i>Example of YANG module</i> <code><br>
27 * {@link #getName() <b><font color="#FF0000">module</font></b>} module_name{<br>
28 {@link #getYangVersion() <b><font color="#8b4513">yang-version</font></b>} "1";<br><br>
30 {@link #getNamespace() <b><font color="#00FF00">namespace</font></b>} "urn:module:namespace";<br>
31 {@link #getPrefix() <b><font color="#0000FF">prefix</font></b><a name="prefix"></a>} "prefix";<br><br>
33 {@link #getDescription() <b><font color="#b8860b">description</font></b>} "description test";<br>
34 {@link #getReference() <b><font color="#008b8b">reference</font></b>} "reference test";<br><br>
36 {@link #getOrganization() <b><font color="#606060">organization</font></b>}
37 "John Doe, john.doe@email.com";<br>
38 {@link #getContact() <b><font color="#FF9900">contact</font></b>} "http://www.opendaylight.org/";<br>
41 {@link #getFeatures() <b><font color="#8b0000">feature</font></b>} feature-test{<br>
42 description "description of some feature";<br>
45 {@link #getNotifications() <b><font color="#b22222">notification</font></b>} notification-test;<br>
46 {@link #getRpcs() <b><font color="#d2691e">rpc</font></b>} rpc-test;<br>
47 <!-- {@link #getDeviations() <b><font color="#b8860b">deviation</font></b>} deviation-test;<br> -->
48 {@link #getIdentities() <b><font color="#bdb76b">identity</font></b>} identity-test;<br>
49 {@link #getExtensionSchemaNodes() <b><font color="#808000">extension</font></b>} extension-test;<br>
52 {@link #getRevision() <b><font color="#339900">revision</font></b>} 2011-08-27 {<br>
54 {@link #getImports() <b><font color="#9400d3">import</font></b>} other_module {<br>
55 prefix "other_module_prefix"<br>
56 revision-date 2011-08-27<br>
59 container cont {<br>
62 {@link #getAugmentations() <b><font color="#dc143c">augment</font></b>} "/cont" { ;<br>
69 public interface Module extends DataNodeContainer, NotificationNodeContainer {
71 * Returns the name of the module which is specified as argument of YANG
72 * {@link Module <b><font color="#FF0000">module</font></b>} keyword.
74 * @return string with the name of the module
79 * Returns a {@link QNameModule}, which contains the namespace and
80 * the revision of the module.
82 * @return QNameModule identifier.
84 QNameModule getQNameModule();
87 * Returns the namespace of the module which is specified as argument of
88 * YANG {@link Module <b><font color="#00FF00">namespace</font></b>}
89 * keyword. If you need both namespace and revision, please consider using
90 * {@link #getQNameModule()}.
92 * @return URI format of the namespace of the module
94 default URI getNamespace() {
95 return getQNameModule().getNamespace();
99 * Returns the revision date for the module. If you need both namespace and
100 * revision, please consider using {@link #getQNameModule()}.
102 * @return date of the module revision which is specified as argument of
103 * YANG {@link Module <b><font color="#339900">revison</font></b>}
106 // FIXME: BUG-4688: should return Optional<Revision>
107 @Nullable default Date getRevision() {
108 return getQNameModule().getRevision();
112 * Returns the semantic version of yang module.
115 * If the semantic version is not specified, default semantic version of
116 * module is returned.
118 * @return SemVer semantic version of yang module which is specified as
120 * (urn:opendaylight:yang:extension:semantic-version?revision
121 * =2016-02-02)semantic-version statement
123 Optional<SemVer> getSemanticVersion();
126 * Returns the prefix of the module.
128 * @return string with the module prefix which is specified as argument of
129 * YANG {@link Module <b><font color="#0000FF">prefix</font></b>}
135 * Returns the YANG version.
137 * @return YANG version of this module.
139 YangVersion getYangVersion();
142 * Returns the module description.
144 * @return string with the module description which is specified as argument
145 * of YANG {@link Module <b><font
146 * color="#b8860b">description</font></b>} keyword
148 String getDescription();
151 * Returns the module reference.
153 * @return string with the module reference which is specified as argument
154 * of YANG {@link Module <b><font
155 * color="#008b8b">reference</font></b>} keyword
157 String getReference();
160 * Returns the module organization.
162 * @return string with the name of the organization specified in the module
163 * as the argument of YANG {@link Module <b><font
164 * color="#606060">organization</font></b>} keyword
166 String getOrganization();
169 * Returns the module contact.
172 * The contact represents the person or persons to whom technical queries
173 * concerning this module should be sent, such as their name, postal
174 * address, telephone number, and electronic mail address.
176 * @return string with the contact data specified in the module as the
177 * argument of YANG {@link Module <b><font
178 * color="#FF9900">contact</font></b>} keyword
183 * Returns imports which represents YANG modules which are imported to this
184 * module via <b>import</b> statement.
186 * @return set of module imports which are specified in the module as the
187 * argument of YANG {@link Module <b><font
188 * color="#9400d3">import</font></b>} keywords.
190 Set<ModuleImport> getImports();
192 Set<Module> getSubmodules();
195 * Returns <code>FeatureDefinition</code> instances which contain data from
196 * <b>feature</b> statements defined in the module.
199 * The feature is used to define a mechanism by which portions of the schema
200 * are marked as conditional.
202 * @return feature statements in lexicographical order which are specified
203 * in the module as the argument of YANG {@link Module <b><font
204 * color="#8b0000">feature</font></b>} keywords.
206 Set<FeatureDefinition> getFeatures();
209 * Returns <code>AugmentationSchema</code> instances which contain data from
210 * <b>augment</b> statements defined in the module.
212 * @return set of the augmentation schema instances which are specified in
213 * the module as YANG {@link Module <b><font
214 * color="#dc143c">augment</font></b>} keyword and are
215 * lexicographically ordered
217 Set<AugmentationSchema> getAugmentations();
220 * Returns <code>RpcDefinition</code> instances which contain data from
221 * <b>rpc</b> statements defined in the module.
223 * @return set of the rpc definition instances which are specified in the
224 * module as YANG {@link Module <b><font
225 * color="#d2691e">rpc</font></b>} keywords and are lexicographicaly
228 Set<RpcDefinition> getRpcs();
231 * Returns <code>Deviation</code> instances which contain data from
232 * <b>deviation</b> statements defined in the module.
234 * @return set of the deviation instances
236 Set<Deviation> getDeviations();
239 * Returns <code>IdentitySchemaNode</code> instances which contain data from
240 * <b>identity</b> statements defined in the module.
242 * @return set of identity schema node instances which are specified in the
243 * module as YANG {@link Module <b><font
244 * color="#bdb76b">identity</font></b>} keywords and are
245 * lexicographically ordered
247 Set<IdentitySchemaNode> getIdentities();
250 * Returns <code>ExtensionDefinition</code> instances which contain data
251 * from <b>extension</b> statements defined in the module.
253 * @return set of extension definition instances which are specified in the
254 * module as YANG {@link Module <b><font
255 * color="#808000">extension</font></b>} keyword and are
256 * lexicographically ordered
258 List<ExtensionDefinition> getExtensionSchemaNodes();
261 * Returns unknown nodes defined in module.
263 * @return unknown nodes in lexicographical order
266 List<UnknownSchemaNode> getUnknownSchemaNodes();