import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.treeScoped;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.spi.ExtensionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.GroupingNamespace;
import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace;
import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.ValidationBundleType;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.AnydataStatementImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.ContainerStatementRfc7950Support;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.ModuleStatementRfc7950Support;
public final class YangInferencePipeline {
+ public static final Set<YangVersion> SUPPORTED_VERSIONS =
+ Sets.immutableEnumSet(YangVersion.VERSION_1, YangVersion.VERSION_1_1);
public static final StatementSupportBundle INIT_BUNDLE = StatementSupportBundle
- .builder().addSupport(global(ValidationBundlesNamespace.class))
+ .builder(SUPPORTED_VERSIONS).addSupport(global(ValidationBundlesNamespace.class))
.addSupport(global(SupportedFeaturesNamespace.class))
.build();
public static final StatementSupportBundle PRE_LINKAGE_BUNDLE = StatementSupportBundle
.derivedFrom(INIT_BUNDLE)
- .addSupport(new ModuleStatementSupport())
+ .addVersionSpecificSupport(YangVersion.VERSION_1, new ModuleStatementSupport())
+ .addVersionSpecificSupport(YangVersion.VERSION_1_1, new ModuleStatementRfc7950Support())
.addSupport(new SubmoduleStatementImpl.Definition())
.addSupport(new NamespaceStatementImpl.Definition())
.addSupport(new ImportStatementDefinition())
.addSupport(new LengthStatementImpl.Definition())
.addSupport(new PatternStatementImpl.Definition())
.addSupport(new RangeStatementImpl.Definition())
- .addSupport(new ContainerStatementImpl.Definition())
+ .addVersionSpecificSupport(YangVersion.VERSION_1, new ContainerStatementImpl.Definition())
+ .addVersionSpecificSupport(YangVersion.VERSION_1_1, new ContainerStatementRfc7950Support())
.addSupport(new GroupingStatementImpl.Definition())
.addSupport(new ListStatementImpl.Definition())
.addSupport(new UniqueStatementImpl.Definition())
.addSupport(new MustStatementImpl.Definition())
.addSupport(new MandatoryStatementImpl.Definition())
.addSupport(new AnyxmlStatementImpl.Definition())
+ .addVersionSpecificSupport(YangVersion.VERSION_1_1, new AnydataStatementImpl.Definition())
.addSupport(new IfFeatureStatementImpl.Definition())
.addSupport(new UsesStatementImpl.Definition())
.addSupport(treeScoped(GroupingNamespace.class)) //treeScoped