2 * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.parser.rfc7950.reactor;
10 import static org.opendaylight.yangtools.yang.common.YangVersion.VERSION_1;
11 import static org.opendaylight.yangtools.yang.common.YangVersion.VERSION_1_1;
13 import com.google.common.annotations.Beta;
14 import com.google.common.collect.ImmutableSet;
15 import com.google.common.collect.Sets;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.opendaylight.yangtools.yang.common.YangVersion;
18 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
19 import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ModuleQNameToPrefix;
20 import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.YangNamespaceContextNamespace;
21 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentImplicitHandlingNamespace;
22 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentStatementRFC6020Support;
23 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentStatementRFC7950Support;
24 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.deviate.DeviateStatementRFC6020Support;
25 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.deviate.DeviateStatementRFC7950Support;
26 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.extension.ExtensionStatementSupport;
27 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.if_feature.IfFeatureStatementRFC6020Support;
28 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.if_feature.IfFeatureStatementRFC7950Support;
29 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.import_.ImportStatementSupport;
30 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.import_.ImportedVersionNamespace;
31 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.list.ConfigListWarningNamespace;
32 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.list.ListStatementSupport;
33 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ActionStatementSupport;
34 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.AnydataStatementSupport;
35 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.AnyxmlStatementSupport;
36 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ArgumentStatementSupport;
37 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.BaseStatementSupport;
38 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.BelongsToStatementSupport;
39 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.BitStatementSupport;
40 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.CaseStatementSupport;
41 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ChoiceStatementSupport;
42 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ConfigStatementSupport;
43 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ContactStatementSupport;
44 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ContainerStatementSupport;
45 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.DefaultStatementSupport;
46 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.DescriptionStatementSupport;
47 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.DeviationStatementSupport;
48 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.EnumStatementSupport;
49 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ErrorAppTagStatementSupport;
50 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ErrorMessageStatementSupport;
51 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.FeatureStatementSupport;
52 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.FractionDigitsStatementSupport;
53 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.GroupingStatementSupport;
54 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.IdentityStatementSupport;
55 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.IncludeStatementSupport;
56 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.InputStatementSupport;
57 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.KeyStatementSupport;
58 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.LeafListStatementSupport;
59 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.LeafStatementSupport;
60 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.LengthStatementSupport;
61 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.MandatoryStatementSupport;
62 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.MaxElementsStatementSupport;
63 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.MinElementsStatementSupport;
64 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ModifierStatementSupport;
65 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.MustStatementSupport;
66 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.NamespaceStatementSupport;
67 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.OrderedByStatementSupport;
68 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.OrganizationStatementSupport;
69 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.OutputStatementSupport;
70 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.PositionStatementSupport;
71 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.PrefixStatementSupport;
72 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.PresenceStatementSupport;
73 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.RangeStatementSupport;
74 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ReferenceStatementSupport;
75 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.RequireInstanceStatementSupport;
76 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.RevisionDateStatementSupport;
77 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.RevisionStatementSupport;
78 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.RpcStatementSupport;
79 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.StatusStatementSupport;
80 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.TypedefStatementSupport;
81 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.UniqueStatementSupport;
82 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.UnitsStatementSupport;
83 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.ValueStatementSupport;
84 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.WhenStatementSupport;
85 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.XPathSupport;
86 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.YangVersionStatementSupport;
87 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.YinElementStatementSupport;
88 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.module.ModuleStatementSupport;
89 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.module.QNameModuleNamespace;
90 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.notification.NotificationStatementRFC6020Support;
91 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.notification.NotificationStatementRFC7950Support;
92 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.path.PathStatementSupport;
93 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.pattern.PatternStatementSupport;
94 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.refine.RefineStatementSupport;
95 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.refine.RefineTargetNamespace;
96 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.submodule.SubmoduleStatementSupport;
97 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.type.BaseTypeNamespace;
98 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.type.TypeStatementRFC6020Support;
99 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.type.TypeStatementRFC7950Support;
100 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.uses.SourceGroupingNamespace;
101 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.uses.UsesStatementSupport;
102 import org.opendaylight.yangtools.yang.parser.spi.NamespaceBehaviours;
103 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
104 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementDefinitions;
105 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
106 import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundles;
107 import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundles.ValidationBundleType;
108 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
109 import org.opendaylight.yangtools.yang.xpath.api.YangXPathParserFactory;
112 * Utility class holding entrypoints for assembling RFC6020/RFC7950 statement {@link CrossSourceStatementReactor}s.
114 * @author Robert Varga
117 public final class RFC7950Reactors {
118 private static final ImmutableSet<YangVersion> SUPPORTED_VERSIONS = Sets.immutableEnumSet(VERSION_1, VERSION_1_1);
120 private static final StatementSupportBundle INIT_BUNDLE = StatementSupportBundle.builder(SUPPORTED_VERSIONS)
121 .addSupport(ValidationBundles.BEHAVIOUR)
122 .addSupport(NamespaceBehaviours.SUPPORTED_FEATURES)
123 .addSupport(NamespaceBehaviours.MODULES_DEVIATED_BY)
126 private RFC7950Reactors() {
130 private static StatementSupportBundle preLinkageBundle(final YangParserConfiguration config) {
131 return StatementSupportBundle.derivedFrom(INIT_BUNDLE)
132 .addVersionSpecificSupport(VERSION_1, ModuleStatementSupport.rfc6020Instance(config))
133 .addVersionSpecificSupport(VERSION_1_1, ModuleStatementSupport.rfc7950Instance(config))
134 .addVersionSpecificSupport(VERSION_1, SubmoduleStatementSupport.rfc6020Instance(config))
135 .addVersionSpecificSupport(VERSION_1_1, SubmoduleStatementSupport.rfc7950Instance(config))
136 .addSupport(new NamespaceStatementSupport(config))
137 .addVersionSpecificSupport(VERSION_1, ImportStatementSupport.rfc6020Instance(config))
138 .addVersionSpecificSupport(VERSION_1_1, ImportStatementSupport.rfc7950Instance(config))
139 .addVersionSpecificSupport(VERSION_1, IncludeStatementSupport.rfc6020Instance(config))
140 .addVersionSpecificSupport(VERSION_1_1, IncludeStatementSupport.rfc7950Instance(config))
141 .addSupport(new BelongsToStatementSupport(config))
142 .addSupport(new PrefixStatementSupport(config))
143 .addSupport(new YangVersionStatementSupport(config))
144 .addSupport(new RevisionStatementSupport(config))
145 .addSupport(new RevisionDateStatementSupport(config))
146 .addSupport(NamespaceBehaviours.MODULE_NAME_TO_NAMESPACE)
147 .addSupport(NamespaceBehaviours.PRELINKAGE_MODULE)
148 .addSupport(NamespaceBehaviours.IMP_PREFIX_TO_NAMESPACE)
149 .addSupport(NamespaceBehaviours.MODULECTX_TO_QNAME)
150 .addSupport(QNameModuleNamespace.BEHAVIOUR)
151 .addSupport(ImportedVersionNamespace.BEHAVIOUR)
155 private static StatementSupportBundle linkageBundle(final StatementSupportBundle preLinkageBundle,
156 final YangParserConfiguration config) {
157 return StatementSupportBundle.derivedFrom(preLinkageBundle)
158 .addSupport(new DescriptionStatementSupport(config))
159 .addSupport(new ReferenceStatementSupport(config))
160 .addSupport(new ContactStatementSupport(config))
161 .addSupport(new OrganizationStatementSupport(config))
162 .addSupport(NamespaceBehaviours.MODULE)
163 .addSupport(NamespaceBehaviours.MODULE_FOR_BELONGSTO)
164 .addSupport(NamespaceBehaviours.SUBMODULE)
165 .addSupport(NamespaceBehaviours.NAMESPACE_TO_MODULE)
166 .addSupport(NamespaceBehaviours.MODULE_NAME_TO_QNAME)
167 .addSupport(NamespaceBehaviours.MODULECTX_TO_SOURCE)
168 .addSupport(NamespaceBehaviours.MODULE_NAMESPACE_TO_NAME)
169 .addSupport(NamespaceBehaviours.PREFIX_TO_MODULE)
170 .addSupport(NamespaceBehaviours.IMPORTED_MODULE)
171 .addSupport(NamespaceBehaviours.INCLUDED_MODULE)
172 .addSupport(NamespaceBehaviours.INCLUDED_SUBMODULE_NAME_TO_MODULECTX)
173 .addSupport(NamespaceBehaviours.IMPORT_PREFIX_TO_MODULECTX)
174 .addSupport(NamespaceBehaviours.BELONGSTO_PREFIX_TO_MODULECTX)
175 .addSupport(ModuleQNameToPrefix.BEHAVIOUR)
176 .addSupport(NamespaceBehaviours.BELONGSTO_PREFIX_TO_MODULE_NAME)
180 private static StatementSupportBundle stmtDefBundle(final StatementSupportBundle linkageBundle,
181 final YangParserConfiguration config) {
182 return StatementSupportBundle.derivedFrom(linkageBundle)
183 .addSupport(new YinElementStatementSupport(config))
184 .addSupport(new ArgumentStatementSupport(config))
185 .addSupport(new ExtensionStatementSupport(config))
186 .addSupport(NamespaceBehaviours.SCHEMA_TREE)
187 .addSupport(NamespaceBehaviours.EXTENSION)
188 .addSupport(new TypedefStatementSupport(config))
189 .addSupport(NamespaceBehaviours.TYPE)
190 .addVersionSpecificSupport(VERSION_1, IdentityStatementSupport.rfc6020Instance(config))
191 .addVersionSpecificSupport(VERSION_1_1, IdentityStatementSupport.rfc7950Instance(config))
192 .addSupport(NamespaceBehaviours.IDENTITY)
193 .addSupport(new DefaultStatementSupport(config))
194 .addSupport(new StatusStatementSupport(config))
195 .addSupport(BaseTypeNamespace.BEHAVIOUR)
196 .addVersionSpecificSupport(VERSION_1, new TypeStatementRFC6020Support(config))
197 .addVersionSpecificSupport(VERSION_1_1, new TypeStatementRFC7950Support(config))
198 .addSupport(new UnitsStatementSupport(config))
199 .addSupport(new RequireInstanceStatementSupport(config))
200 .addVersionSpecificSupport(VERSION_1, BitStatementSupport.rfc6020Instance(config))
201 .addVersionSpecificSupport(VERSION_1_1, BitStatementSupport.rfc7950Instance(config))
202 .addSupport(PathStatementSupport.strictInstance(config))
203 .addVersionSpecificSupport(VERSION_1, EnumStatementSupport.rfc6020Instance(config))
204 .addVersionSpecificSupport(VERSION_1_1, EnumStatementSupport.rfc7950Instance(config))
205 .addSupport(new LengthStatementSupport(config))
206 .addVersionSpecificSupport(VERSION_1, PatternStatementSupport.rfc6020Instance(config))
207 .addVersionSpecificSupport(VERSION_1_1, PatternStatementSupport.rfc7950Instance(config))
208 .addVersionSpecificSupport(VERSION_1_1, new ModifierStatementSupport(config))
209 .addSupport(new RangeStatementSupport(config))
210 .addSupport(new KeyStatementSupport(config))
211 .addVersionSpecificSupport(VERSION_1, ContainerStatementSupport.rfc6020Instance(config))
212 .addVersionSpecificSupport(VERSION_1_1, ContainerStatementSupport.rfc7950Instance(config))
213 .addVersionSpecificSupport(VERSION_1, GroupingStatementSupport.rfc6020Instance(config))
214 .addVersionSpecificSupport(VERSION_1_1, GroupingStatementSupport.rfc7950Instance(config))
215 .addVersionSpecificSupport(VERSION_1, ListStatementSupport.rfc6020Instance(config))
216 .addVersionSpecificSupport(VERSION_1_1, ListStatementSupport.rfc7950Instance(config))
217 .addSupport(ConfigListWarningNamespace.BEHAVIOUR)
218 .addSupport(new UniqueStatementSupport(config))
219 .addVersionSpecificSupport(VERSION_1_1, new ActionStatementSupport(config))
220 .addVersionSpecificSupport(VERSION_1, new RpcStatementSupport(config))
221 .addVersionSpecificSupport(VERSION_1_1, new RpcStatementSupport(config))
222 .addVersionSpecificSupport(VERSION_1, InputStatementSupport.rfc6020Instance(config))
223 .addVersionSpecificSupport(VERSION_1_1, InputStatementSupport.rfc7950Instance(config))
224 .addVersionSpecificSupport(VERSION_1, OutputStatementSupport.rfc6020Instance(config))
225 .addVersionSpecificSupport(VERSION_1_1, OutputStatementSupport.rfc7950Instance(config))
226 .addVersionSpecificSupport(VERSION_1, new NotificationStatementRFC6020Support(config))
227 .addVersionSpecificSupport(VERSION_1_1, new NotificationStatementRFC7950Support(config))
228 .addSupport(new FractionDigitsStatementSupport(config))
229 .addSupport(new BaseStatementSupport(config))
230 .addSupport(StatementDefinitions.BEHAVIOUR)
235 * Returns a pre-built {@link CrossSourceStatementReactor} supporting RFC6020 and RFC7950, along with OpenConfig
236 * semantic version extension. This is useful for parsing near-vanilla YANG models while providing complete
237 * support for semantic versions.
239 * @return A shared reactor instance.
241 public static @NonNull CrossSourceStatementReactor defaultReactor() {
242 return ServiceLoaderState.DefaultReactor.INSTANCE;
246 * Returns a partially-configured {@link CustomCrossSourceStatementReactorBuilder}, with RFC6020/RFC7950
247 * and OpenConfig semantic version support enabled.
249 * @return A new {@link CustomCrossSourceStatementReactorBuilder}.
251 public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder() {
252 return defaultReactorBuilder(YangParserConfiguration.DEFAULT);
255 public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
256 final YangParserConfiguration config) {
257 return vanillaReactorBuilder(config);
260 public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
261 final YangXPathParserFactory xpathFactory) {
262 return defaultReactorBuilder(xpathFactory, YangParserConfiguration.DEFAULT);
265 public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
266 final YangXPathParserFactory xpathFactory, final YangParserConfiguration config) {
267 return vanillaReactorBuilder(xpathFactory, config);
271 * Returns a pre-built {@link CrossSourceStatementReactor} supporting both RFC6020 and RFC7950. This is useful
272 * for parsing vanilla YANG models without any semantic support for extensions. Notably missing is the semantic
273 * version extension, hence attempts to use semantic version mode will cause failures.
275 * @return A shared reactor instance.
277 public static @NonNull CrossSourceStatementReactor vanillaReactor() {
278 return ServiceLoaderState.VanillaReactor.INSTANCE;
282 * Returns a partially-configured {@link CustomCrossSourceStatementReactorBuilder}, with vanilla RFC6020/RFC7950
285 * @return A new {@link CustomCrossSourceStatementReactorBuilder}.
287 public static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder() {
288 return vanillaReactorBuilder(YangParserConfiguration.DEFAULT);
291 public static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder(
292 final YangParserConfiguration config) {
293 return vanillaReactorBuilder(ServiceLoaderState.XPath.INSTANCE, config);
296 public static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder(
297 final @NonNull YangXPathParserFactory xpathFactory) {
298 return vanillaReactorBuilder(xpathFactory, YangParserConfiguration.DEFAULT);
301 public static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder(
302 final @NonNull YangXPathParserFactory xpathFactory, final YangParserConfiguration config) {
303 return vanillaReactorBuilder(new XPathSupport(xpathFactory), config);
306 private static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder(
307 final @NonNull XPathSupport xpathSupport, final YangParserConfiguration config) {
308 final StatementSupportBundle preLinkageBundle = preLinkageBundle(config);
309 final StatementSupportBundle linkageBundle = linkageBundle(preLinkageBundle, config);
310 final StatementSupportBundle stmtDefBundle = stmtDefBundle(linkageBundle, config);
311 final StatementSupportBundle fullDeclarationBundle =
312 fullDeclarationBundle(stmtDefBundle, xpathSupport, config);
314 return new CustomCrossSourceStatementReactorBuilder(SUPPORTED_VERSIONS)
315 .addAllSupports(ModelProcessingPhase.INIT, INIT_BUNDLE)
316 .addAllSupports(ModelProcessingPhase.SOURCE_PRE_LINKAGE, preLinkageBundle)
317 .addAllSupports(ModelProcessingPhase.SOURCE_LINKAGE, linkageBundle)
318 .addAllSupports(ModelProcessingPhase.STATEMENT_DEFINITION, stmtDefBundle)
319 .addAllSupports(ModelProcessingPhase.FULL_DECLARATION, fullDeclarationBundle)
320 .addAllSupports(ModelProcessingPhase.EFFECTIVE_MODEL, fullDeclarationBundle)
321 .addValidationBundle(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
322 YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
323 .addValidationBundle(ValidationBundleType.SUPPORTED_AUGMENT_TARGETS,
324 YangValidationBundles.SUPPORTED_AUGMENT_TARGETS)
326 // FIXME: 7.0.0: we do not seem to need this validation bundle
327 .addValidationBundle(ValidationBundleType.SUPPORTED_CASE_SHORTHANDS,
328 YangValidationBundles.SUPPORTED_CASE_SHORTHANDS)
330 .addValidationBundle(ValidationBundleType.SUPPORTED_DATA_NODES,
331 YangValidationBundles.SUPPORTED_DATA_NODES);
334 private static @NonNull StatementSupportBundle fullDeclarationBundle(final StatementSupportBundle stmtDefBundle,
335 final XPathSupport xpathSupport, final YangParserConfiguration config) {
336 return StatementSupportBundle.derivedFrom(stmtDefBundle)
337 .addSupport(new LeafStatementSupport(config))
338 .addSupport(new ConfigStatementSupport(config))
339 .addSupport(new DeviationStatementSupport(config))
340 .addVersionSpecificSupport(VERSION_1, new DeviateStatementRFC6020Support(config))
341 .addVersionSpecificSupport(VERSION_1_1, new DeviateStatementRFC7950Support(config))
342 .addVersionSpecificSupport(VERSION_1, ChoiceStatementSupport.rfc6020Instance(config))
343 .addVersionSpecificSupport(VERSION_1_1, ChoiceStatementSupport.rfc7950Instance(config))
344 .addVersionSpecificSupport(VERSION_1, CaseStatementSupport.rfc6020Instance(config))
345 .addVersionSpecificSupport(VERSION_1_1, CaseStatementSupport.rfc7950Instance(config))
346 .addSupport(new MustStatementSupport(xpathSupport, config))
347 .addSupport(new MandatoryStatementSupport(config))
348 .addSupport(new AnyxmlStatementSupport(config))
349 .addVersionSpecificSupport(VERSION_1_1, new AnydataStatementSupport(config))
350 .addSupport(NamespaceBehaviours.FEATURE)
351 .addVersionSpecificSupport(VERSION_1, new IfFeatureStatementRFC6020Support(config))
352 .addVersionSpecificSupport(VERSION_1_1, new IfFeatureStatementRFC7950Support(config))
353 .addSupport(NamespaceBehaviours.GROUPING)
354 .addSupport(SourceGroupingNamespace.BEHAVIOUR)
355 .addSupport(new UsesStatementSupport(config))
356 .addSupport(new ErrorMessageStatementSupport(config))
357 .addSupport(new ErrorAppTagStatementSupport(config))
358 .addVersionSpecificSupport(VERSION_1, LeafListStatementSupport.rfc6020Instance(config))
359 .addVersionSpecificSupport(VERSION_1_1, LeafListStatementSupport.rfc7950Instance(config))
360 .addSupport(new PresenceStatementSupport(config))
361 .addSupport(new MaxElementsStatementSupport(config))
362 .addSupport(new MinElementsStatementSupport(config))
363 .addSupport(new OrderedByStatementSupport(config))
364 .addSupport(new WhenStatementSupport(xpathSupport, config))
365 .addSupport(AugmentImplicitHandlingNamespace.BEHAVIOUR)
366 .addVersionSpecificSupport(VERSION_1, new AugmentStatementRFC6020Support(config))
367 .addVersionSpecificSupport(VERSION_1_1, new AugmentStatementRFC7950Support(config))
368 .addSupport(RefineTargetNamespace.BEHAVIOUR)
369 .addVersionSpecificSupport(VERSION_1, RefineStatementSupport.rfc6020Instance(config))
370 .addVersionSpecificSupport(VERSION_1_1, RefineStatementSupport.rfc7950Instance(config))
371 .addSupport(new FeatureStatementSupport(config))
372 .addSupport(new PositionStatementSupport(config))
373 .addSupport(new ValueStatementSupport(config))
374 .addSupport(YangNamespaceContextNamespace.BEHAVIOUR)