Added new semantic version processing mode to yang statement parser.
If the mode is enabled, each module import is processed based on the specified
semantic version and revision date of import statement is ignored.
- fix of SemVer's compareTo method
- fix of Yin statements argument parsing
- added Yang unit tests
- added Yin unit tests
- fix of module imports resolving and module dependency sort
for cases when semantic versioning is enabled
- added StatementParserMode
- unit test fix
Change-Id: Ibf0519c3ec8fec85763e0a13059c1b8af91276ba
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
if (i == 0) {
i = Integer.compare(minor, o.minor);
if (i == 0) {
- return Integer.compare(patch, patch);
+ return Integer.compare(patch, o.patch);
}
}
import java.util.Set;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
+import org.opendaylight.yangtools.concepts.SemVer;
/**
* This interface contains the methods for getting the data from the YANG
*/
@Immutable
public interface Module extends DataNodeContainer, SourceStreamAware, ModuleIdentifier {
+ /**
+ * Default semantic version of Module.
+ */
+ SemVer DEFAULT_SEMANTIC_VERSION = SemVer.create(0, 0, 0);
+
/**
* Returns the prefix of the module
*
import java.net.URI;
import java.util.Date;
-
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QNameModule;
* keyword
*/
Date getRevision();
+
+ /**
+ * Returns the semantic version of yang module.
+ *
+ * If the semantic version is not specified, default semantic version of
+ * module is returned.
+ *
+ * @return SemVer semantic version of yang module which is specified as
+ * argument of
+ * (urn:opendaylight:yang:extension:semantic-version?revision
+ * =2016-02-02)semantic-version statement
+ */
+ default SemVer getSemanticVersion() {
+ return Module.DEFAULT_SEMANTIC_VERSION;
+ }
}
package org.opendaylight.yangtools.yang.model.api;
import java.util.Date;
+import org.opendaylight.yangtools.concepts.SemVer;
/**
* Interface describing YANG 'import' statement.
*/
Date getRevision();
+ /**
+ * @return Semantic version of module to import
+ */
+ default SemVer getSemanticVersion() {
+ return Module.DEFAULT_SEMANTIC_VERSION;
+ }
+
/**
* @return Prefix used to point to imported module
*/
import com.google.common.base.Preconditions;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.YangConstants;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
return effectiveType;
}
+ @Override
public boolean isArgumentYinElement() {
return yinElement;
}
import org.opendaylight.yangtools.yang.common.QName;
/**
- * Definition / model of YANG {@link DeclaredStatement} and {@link EffectiveStatement}.
+ * Definition / model of YANG {@link DeclaredStatement} and
+ * {@link EffectiveStatement}.
*
- * Statement concept is defined in RFC6020 section 6.3:
- * <blockquote> A YANG
+ * Statement concept is defined in RFC6020 section 6.3: <blockquote> A YANG
* module contains a sequence of statements. Each statement starts with a
- * keyword, followed by zero or one argument
- * </blockquote>
+ * keyword, followed by zero or one argument </blockquote>
*
* Source: <a href="https://tools.ietf.org/html/rfc6020#section-6.3"> </a>
*/
* with this definition
*/
@Nonnull
- Class<? extends EffectiveStatement<?,?>> getEffectiveRepresentationClass();
+ Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass();
+
+ /**
+ * Returns true, if argument of statement is represented as value of yin
+ * element. If argument of statement is represented as argument of yin
+ * element, returns false.
+ *
+ *
+ * @return returns true, if statement argument is represented as value of
+ * yin element, otherwise returns false.
+ */
+ boolean isArgumentYinElement();
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.repo.api;
+
+import com.google.common.annotations.Beta;
+
+@Beta
+public enum StatementParserMode {
+ /**
+ * Default mode of statement parser.
+ */
+ DEFAULT_MODE,
+ /**
+ * Semantic version mode of statement parser. If it is enabled, module
+ * imports are processed on the basis of semantic versions.
+ */
+ SEMVER_MODE
+}
\ No newline at end of file
return statementName;
}
+ @Override
public boolean isArgumentYinElement() {
return yinElement;
}
*/
package org.opendaylight.yangtools.yang.model.util;
+import com.google.common.base.Preconditions;
import java.util.Date;
import java.util.Objects;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
public final class ModuleImportImpl implements ModuleImport {
private final String moduleName;
private final Date revision;
+ private final SemVer semVer;
private final String prefix;
public ModuleImportImpl(final String moduleName, final Date revision, final String prefix) {
- this.moduleName = moduleName;
+ this(moduleName, revision, prefix, Module.DEFAULT_SEMANTIC_VERSION);
+ }
+
+ public ModuleImportImpl(final String moduleName, final Date revision, final String prefix, final SemVer semVer) {
+ this.moduleName = Preconditions.checkNotNull(moduleName, "Module name must not be null.");
this.revision = revision;
- this.prefix = prefix;
+ this.prefix = Preconditions.checkNotNull(prefix, "Import prefix must not be null.");
+ this.semVer = Preconditions.checkNotNull(semVer, "Semantic version of module must not be null.");
}
@Override
return revision;
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return semVer;
+ }
+
@Override
public String getPrefix() {
return prefix;
result = prime * result + Objects.hashCode(moduleName);
result = prime * result + Objects.hashCode(revision);
result = prime * result + Objects.hashCode(prefix);
+ result = prime * result + Objects.hashCode(semVer);
return result;
}
if (!Objects.equals(getPrefix(), other.getPrefix())) {
return false;
}
+ if (!Objects.equals(getSemanticVersion(), other.getSemanticVersion())) {
+ return false;
+ }
return true;
}
*/
package org.opendaylight.yangtools.yang.model.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.util.Date;
-
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.yangtools.yang.model.api.ModuleImport;
public class ModuleImportImplTest {
public void setup() {
now = new Date();
module1 = new ModuleImportImpl("myModule", now, "myPrefix");
- module2 = new ModuleImportImpl(null, null, null);
+ module2 = new ModuleImportImpl("foo", null, "prefix-foo");
module3 = new ModuleImportImpl("myModule", null, "customPrefix");
- module4 = new ModuleImportImpl("myModule", now, null);
+ module4 = new ModuleImportImpl("myModule", now, "prefix");
module5 = new ModuleImportImpl("myModule", now, "myPrefix");
hash1 = module1.hashCode();
hash2 = module2.hashCode();
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+
import com.google.common.collect.Sets;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Set;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.model.api.Module;
return module.getName();
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return module.getSemanticVersion();
+ }
+
@Override
public String toString() {
package org.opendaylight.yangtools.yang.parser.builder.impl;
import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.base.Optional;
import java.net.URI;
import java.util.Date;
+import java.util.Objects;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
/**
* Name is only non-null attribute.
* Equality check on namespace and revision is only triggered if they are non-null
*
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
*/
-@Deprecated
+
+// FIXME: This class is used widely by yang statement parser. This class should be moved to one of yang statement
+// parser packages after removal of deprecated pre-beryllium implementation.
public class ModuleIdentifierImpl implements ModuleIdentifier {
private final QNameModule qnameModule;
private final String name;
+ private final SemVer semVer;
public ModuleIdentifierImpl(final String name, final Optional<URI> namespace, final Optional<Date> revision) {
+ this(name, namespace, revision, Module.DEFAULT_SEMANTIC_VERSION);
+ }
+
+ public ModuleIdentifierImpl(final String name, final Optional<URI> namespace, final Optional<Date> revision, final SemVer semVer) {
this.name = checkNotNull(name);
this.qnameModule = QNameModule.create(namespace.orNull(), revision.orNull());
+ this.semVer = (semVer == null ? Module.DEFAULT_SEMANTIC_VERSION : semVer);
}
@Override
return qnameModule.getRevision();
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return semVer;
+ }
+
@Override
public String getName() {
return name;
"name='" + name + '\'' +
", namespace=" + getNamespace() +
", revision=" + qnameModule.getFormattedRevision() +
+ ", semantic version=" + semVer +
'}';
}
return false;
}
- ModuleIdentifier that = (ModuleIdentifier) o;
+ ModuleIdentifier other = (ModuleIdentifier) o;
- if (!name.equals(that.getName())) {
+ if (!name.equals(other.getName())) {
return false;
}
// only fail if this namespace is non-null
- if (getNamespace() != null && !getNamespace().equals(that.getNamespace())) {
+ if (getNamespace() != null && !getNamespace().equals(other.getNamespace())) {
return false;
}
// only fail if this revision is non-null
- if (getRevision() != null && !getRevision().equals(that.getRevision())) {
+ if (getRevision() != null && !getRevision().equals(other.getRevision())) {
+ return false;
+ }
+
+ if (!Objects.equals(getSemanticVersion(), other.getSemanticVersion())) {
return false;
}
package org.opendaylight.yangtools.yang.parser.builder.impl;
import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.net.URI;
import java.util.Set;
import java.util.TreeSet;
import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.Deviation;
public QNameModule getQNameModule() {
return qnameModule;
}
+
+ @Override
+ public SemVer getSemanticVersion() {
+ return DEFAULT_SEMANTIC_VERSION;
+ }
}
/**
*
- * This method is supposed to be called in linkage phase, when YinStatementParserImpl instance has already been
+ * This method is supposed to be called in pre-linkage phase, when YinStatementParserImpl instance has already been
* created.
* When done, start walking through YIN source
*
}
/**
- * This method is supposed to be called in any phase but linkage, when YinStatementParserImpl instance has already
+ * This method is supposed to be called in any phase but pre-linkage, when YinStatementParserImpl instance has already
* been created.
* When done, start walking through YIN source
*
}
}
- private static boolean isStatementWithArgument(final QName identifier, final QNameToStatementDefinition stmtDef) {
- if (stmtDef != null && stmtDef.get(Utils.trimPrefix(identifier)) == null) {
+ private boolean isStatementWithArgument(final QName identifier, final QNameToStatementDefinition stmtDef) {
+ StatementDefinition statementDefinition = getStatementDefinition(identifier, stmtDef);
+ if (statementDefinition == null) {
return false;
- } else if (((StatementSupport<?, ?, ?>) stmtDef.get(Utils.trimPrefix(identifier))).getPublicView().getArgumentName() == null) {
+ } else if (((StatementSupport<?, ?, ?>) statementDefinition).getPublicView().getArgumentName() == null) {
return false;
}
return true;
}
- private static boolean isStatementWithYinElement(final QName identifier, final QNameToStatementDefinition stmtDef) {
- final StatementDefinition statementDefinition = stmtDef.get(Utils.trimPrefix(identifier));
+ private boolean isStatementWithYinElement(final QName identifier, final QNameToStatementDefinition stmtDef) {
+ StatementDefinition statementDefinition = getStatementDefinition(identifier, stmtDef);
if (statementDefinition == null) {
return false;
}
-
- return ((Rfc6020Mapping) ((StatementSupport<?, ?, ?>) statementDefinition).getPublicView()).isArgumentYinElement();
+ return statementDefinition.isArgumentYinElement();
}
- private static String getAttributeValue(final XMLStreamReader inputReader, final QName identifier, final QNameToStatementDefinition
+ private String getAttributeValue(final XMLStreamReader inputReader, final QName identifier, final QNameToStatementDefinition
stmtDef) {
String namespace = null;
- return inputReader.getAttributeValue(namespace, (((StatementSupport<?, ?, ?>) stmtDef.get(Utils.trimPrefix(identifier)))
+ return inputReader.getAttributeValue(namespace, (((StatementSupport<?, ?, ?>) getStatementDefinition(identifier, stmtDef))
.getPublicView()).getArgumentName().getLocalName());
}
+
+ private StatementDefinition getStatementDefinition(final QName identifier, final QNameToStatementDefinition stmtDef) {
+ final QName trimPrefixIdentifier = Utils.trimPrefix(identifier);
+ return stmtDef.getByNamespaceAndLocalName(trimPrefixIdentifier.getNamespace(),
+ trimPrefixIdentifier.getLocalName());
+ }
}
\ No newline at end of file
import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.getArgumentString;
-import org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils;
-
import com.google.common.base.Optional;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
-import java.util.HashSet;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser.StatementContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import java.io.InputStream;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
import org.antlr.v4.runtime.ParserRuleContext;
import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Belongs_to_stmtContext;
import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Import_stmtContext;
import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtContext;
import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtsContext;
import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
+import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser;
+import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser.StatementContext;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
+import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
+import org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
/**
* Helper transfer object which holds basic and dependency information for YANG
private static final class ModuleImportImpl implements ModuleImport {
private final Date revision;
+ private final SemVer semVer;
private final String name;
public ModuleImportImpl(final String moduleName, final Date revision) {
- this.name = moduleName;
+ this(moduleName, revision, Module.DEFAULT_SEMANTIC_VERSION);
+ }
+
+ public ModuleImportImpl(final String moduleName, final Date revision, final SemVer semVer) {
+ this.name = Preconditions.checkNotNull(moduleName, "Module name must not be null.");
this.revision = revision;
+ this.semVer = Preconditions.checkNotNull(semVer, "Semantic version of module must not be null.");
}
@Override
return this.revision;
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return this.semVer;
+ }
+
@Override
public String getPrefix() {
return null;
int result = 1;
result = prime * result + Objects.hashCode(name);
result = prime * result + Objects.hashCode(revision);
+ result = prime * result + Objects.hashCode(semVer);
return result;
}
} else if (!revision.equals(other.revision)) {
return false;
}
+
+ if (!Objects.equals(getSemanticVersion(), other.getSemanticVersion())) {
+ return false;
+ }
return true;
}
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
return null;
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return null;
+ }
+
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
// NOOP for most implementations
}
+ @Override
+ public boolean isArgumentYinElement() {
+ return getPublicView().isArgumentYinElement();
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.spi.meta;
+
+import com.google.common.annotations.Beta;
+import java.util.NavigableMap;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+
+/**
+ * Namespace class for storing Maps of all modules with the same name. This namespace is
+ * used only in case the semantic versioning is enabled, otherwise it is empty.
+ */
+@Beta
+public interface SemanticVersionModuleNamespace extends IdentifierNamespace<String, NavigableMap<SemVer, StmtContext<?, ?, ?>>> {
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.spi.meta;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+
+/**
+ * namespace class for storing semantic version of yang modules
+ */
+@Beta
+public interface SemanticVersionNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, SemVer> {
+}
boolean isConfiguration();
+ boolean isEnabledSemanticVersioning();
+
@Nonnull
<K, V, KT extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(
Class<N> type, KT key) throws NamespaceNotAvailableException;
package org.opendaylight.yangtools.yang.parser.spi.source;
import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
/**
*
- * Source-specific mapping of prefixes to namespaces
+ * Source-specific mapping of prefixes to module identifiers
*
*/
public interface ImpPrefixToModuleIdentifier extends IdentifierNamespace<String, ModuleIdentifier> {
-
-
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.spi.source;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+
+/**
+ *
+ * Source-specific mapping of prefixes to module identifier with specified semantic version
+ */
+@Beta
+public interface ImpPrefixToSemVerModuleIdentifier extends IdentifierNamespace<String, ModuleIdentifier> {
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.spi.source;
+
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+/**
+ *
+ * Global mapping of modules to module identifier
+ *
+ */
+public interface ModuleCtxToModuleIdentifier extends IdentifierNamespace<StmtContext<?,?,?>, ModuleIdentifier> {
+
+}
*/
package org.opendaylight.yangtools.yang.parser.spi.source;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
/**
*
- * Source-specific mapping of prefixes to namespaces
+ * Global mapping of modules to QNameModules
*
*/
public interface ModuleCtxToModuleQName extends IdentifierNamespace<StmtContext<?,?,?>, QNameModule> {
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
import org.opendaylight.yangtools.yang.parser.spi.meta.DerivedNamespaceBehaviour;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
class BuildGlobalContext extends NamespaceStorageSupport implements NamespaceBehaviour.Registry {
private static final Logger LOG = LoggerFactory.getLogger(BuildGlobalContext.class);
- private static final List<ModelProcessingPhase> PHASE_EXECUTION_ORDER = ImmutableList.<ModelProcessingPhase>builder()
- .add(ModelProcessingPhase.SOURCE_PRE_LINKAGE)
- .add(ModelProcessingPhase.SOURCE_LINKAGE)
- .add(ModelProcessingPhase.STATEMENT_DEFINITION)
- .add(ModelProcessingPhase.FULL_DECLARATION)
- .add(ModelProcessingPhase.EFFECTIVE_MODEL)
- .build();
+ private static final List<ModelProcessingPhase> PHASE_EXECUTION_ORDER = ImmutableList
+ .<ModelProcessingPhase> builder().add(ModelProcessingPhase.SOURCE_PRE_LINKAGE)
+ .add(ModelProcessingPhase.SOURCE_LINKAGE).add(ModelProcessingPhase.STATEMENT_DEFINITION)
+ .add(ModelProcessingPhase.FULL_DECLARATION).add(ModelProcessingPhase.EFFECTIVE_MODEL).build();
- private final Map<QName,StatementDefinitionContext<?,?,?>> definitions = new HashMap<>();
- private final Map<Class<?>,NamespaceBehaviourWithListeners<?, ?, ?>> supportedNamespaces = new HashMap<>();
+ private final Map<QName, StatementDefinitionContext<?, ?, ?>> definitions = new HashMap<>();
+ private final Map<Class<?>, NamespaceBehaviourWithListeners<?, ?, ?>> supportedNamespaces = new HashMap<>();
- private final Map<ModelProcessingPhase,StatementSupportBundle> supports;
+ private final Map<ModelProcessingPhase, StatementSupportBundle> supports;
private final Set<SourceSpecificContext> sources = new HashSet<>();
private ModelProcessingPhase currentPhase = ModelProcessingPhase.INIT;
private ModelProcessingPhase finishedPhase = ModelProcessingPhase.INIT;
+ private final boolean enabledSemanticVersions;
+
public BuildGlobalContext(final Map<ModelProcessingPhase, StatementSupportBundle> supports,
- final Predicate<QName> isFeatureSupported) {
+ StatementParserMode statementParserMode, final Predicate<QName> isFeatureSupported) {
super();
this.supports = Preconditions.checkNotNull(supports, "BuildGlobalContext#supports cannot be null");
+ Preconditions.checkNotNull(statementParserMode, "Statement parser mode must not be null.");
+ this.enabledSemanticVersions = statementParserMode == StatementParserMode.SEMVER_MODE;
- addToNs(SupportedFeaturesNamespace.class, SupportedFeatures.SUPPORTED_FEATURES, isFeatureSupported);
+ addToNs(SupportedFeaturesNamespace.class, SupportedFeatures.SUPPORTED_FEATURES,
+ Preconditions.checkNotNull(isFeatureSupported, "Supported feature predicate must not be null."));
}
public BuildGlobalContext(final Map<ModelProcessingPhase, StatementSupportBundle> supports,
- final Map<ValidationBundleType,Collection<?>> supportedValidation,
- final Predicate<QName> isFeatureSupported) {
+ final Map<ValidationBundleType, Collection<?>> supportedValidation,
+ StatementParserMode statementParserMode, final Predicate<QName> isFeatureSupported) {
super();
this.supports = Preconditions.checkNotNull(supports, "BuildGlobalContext#supports cannot be null");
+ Preconditions.checkNotNull(statementParserMode, "Statement parser mode must not be null.");
+ this.enabledSemanticVersions = statementParserMode == StatementParserMode.SEMVER_MODE;
for (Entry<ValidationBundleType, Collection<?>> validationBundle : supportedValidation.entrySet()) {
addToNs(ValidationBundlesNamespace.class, validationBundle.getKey(), validationBundle.getValue());
}
- addToNs(SupportedFeaturesNamespace.class, SupportedFeatures.SUPPORTED_FEATURES, isFeatureSupported);
+ addToNs(SupportedFeaturesNamespace.class, SupportedFeatures.SUPPORTED_FEATURES,
+ Preconditions.checkNotNull(isFeatureSupported, "Supported feature predicate must not be null."));
+ }
+
+ public boolean isEnabledSemanticVersioning() {
+ return enabledSemanticVersions;
}
public StatementSupportBundle getSupportsForPhase(final ModelProcessingPhase currentPhase) {
}
public void addSource(@Nonnull final StatementStreamSource source) {
- sources.add(new SourceSpecificContext(this,source));
+ sources.add(new SourceSpecificContext(this, source));
}
@Override
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getNamespaceBehaviour(final Class<N> type) {
+ public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getNamespaceBehaviour(
+ final Class<N> type) {
NamespaceBehaviourWithListeners<?, ?, ?> potential = supportedNamespaces.get(type);
if (potential == null) {
NamespaceBehaviour<K, V, N> potentialRaw = supports.get(currentPhase).getNamespaceBehaviour(type);
potential = createNamespaceContext(potentialRaw);
supportedNamespaces.put(type, potential);
} else {
- throw new NamespaceNotAvailableException(
- "Namespace " + type + " is not available in phase " + currentPhase);
+ throw new NamespaceNotAvailableException("Namespace " + type + " is not available in phase "
+ + currentPhase);
}
}
Verify.verify(type.equals(potential.getIdentifier()));
/*
- * Safe cast, previous checkState checks equivalence of key from which type argument are
- * derived
+ * Safe cast, previous checkState checks equivalence of key from which
+ * type argument are derived
*/
return (NamespaceBehaviourWithListeners<K, V, N>) potential;
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> createNamespaceContext(
final NamespaceBehaviour<K, V, N> potentialRaw) {
if (potentialRaw instanceof DerivedNamespaceBehaviour) {
- VirtualNamespaceContext derivedContext =
- new VirtualNamespaceContext((DerivedNamespaceBehaviour) potentialRaw);
- getNamespaceBehaviour(((DerivedNamespaceBehaviour) potentialRaw).getDerivedFrom())
- .addDerivedNamespace(derivedContext);
+ VirtualNamespaceContext derivedContext = new VirtualNamespaceContext(
+ (DerivedNamespaceBehaviour) potentialRaw);
+ getNamespaceBehaviour(((DerivedNamespaceBehaviour) potentialRaw).getDerivedFrom()).addDerivedNamespace(
+ derivedContext);
return derivedContext;
}
return new SimpleNamespaceContext<>(potentialRaw);
private EffectiveSchemaContext transformEffective() {
Preconditions.checkState(finishedPhase == ModelProcessingPhase.EFFECTIVE_MODEL);
List<DeclaredStatement<?>> rootStatements = new ArrayList<>(sources.size());
- List<EffectiveStatement<?,?>> rootEffectiveStatements = new ArrayList<>(sources.size());
+ List<EffectiveStatement<?, ?>> rootEffectiveStatements = new ArrayList<>(sources.size());
for (SourceSpecificContext source : sources) {
final RootStatementContext<?, ?, ?> root = source.getRoot();
currentPhase = phase;
}
- private void loadPhaseStatements() throws SourceException {
+ private void loadPhaseStatements() throws SourceException {
Preconditions.checkState(currentPhase != null);
for (SourceSpecificContext source : sources) {
source.loadStatements();
for (SourceSpecificContext failedSource : sourcesToProgress) {
final SourceException sourceEx = failedSource.failModifiers(currentPhase);
- // Workaround for broken logging implementations which ignore suppressed exceptions
+ // Workaround for broken logging implementations which ignore
+ // suppressed exceptions
Throwable cause = sourceEx.getCause() != null ? sourceEx.getCause() : sourceEx;
if (LOG.isDebugEnabled()) {
LOG.error("Failed to parse YANG from source {}", failedSource, sourceEx);
return buildFailure;
}
- private void completePhaseActions() throws ReactorException {
+ private void completePhaseActions() throws ReactorException {
Preconditions.checkState(currentPhase != null);
List<SourceSpecificContext> sourcesToProgress = Lists.newArrayList(sources);
try {
SourceSpecificContext nextSourceCtx = currentSource.next();
PhaseCompletionProgress sourceProgress = nextSourceCtx.tryToCompletePhase(currentPhase);
switch (sourceProgress) {
- case FINISHED:
- currentSource.remove();
- // Fallback to progress, since we were able to make progress in computation
- case PROGRESS:
- progressing = true;
- break;
- case NO_PROGRESS:
- // Noop
- break;
- default:
- throw new IllegalStateException("Unsupported phase progress " + sourceProgress);
+ case FINISHED:
+ currentSource.remove();
+ // Fallback to progress, since we were able to make
+ // progress in computation
+ case PROGRESS:
+ progressing = true;
+ break;
+ case NO_PROGRESS:
+ // Noop
+ break;
+ default:
+ throw new IllegalStateException("Unsupported phase progress " + sourceProgress);
}
}
}
}
}
- private void endPhase(final ModelProcessingPhase phase) {
+ private void endPhase(final ModelProcessingPhase phase) {
Preconditions.checkState(currentPhase == phase);
finishedPhase = currentPhase;
}
*/
package org.opendaylight.yangtools.yang.parser.stmt.reactor;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteSource;
import java.io.File;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
public class CrossSourceStatementReactor {
- private final Map<ModelProcessingPhase,StatementSupportBundle> supportedTerminology;
- private final Map<ValidationBundleType,Collection<?>> supportedValidation;
+ private final Map<ModelProcessingPhase, StatementSupportBundle> supportedTerminology;
+ private final Map<ValidationBundleType, Collection<?>> supportedValidation;
CrossSourceStatementReactor(final Map<ModelProcessingPhase, StatementSupportBundle> supportedTerminology) {
this.supportedTerminology = ImmutableMap.copyOf(supportedTerminology);
this.supportedValidation = ImmutableMap.of();
}
- CrossSourceStatementReactor(final Map<ModelProcessingPhase, StatementSupportBundle> supportedTerminology, final Map<ValidationBundleType,Collection<?>> supportedValidation) {
+ CrossSourceStatementReactor(final Map<ModelProcessingPhase, StatementSupportBundle> supportedTerminology,
+ final Map<ValidationBundleType, Collection<?>> supportedValidation) {
this.supportedTerminology = ImmutableMap.copyOf(supportedTerminology);
this.supportedValidation = ImmutableMap.copyOf(supportedValidation);
}
}
public final BuildAction newBuild() {
- return newBuild(t -> true);
+ return newBuild(StatementParserMode.DEFAULT_MODE, t -> true);
}
public final BuildAction newBuild(final Predicate<QName> isFeatureSupported) {
- return new BuildAction(isFeatureSupported);
+ return new BuildAction(StatementParserMode.DEFAULT_MODE, isFeatureSupported);
}
- public static class Builder implements org.opendaylight.yangtools.concepts.Builder<CrossSourceStatementReactor>{
+ public final BuildAction newBuild(final StatementParserMode statementParserMode) {
+ return new BuildAction(statementParserMode, t -> true);
+ }
+
+ public final BuildAction newBuild(final StatementParserMode statementParserMode,
+ final Predicate<QName> isFeatureSupported) {
+ return new BuildAction(statementParserMode, isFeatureSupported);
+ }
- final Map<ModelProcessingPhase,StatementSupportBundle> bundles = new EnumMap<>(ModelProcessingPhase.class);
- final Map<ValidationBundleType,Collection<?>> validationBundles = new EnumMap<>(ValidationBundleType.class);
+ public static class Builder implements org.opendaylight.yangtools.concepts.Builder<CrossSourceStatementReactor> {
- public Builder setBundle(final ModelProcessingPhase phase,final StatementSupportBundle bundle) {
+ final Map<ModelProcessingPhase, StatementSupportBundle> bundles = new EnumMap<>(ModelProcessingPhase.class);
+ final Map<ValidationBundleType, Collection<?>> validationBundles = new EnumMap<>(ValidationBundleType.class);
+
+ public Builder setBundle(final ModelProcessingPhase phase, final StatementSupportBundle bundle) {
bundles.put(phase, bundle);
return this;
}
-
public Builder setValidationBundle(final ValidationBundleType type, final Collection<?> validationBundle) {
- validationBundles.put(type,validationBundle);
+ validationBundles.put(type, validationBundle);
return this;
}
private final BuildGlobalContext context;
public BuildAction() {
- this(t -> true);
+ this(StatementParserMode.DEFAULT_MODE, t -> true);
+ }
+
+ public BuildAction(StatementParserMode statementParserMode) {
+ this(statementParserMode, t -> true);
}
public BuildAction(Predicate<QName> isFeatureSupported) {
- Preconditions.checkNotNull(isFeatureSupported);
- this.context = new BuildGlobalContext(supportedTerminology, supportedValidation, isFeatureSupported);
+ this(StatementParserMode.DEFAULT_MODE, isFeatureSupported);
+ }
+
+ public BuildAction(StatementParserMode statementParserMode, Predicate<QName> isFeatureSupported) {
+ this.context = new BuildGlobalContext(supportedTerminology, supportedValidation, statementParserMode,
+ isFeatureSupported);
}
public void addSource(final StatementStreamSource source) {
return context.buildEffective();
}
- public SchemaContext buildEffective(final Collection<ByteSource> yangByteSources) throws
- ReactorException, IOException {
+ public SchemaContext buildEffective(final Collection<ByteSource> yangByteSources) throws ReactorException,
+ IOException {
for (ByteSource yangByteSource : yangByteSources) {
addSource(new YangStatementSourceImpl(yangByteSource.openStream()));
}
return buildEffective();
}
- public SchemaContext buildEffective(final List<InputStream> yangInputStreams) throws
- ReactorException {
+ public SchemaContext buildEffective(final List<InputStream> yangInputStreams) throws ReactorException {
for (InputStream yangInputStream : yangInputStreams) {
addSource(new YangStatementSourceImpl(yangInputStream));
}
}
/**
- * @deprecated This method was never used and relies on deprecated module methods.
+ * @deprecated This method was never used and relies on deprecated
+ * module methods.
*/
@Deprecated
- public Map<File, Module> buildEffectiveMappedToSource(final List<File> yangFiles) throws
- ReactorException, FileNotFoundException {
+ public Map<File, Module> buildEffectiveMappedToSource(final List<File> yangFiles) throws ReactorException,
+ FileNotFoundException {
if (yangFiles == null || yangFiles.isEmpty()) {
return Collections.emptyMap();
}
return sourceFileToModule;
}
}
-}
+}
\ No newline at end of file
// FIXME: Provide real argument name
final class ModelDefinedStatementDefinition implements StatementDefinition {
private final QName qName;
+ private final boolean yinElement;
ModelDefinedStatementDefinition(QName qName) {
+ this(qName, false);
+ }
+
+ ModelDefinedStatementDefinition(QName qName, final boolean yinElement) {
this.qName = qName;
+ this.yinElement = yinElement;
}
@Nonnull
public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
return UnknownEffectiveStatementImpl.class;
}
+
+ @Override
+ public boolean isArgumentYinElement() {
+ return yinElement;
+ }
}
\ No newline at end of file
public boolean isConfiguration() {
return true;
}
+
+ @Override
+ public boolean isEnabledSemanticVersioning() {
+ return sourceContext.isEnabledSemanticVersioning();
+ }
}
this.currentContext = currentContext;
}
+ public boolean isEnabledSemanticVersioning(){
+ return currentContext.isEnabledSemanticVersioning();
+ }
+
ModelProcessingPhase getInProgressPhase() {
return inProgressPhase;
}
}
private QNameToStatementDefinition stmtDef() {
- // regular YANG statements added
+ // regular YANG statements and extension supports added
ImmutableMap<QName, StatementSupport<?, ?, ?>> definitions = currentContext.getSupportsForPhase(
inProgressPhase).getDefinitions();
for (Entry<QName, StatementSupport<?, ?, ?>> entry : definitions.entrySet()) {
if (extensions != null) {
for (Entry<QName, StmtContext<?, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>>> extension :
extensions.entrySet()) {
- qNameToStmtDefMap.put((extension.getKey()),
+ if(qNameToStmtDefMap.get(extension.getKey()) == null) {
+ qNameToStmtDefMap.put((extension.getKey()),
(StatementDefinition) ((StatementContextBase<?, ?, ?>) extension.getValue()).definition()
.getFactory());
+ }
}
}
}
+
return qNameToStmtDefMap;
}
}
"Parent node has config statement set to false, therefore no node underneath it can have config set to true",
getStatementSourceReference());
}
+
+ @Override
+ public boolean isEnabledSemanticVersioning() {
+ return parent.isEnabledSemanticVersioning();
+ }
}
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.NavigableMap;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.InferenceAction;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.Prerequisite;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionModuleNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToSemVerModuleIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToNamespace;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ImportEffectiveStatementImpl;
-public class ImportStatementDefinition
- extends AbstractStatementSupport<String, ImportStatement, EffectiveStatement<String, ImportStatement>> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
- SubstatementValidator.builder(Rfc6020Mapping.IMPORT)
- .add(Rfc6020Mapping.PREFIX, 1, 1).add(Rfc6020Mapping.REVISION_DATE, 0, 1).build();
+public class ImportStatementDefinition extends
+ AbstractStatementSupport<String, ImportStatement, EffectiveStatement<String, ImportStatement>> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator
+ .builder(Rfc6020Mapping.IMPORT).add(Rfc6020Mapping.PREFIX, 1, 1).add(Rfc6020Mapping.REVISION_DATE, 0, 1)
+ .add(SupportedExtensionsMapping.SEMANTIC_VERSION, 0, 1).build();
public ImportStatementDefinition() {
super(Rfc6020Mapping.IMPORT);
@Override
public void onLinkageDeclared(
final Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> stmt) {
- final ModuleIdentifier impIdentifier = getImportedModuleIdentifier(stmt);
- final ModelActionBuilder importAction = stmt.newInferenceAction(SOURCE_LINKAGE);
- final Prerequisite<StmtContext<?, ?, ?>> imported = importAction.requiresCtx(stmt, ModuleNamespace.class,
- impIdentifier, SOURCE_LINKAGE);
- final Prerequisite<Mutable<?, ?, ?>> linkageTarget = importAction.mutatesCtx(stmt.getRoot(), SOURCE_LINKAGE);
+ if (stmt.isEnabledSemanticVersioning()) {
+ SemanticVersionImport.onLinkageDeclared(stmt);
+ } else {
+ RevisionImport.onLinkageDeclared(stmt);
+ }
+ }
- importAction.apply(new InferenceAction() {
- @Override
- public void apply() {
- StmtContext<?, ?, ?> importedModule = null;
- ModuleIdentifier importedModuleIdentifier = null;
- if (impIdentifier.getRevision() == SimpleDateFormatUtil.DEFAULT_DATE_IMP) {
- Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> recentModuleEntry =
- findRecentModule(impIdentifier, stmt.getAllFromNamespace(ModuleNamespace.class));
- if (recentModuleEntry != null) {
- importedModuleIdentifier = recentModuleEntry.getKey();
- importedModule = recentModuleEntry.getValue();
+ private static class RevisionImport {
+
+ private RevisionImport() {
+ throw new UnsupportedOperationException("Utility class");
+ }
+
+ private static void onLinkageDeclared(
+ final Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> stmt) {
+ final ModuleIdentifier impIdentifier = getImportedModuleIdentifier(stmt);
+ final ModelActionBuilder importAction = stmt.newInferenceAction(SOURCE_LINKAGE);
+ final Prerequisite<StmtContext<?, ?, ?>> imported = importAction.requiresCtx(stmt, ModuleNamespace.class,
+ impIdentifier, SOURCE_LINKAGE);
+ final Prerequisite<Mutable<?, ?, ?>> linkageTarget = importAction
+ .mutatesCtx(stmt.getRoot(), SOURCE_LINKAGE);
+
+ importAction.apply(new InferenceAction() {
+ @Override
+ public void apply() {
+ StmtContext<?, ?, ?> importedModule = null;
+ ModuleIdentifier importedModuleIdentifier = null;
+ if (impIdentifier.getRevision() == SimpleDateFormatUtil.DEFAULT_DATE_IMP) {
+ Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> recentModuleEntry = findRecentModule(
+ impIdentifier, stmt.getAllFromNamespace(ModuleNamespace.class));
+ if (recentModuleEntry != null) {
+ importedModuleIdentifier = recentModuleEntry.getKey();
+ importedModule = recentModuleEntry.getValue();
+ }
+ }
+
+ if (importedModule == null || importedModuleIdentifier == null) {
+ importedModule = imported.get();
+ importedModuleIdentifier = impIdentifier;
+ }
+
+ linkageTarget.get().addToNs(ImportedModuleContext.class, importedModuleIdentifier, importedModule);
+ String impPrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
+ stmt.addToNs(ImpPrefixToModuleIdentifier.class, impPrefix, importedModuleIdentifier);
+
+ final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(), NamespaceStatement.class);
+ stmt.addToNs(URIStringToImpPrefix.class, modNs.toString(), impPrefix);
+ }
+
+ @Override
+ public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
+ if (failed.contains(imported)) {
+ throw new InferenceException(stmt.getStatementSourceReference(),
+ "Imported module [%s] was not found.", impIdentifier);
}
}
+ });
+
+ }
+
+ private static Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> findRecentModule(
+ final ModuleIdentifier impIdentifier,
+ final Map<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> allModules) {
+
+ ModuleIdentifier recentModuleIdentifier = impIdentifier;
+ Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> recentModuleEntry = null;
+
+ for (Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> moduleEntry : allModules
+ .entrySet()) {
+ final ModuleIdentifier id = moduleEntry.getKey();
- if (importedModule == null || importedModuleIdentifier == null) {
- importedModule = imported.get();
- importedModuleIdentifier = impIdentifier;
+ if (id.getName().equals(impIdentifier.getName())
+ && id.getRevision().compareTo(recentModuleIdentifier.getRevision()) > 0) {
+ recentModuleIdentifier = id;
+ recentModuleEntry = moduleEntry;
}
+ }
- linkageTarget.get().addToNs(ImportedModuleContext.class, importedModuleIdentifier, importedModule);
- String impPrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
- stmt.addToNs(ImpPrefixToModuleIdentifier.class, impPrefix, importedModuleIdentifier);
+ return recentModuleEntry;
+ }
- final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(), NamespaceStatement.class);
- stmt.addToNs(URIStringToImpPrefix.class, modNs.toString(), impPrefix);
+ private static ModuleIdentifier getImportedModuleIdentifier(final Mutable<String, ImportStatement, ?> stmt) {
+ Date revision = firstAttributeOf(stmt.declaredSubstatements(), RevisionDateStatement.class);
+ if (revision == null) {
+ revision = SimpleDateFormatUtil.DEFAULT_DATE_IMP;
}
- private Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> findRecentModule(
- final ModuleIdentifier impIdentifier,
- final Map<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> allModules) {
+ return new ModuleIdentifierImpl(stmt.getStatementArgument(), Optional.absent(),
+ Optional.of(revision));
+ }
+ }
+
+ private static class SemanticVersionImport {
+ private SemanticVersionImport() {
+ throw new UnsupportedOperationException("Utility class");
+ }
- ModuleIdentifier recentModuleIdentifier = impIdentifier;
- Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> recentModuleEntry = null;
+ private static void onLinkageDeclared(
+ final Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> stmt) {
+ final ModuleIdentifier impIdentifier = getImportedModuleIdentifier(stmt);
+ final ModelActionBuilder importAction = stmt.newInferenceAction(SOURCE_LINKAGE);
+ final Prerequisite<StmtContext<?, ?, ?>> imported = importAction.requiresCtx(stmt, ModuleNamespace.class,
+ impIdentifier, SOURCE_LINKAGE);
+ final Prerequisite<Mutable<?, ?, ?>> linkageTarget = importAction
+ .mutatesCtx(stmt.getRoot(), SOURCE_LINKAGE);
- for (Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> moduleEntry : allModules.entrySet()) {
- final ModuleIdentifier id = moduleEntry.getKey();
+ importAction.apply(new InferenceAction() {
+ @Override
+ public void apply() {
+ Entry<SemVer, StmtContext<?, ?, ?>> importedModuleEntry= findRecentCompatibleModuleEntry(
+ impIdentifier.getName(), stmt);
- if (id.getName().equals(impIdentifier.getName())
- && id.getRevision().compareTo(recentModuleIdentifier.getRevision()) > 0) {
- recentModuleIdentifier = id;
- recentModuleEntry = moduleEntry;
+ StmtContext<?, ?, ?> importedModule = null;
+ ModuleIdentifier importedModuleIdentifier = null;
+ ModuleIdentifier semVerModuleIdentifier = null;
+ if (importedModuleEntry != null) {
+ importedModule = importedModuleEntry.getValue();
+ importedModuleIdentifier = importedModule.getFromNamespace(ModuleCtxToModuleIdentifier.class, importedModule);
+ semVerModuleIdentifier = createSemVerModuleIdentifier(importedModuleIdentifier, importedModuleEntry.getKey());
+ } else {
+ throw new InferenceException(stmt.getStatementSourceReference(),
+ "Unable to find module compatible with requested import [%s(%s)].", impIdentifier
+ .getName(), getRequestedImportVersion(stmt));
}
+
+ linkageTarget.get().addToNs(ImportedModuleContext.class, importedModuleIdentifier, importedModule);
+ String impPrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
+ stmt.addToNs(ImpPrefixToModuleIdentifier.class, impPrefix, importedModuleIdentifier);
+ stmt.addToNs(ImpPrefixToSemVerModuleIdentifier.class, impPrefix, semVerModuleIdentifier);
+
+ final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(), NamespaceStatement.class);
+ stmt.addToNs(URIStringToImpPrefix.class, modNs.toString(), impPrefix);
}
- return recentModuleEntry;
+ @Override
+ public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
+ if (failed.contains(imported)) {
+ throw new InferenceException(stmt.getStatementSourceReference(),
+ "Unable to find module compatible with requested import [%s(%s)].", impIdentifier
+ .getName(), getRequestedImportVersion(stmt));
+ }
+ }
+ });
+ }
+
+ private static SemVer getRequestedImportVersion(Mutable<?, ?, ?> impStmt) {
+ SemVer requestedImportVersion = impStmt.getFromNamespace(SemanticVersionNamespace.class, impStmt);
+ if (requestedImportVersion == null) {
+ requestedImportVersion = Module.DEFAULT_SEMANTIC_VERSION;
}
+ return requestedImportVersion;
+ }
- @Override
- public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
- if (failed.contains(imported)) {
- throw new InferenceException(stmt.getStatementSourceReference(),
- "Imported module [%s] was not found.", impIdentifier);
- }
+ private static Entry<SemVer, StmtContext<?, ?, ?>> findRecentCompatibleModuleEntry(final String moduleName,
+ final Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> impStmt) {
+ NavigableMap<SemVer, StmtContext<?, ?, ?>> allRelevantModulesMap = impStmt.getFromNamespace(
+ SemanticVersionModuleNamespace.class, moduleName);
+ if (allRelevantModulesMap == null) {
+ return null;
}
- });
+ final SemVer requestedImportVersion = getRequestedImportVersion(impStmt);
+ allRelevantModulesMap = allRelevantModulesMap.subMap(requestedImportVersion, true,
+ SemVer.create(requestedImportVersion.getMajor() + 1), false);
+ if (!allRelevantModulesMap.isEmpty()) {
+ return allRelevantModulesMap.lastEntry();
+ }
- }
+ return null;
+ }
- private static ModuleIdentifier getImportedModuleIdentifier(final Mutable<String, ImportStatement, ?> stmt) {
- Date revision = firstAttributeOf(stmt.declaredSubstatements(), RevisionDateStatement.class);
- if (revision == null) {
- revision = SimpleDateFormatUtil.DEFAULT_DATE_IMP;
+ private static ModuleIdentifier getImportedModuleIdentifier(final Mutable<String, ImportStatement, ?> impStmt) {
+ return new ModuleIdentifierImpl(impStmt.getStatementArgument(), Optional.absent(),
+ Optional.of(SimpleDateFormatUtil.DEFAULT_DATE_IMP));
}
- return new ModuleIdentifierImpl(stmt.getStatementArgument(), Optional.absent(),
- Optional.of(revision));
+ private static ModuleIdentifier createSemVerModuleIdentifier(final ModuleIdentifier importedModuleIdentifier,
+ final SemVer semVer) {
+ return new ModuleIdentifierImpl(importedModuleIdentifier.getName(), Optional.fromNullable(importedModuleIdentifier
+ .getNamespace()), Optional.of(importedModuleIdentifier.getRevision()), semVer);
+ }
}
-
-}
\ No newline at end of file
+}
import com.google.common.base.Optional;
import java.net.URI;
import java.util.Date;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.parser.spi.PreLinkageModuleNamespace;
import org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionModuleNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleIdentifierToModuleQName;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
.add(Rfc6020Mapping.TYPEDEF, 0, MAX)
.add(Rfc6020Mapping.USES, 0, MAX)
.add(Rfc6020Mapping.YANG_VERSION, 0, 1)
+ .add(SupportedExtensionsMapping.SEMANTIC_VERSION, 0, 1)
.build();
public ModuleStatementSupport() {
stmt.addToNs(PrefixToModule.class, modulePrefix, qNameModule);
stmt.addToNs(ModuleNameToModuleQName.class, stmt.getStatementArgument(), qNameModule);
stmt.addToNs(ModuleCtxToModuleQName.class, stmt, qNameModule);
+ stmt.addToNs(ModuleCtxToModuleIdentifier.class, stmt, moduleIdentifier);
stmt.addToNs(ModuleQNameToModuleName.class, qNameModule, stmt.getStatementArgument());
stmt.addToNs(ModuleIdentifierToModuleQName.class, moduleIdentifier, qNameModule);
stmt.addToNs(ImpPrefixToModuleIdentifier.class, modulePrefix, moduleIdentifier);
+
+ if (stmt.isEnabledSemanticVersioning()) {
+ addToSemVerModuleNamespace(stmt);
+ }
+ }
+
+ private void addToSemVerModuleNamespace(
+ final Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt) {
+ final String moduleName = stmt.getStatementArgument();
+ NavigableMap<SemVer, StmtContext<?, ?, ?>> modulesMap = stmt.getFromNamespace(
+ SemanticVersionModuleNamespace.class, moduleName);
+ if (modulesMap == null) {
+ modulesMap = new TreeMap<SemVer, StmtContext<?, ?, ?>>();
+ }
+ SemVer moduleSemVer = stmt.getFromNamespace(SemanticVersionNamespace.class, stmt);
+ if(moduleSemVer == null) {
+ moduleSemVer = Module.DEFAULT_SEMANTIC_VERSION;
+ }
+ modulesMap.put(moduleSemVer, stmt);
+ stmt.addToNs(SemanticVersionModuleNamespace.class, moduleName, modulesMap);
}
@Override
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.SemanticVersionEffectiveStatementImpl;
+
+@Beta
+public final class SemanticVersionStatementImpl extends AbstractDeclaredStatement<SemVer> implements
+ UnknownStatement<SemVer> {
+
+ SemanticVersionStatementImpl(
+ StmtContext<SemVer, UnknownStatement<SemVer>, ?> context) {
+ super(context);
+ }
+
+ public static class SemanticVersionSupport
+ extends
+ AbstractStatementSupport<SemVer, UnknownStatement<SemVer>, EffectiveStatement<SemVer, UnknownStatement<SemVer>>> {
+
+ public SemanticVersionSupport() {
+ super(SupportedExtensionsMapping.SEMANTIC_VERSION);
+ }
+
+ @Override
+ public SemVer parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
+ return SemVer.valueOf(value) ;
+ }
+
+ @Override
+ public void onLinkageDeclared(StmtContext.Mutable<SemVer,UnknownStatement<SemVer>,EffectiveStatement<SemVer,UnknownStatement<SemVer>>> stmt) {
+ stmt.addToNs(SemanticVersionNamespace.class, stmt.getParentContext(), stmt.getStatementArgument());
+ }
+
+ @Override
+ public UnknownStatement<SemVer> createDeclared(
+ StmtContext<SemVer, UnknownStatement<SemVer>, ?> ctx) {
+ return new SemanticVersionStatementImpl(ctx);
+ }
+
+ @Override
+ public EffectiveStatement<SemVer, UnknownStatement<SemVer>> createEffective(
+ final StmtContext<SemVer, UnknownStatement<SemVer>, EffectiveStatement<SemVer, UnknownStatement<SemVer>>> ctx) {
+ return new SemanticVersionEffectiveStatementImpl(ctx);
+ }
+ }
+
+ @Override
+ public SemVer getArgument() {
+ return argument();
+ }
+}
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.AnyxmlSchemaLocationEffectiveStatementImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.SemanticVersionEffectiveStatementImpl;
@Beta
public enum SupportedExtensionsMapping implements StatementDefinition {
ANYXML_SCHEMA_LOCATION("urn:opendaylight:yang:extension:yang-ext", "2013-07-09",
- AnyxmlSchemaLocationStatementImpl.class, AnyxmlSchemaLocationEffectiveStatementImpl.class,
- "anyxml-schema-location", "target-node");
+ AnyxmlSchemaLocationStatementImpl.class, AnyxmlSchemaLocationEffectiveStatementImpl.class,
+ "anyxml-schema-location", "target-node", false), SEMANTIC_VERSION(
+ "urn:opendaylight:yang:extension:semantic-version", "2016-02-02", SemanticVersionStatementImpl.class,
+ SemanticVersionEffectiveStatementImpl.class, "semantic-version", "semantic-version", false);
private final Class<? extends DeclaredStatement<?>> type;
private final Class<? extends EffectiveStatement<?, ?>> effectiveType;
private final QName name;
private final QName argument;
+ private final boolean yinElement;
SupportedExtensionsMapping(final String namespace, final String revision,
final Class<? extends DeclaredStatement<?>> declared,
- final Class<? extends EffectiveStatement<?, ?>> effective, final String nameStr,
- final String argumentStr) {
+ final Class<? extends EffectiveStatement<?, ?>> effective, final String nameStr, final String argumentStr,
+ final boolean yinElement) {
type = Preconditions.checkNotNull(declared);
effectiveType = Preconditions.checkNotNull(effective);
name = createQName(namespace, revision, nameStr);
argument = createQName(namespace, revision, argumentStr);
+ this.yinElement = yinElement;
+ }
+
+ private SupportedExtensionsMapping(final String namespace, final Class<? extends DeclaredStatement<?>> declared,
+ final Class<? extends EffectiveStatement<?, ?>> effective, final String nameStr, final String argumentStr,
+ final boolean yinElement) {
+ type = Preconditions.checkNotNull(declared);
+ effectiveType = Preconditions.checkNotNull(effective);
+ name = createQName(namespace, nameStr);
+ argument = createQName(namespace, argumentStr);
+ this.yinElement = yinElement;
+ }
+
+ @Nonnull
+ private static QName createQName(final String namespace, final String localName) {
+ return QName.create(namespace, localName).intern();
}
@Nonnull
public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
return effectiveType;
}
+
+ @Override
+ public boolean isArgumentYinElement() {
+ return yinElement;
+ }
}
import org.opendaylight.yangtools.yang.parser.spi.meta.DerivedIdentitiesNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
import org.opendaylight.yangtools.yang.parser.spi.meta.QNameCacheNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionModuleNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
import org.opendaylight.yangtools.yang.parser.spi.source.AnyxmlSchemaLocationNamespace;
import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToModuleContext;
import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModuleName;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToSemVerModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameToIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleIdentifierToModuleQName;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
.addSupport(global(NamespaceToModule.class))
.addSupport(global(ModuleNameToModuleQName.class))
.addSupport(global(ModuleCtxToModuleQName.class))
+ .addSupport(global(ModuleCtxToModuleIdentifier.class))
.addSupport(global(ModuleQNameToModuleName.class))
.addSupport(global(PrefixToModule.class))
.addSupport(global(ModuleIdentifierToModuleQName.class))
.addSupport(sourceLocal(BelongsToModuleContext.class))
.addSupport(sourceLocal(QNameToStatementDefinition.class))
.addSupport(sourceLocal(BelongsToPrefixToModuleName.class))
+ .addSupport(new SemanticVersionStatementImpl.SemanticVersionSupport())
+ .addSupport(global(SemanticVersionNamespace.class))
+ .addSupport(global(SemanticVersionModuleNamespace.class))
+ .addSupport(sourceLocal(ImpPrefixToSemVerModuleIdentifier.class))
.build();
private static final StatementSupportBundle STMT_DEF_BUNDLE = StatementSupportBundle
private String fileName;
private boolean isAbsolute;
+ // FIXME IO exception: input stream closed when called from StmtTestUtils parserseYinSources method
public YinStatementSourceImpl(final InputStream inputStream) {
yinStatementModelParser = new YinStatementParserImpl(inputStream.toString());
this.inputStream = new BufferedInputStream(inputStream);
import java.util.Map;
import java.util.Set;
import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
private final Set<UsesNode> uses;
private final Set<TypeDefinition<?>> typeDefinitions;
private final Set<DataSchemaNode> publicChildNodes;
+ private final SemVer semanticVersion;
AbstractEffectiveModule(final StmtContext<String, D, ? extends EffectiveStatement<String, ?>> ctx) {
super(ctx);
YangVersionEffectiveStatementImpl yangVersionStmt = firstEffective(YangVersionEffectiveStatementImpl.class);
this.yangVersion = (yangVersionStmt == null) ? "1" : yangVersionStmt.argument();
+ SemanticVersionEffectiveStatementImpl semanticVersionStmt = firstEffective(SemanticVersionEffectiveStatementImpl.class);
+ this.semanticVersion = (semanticVersionStmt == null) ? DEFAULT_SEMANTIC_VERSION : semanticVersionStmt.argument();
+
OrganizationEffectiveStatementImpl organizationStmt = firstEffective(OrganizationEffectiveStatementImpl.class);
this.organization = (organizationStmt == null) ? null : organizationStmt.argument();
this.unknownNodes = ImmutableList.copyOf(unknownNodesInit);
this.augmentations = ImmutableSet.copyOf(augmentationsInit);
- this.imports = ImmutableSet.copyOf(resolveModuleImports(importsInit, ctx));
+ if (ctx.isEnabledSemanticVersioning()) {
+ this.imports = ImmutableSet.copyOf(importsInit);
+ } else {
+ this.imports = ImmutableSet.copyOf(resolveModuleImports(importsInit, ctx));
+ }
this.notifications = ImmutableSet.copyOf(notificationsInit);
this.rpcs = ImmutableSet.copyOf(rpcsInit);
this.deviations = ImmutableSet.copyOf(deviationsInit);
return uses;
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return semanticVersion;
+ }
+
@Override
public String toString() {
return this.getClass().getSimpleName() + "[" +
import java.util.Date;
import java.util.Objects;
+import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
import org.opendaylight.yangtools.yang.model.api.stmt.ImportStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.MissingSubstatementException;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToSemVerModuleIdentifier;
public class ImportEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, ImportStatement> implements
ModuleImport {
private final String moduleName;
private final Date revision;
+ private final SemVer semVer;
private final String prefix;
public ImportEffectiveStatementImpl(final StmtContext<String, ImportStatement, ?> ctx) {
super(ctx);
moduleName = ctx.getStatementArgument();
-
- RevisionDateEffectiveStatementImpl revisionDateStmt = firstEffective(RevisionDateEffectiveStatementImpl.class);
- this.revision = (revisionDateStmt == null) ? SimpleDateFormatUtil.DEFAULT_DATE_IMP : revisionDateStmt.argument();
-
PrefixEffectiveStatementImpl prefixStmt = firstEffective(PrefixEffectiveStatementImpl.class);
if (prefixStmt != null) {
this.prefix = prefixStmt.argument();
throw new MissingSubstatementException("Prefix is mandatory substatement of import statement",
ctx.getStatementSourceReference());
}
+
+ if (!ctx.isEnabledSemanticVersioning()) {
+ RevisionDateEffectiveStatementImpl revisionDateStmt = firstEffective(RevisionDateEffectiveStatementImpl.class);
+ this.revision = (revisionDateStmt == null) ? SimpleDateFormatUtil.DEFAULT_DATE_IMP : revisionDateStmt
+ .argument();
+ this.semVer = Module.DEFAULT_SEMANTIC_VERSION;
+ } else {
+ ModuleIdentifier importedModuleIdentifier = ctx.getFromNamespace(ImpPrefixToSemVerModuleIdentifier.class, prefix);
+ revision = importedModuleIdentifier.getRevision();
+ semVer = importedModuleIdentifier.getSemanticVersion();
+ }
}
@Override
return revision;
}
+ @Override
+ public SemVer getSemanticVersion() {
+ return semVer;
+ }
+
@Override
public String getPrefix() {
return prefix;
result = prime * result + Objects.hashCode(moduleName);
result = prime * result + Objects.hashCode(revision);
result = prime * result + Objects.hashCode(prefix);
+ result = prime * result + Objects.hashCode(semVer);
return result;
}
if (!Objects.equals(getPrefix(), other.getPrefix())) {
return false;
}
+ if (!Objects.equals(getSemanticVersion(), other.getSemanticVersion())) {
+ return false;
+ }
return true;
}
@Override
public String toString() {
return ImportEffectiveStatementImpl.class.getSimpleName() + "[moduleName=" + moduleName + ", revision="
- + revision + ", prefix=" + prefix + "]";
+ + revision + ", semantic version=" + semVer + ", prefix=" + prefix + "]";
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import com.google.common.annotations.Beta;
+import java.util.Objects;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+@Beta
+public final class SemanticVersionEffectiveStatementImpl extends
+ UnknownEffectiveStatementBase<SemVer> {
+
+ private final SchemaPath path;
+
+ public SemanticVersionEffectiveStatementImpl(
+ final StmtContext<SemVer, UnknownStatement<SemVer>, ?> ctx) {
+ super(ctx);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Objects.hashCode(path);
+ result = prime * result + Objects.hashCode(getNodeType());
+ result = prime * result + Objects.hashCode(getNodeParameter());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SemanticVersionEffectiveStatementImpl other = (SemanticVersionEffectiveStatementImpl) obj;
+ if (!Objects.equals(path, other.path)) {
+ return false;
+ }
+ if (!Objects.equals(getNodeType(), other.getNodeType())) {
+ return false;
+ }
+ if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
+ return false;
+ }
+ return true;
+ }
+}
package org.opendaylight.yangtools.yang.stmt;
+import java.io.File;
import java.io.FileFilter;
-
-import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
+import java.io.FileNotFoundException;
import java.net.URISyntaxException;
import java.net.URL;
-import java.io.File;
-import java.io.FileNotFoundException;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
import java.util.ArrayList;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.Collection;
+import java.util.List;
import java.util.Set;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.ModuleImport;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YinStatementSourceImpl;
+import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class StmtTestUtils {
}
};
- private static final Logger LOG = LoggerFactory
- .getLogger(StmtTestUtils.class);
+ final public static FileFilter YIN_FILE_FILTER = new FileFilter() {
+ @Override
+ public boolean accept(File file) {
+ String name = file.getName().toLowerCase();
+ return name.endsWith(".xml") && file.isFile();
+ }
+ };
+
+ private static final Logger LOG = LoggerFactory.getLogger(StmtTestUtils.class);
private StmtTestUtils() {
}
}
- public static List<Module> findModules(final Set<Module> modules,
- final String moduleName) {
+ public static List<Module> findModules(final Set<Module> modules, final String moduleName) {
List<Module> result = new ArrayList<>();
for (Module module : modules) {
if (module.getName().equals(moduleName)) {
return result;
}
- public static void addSources(
- CrossSourceStatementReactor.BuildAction reactor,
- YangStatementSourceImpl... sources) {
+ public static void addSources(CrossSourceStatementReactor.BuildAction reactor, YangStatementSourceImpl... sources) {
for (YangStatementSourceImpl source : sources) {
reactor.addSource(source);
}
}
- public static void printReferences(Module module, boolean isSubmodule,
- String indent) {
- LOG.debug(indent + (isSubmodule ? "Submodule " : "Module ")
- + module.getName());
+ public static void printReferences(Module module, boolean isSubmodule, String indent) {
+ LOG.debug(indent + (isSubmodule ? "Submodule " : "Module ") + module.getName());
Set<Module> submodules = module.getSubmodules();
for (Module submodule : submodules) {
printReferences(submodule, true, indent + " ");
}
}
- public static void printChilds(Collection<DataSchemaNode> childNodes,
- String indent) {
+ public static void printChilds(Collection<DataSchemaNode> childNodes, String indent) {
for (DataSchemaNode child : childNodes) {
LOG.debug(indent + "Child " + child.getQName().getLocalName());
if (child instanceof DataNodeContainer) {
- printChilds(((DataNodeContainer) child).getChildNodes(), indent
- + " ");
+ printChilds(((DataNodeContainer) child).getChildNodes(), indent + " ");
}
}
}
- public static SchemaContext parseYangSources(
- StatementStreamSource... sources) throws SourceException,
+ public static SchemaContext parseYangSources(StatementStreamSource... sources) throws SourceException,
ReactorException {
+ return parseYangSources(StatementParserMode.DEFAULT_MODE, sources);
+ }
- CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
- .newBuild();
+ public static SchemaContext parseYangSources(StatementParserMode statementParserMode, StatementStreamSource... sources)
+ throws SourceException, ReactorException {
+
+ CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(statementParserMode);
reactor.addSources(sources);
return reactor.buildEffective();
}
- public static SchemaContext parseYangSources(File... files)
- throws SourceException, ReactorException, FileNotFoundException {
+ public static SchemaContext parseYangSources(File... files) throws SourceException, ReactorException,
+ FileNotFoundException {
+ return parseYangSources(StatementParserMode.DEFAULT_MODE, files);
+ }
+
+ public static SchemaContext parseYangSources(StatementParserMode statementParserMode, File... files) throws SourceException,
+ ReactorException, FileNotFoundException {
StatementStreamSource[] sources = new StatementStreamSource[files.length];
sources[i] = new YangStatementSourceImpl(new NamedFileInputStream(files[i], files[i].getPath()));
}
- return parseYangSources(sources);
+ return parseYangSources(statementParserMode, sources);
+ }
+
+ public static SchemaContext parseYangSources(Collection<File> files) throws SourceException, ReactorException,
+ FileNotFoundException {
+ return parseYangSources(files, StatementParserMode.DEFAULT_MODE);
}
- public static SchemaContext parseYangSources(Collection<File> files)
+ public static SchemaContext parseYangSources(Collection<File> files, StatementParserMode statementParserMode)
throws SourceException, ReactorException, FileNotFoundException {
- return parseYangSources(files.toArray(new File[files.size()]));
+ return parseYangSources(statementParserMode, files.toArray(new File[files.size()]));
}
- public static SchemaContext parseYangSources(String yangSourcesDirectoryPath)
+ public static SchemaContext parseYangSources(String yangSourcesDirectoryPath) throws SourceException,
+ ReactorException, FileNotFoundException, URISyntaxException {
+ return parseYangSources(yangSourcesDirectoryPath, StatementParserMode.DEFAULT_MODE);
+ }
+
+ public static SchemaContext parseYangSources(String yangSourcesDirectoryPath, StatementParserMode statementParserMode)
throws SourceException, ReactorException, FileNotFoundException, URISyntaxException {
URL resourceDir = StmtTestUtils.class.getResource(yangSourcesDirectoryPath);
File testSourcesDir = new File(resourceDir.toURI());
- return parseYangSources(testSourcesDir.listFiles(YANG_FILE_FILTER));
+ return parseYangSources(statementParserMode, testSourcesDir.listFiles(YANG_FILE_FILTER));
+ }
+
+ public static SchemaContext parseYinSources(String yinSourcesDirectoryPath, StatementParserMode statementParserMode)
+ throws SourceException, ReactorException, FileNotFoundException, URISyntaxException {
+
+ URL resourceDir = StmtTestUtils.class.getResource(yinSourcesDirectoryPath);
+ File testSourcesDir = new File(resourceDir.toURI());
+
+ return parseYinSources(statementParserMode, testSourcesDir.listFiles(YIN_FILE_FILTER));
+ }
+
+ public static SchemaContext parseYinSources(StatementParserMode statementParserMode, File... files) throws SourceException,
+ ReactorException, FileNotFoundException {
+
+ StatementStreamSource[] sources = new StatementStreamSource[files.length];
+
+ for (int i = 0; i < files.length; i++) {
+ sources[i] = new YinStatementSourceImpl(new NamedFileInputStream(files[i], files[i].getPath()));
+ }
+
+ return parseYinSources(statementParserMode, sources);
+ }
+
+ public static SchemaContext parseYinSources(StatementParserMode statementParserMode, StatementStreamSource... sources)
+ throws SourceException, ReactorException {
+
+ CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(statementParserMode);
+ reactor.addSources(sources);
+
+ return reactor.buildEffective();
+ }
+
+ public static Module findImportedModule(SchemaContext context, Module rootModule, String importedModuleName) {
+ ModuleImport requestedModuleImport = null;
+ Set<ModuleImport> rootImports = rootModule.getImports();
+ for (ModuleImport moduleImport : rootImports) {
+ if (moduleImport.getModuleName().equals(importedModuleName)) {
+ requestedModuleImport = moduleImport;
+ break;
+ }
+ }
+
+ Module importedModule = context.findModuleByName(requestedModuleImport.getModuleName(),
+ requestedModuleImport.getRevision());
+ return importedModule;
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionBorderCaseTest {
+
+ @Test
+ public void borderCaseValidMajorTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-valid-major",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("5.5.5"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void borderCaseValidMinorTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-valid-minor",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("5.6.5"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void borderCaseValidPatchTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-valid-patch",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("5.5.6"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void borderCaseInvalidMajorTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-invalid-major",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(5.5.5)]."));
+ }
+ }
+
+ @Test
+ public void borderCaseInvalidMinorTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-invalid-minor",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(5.5.5)]."));
+ }
+ }
+
+ @Test
+ public void borderCaseInvalidPatchTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-invalid-patch",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(5.5.5)]."));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.ParseException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
+import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionComplexTest {
+
+ @Test
+ public void complexTest1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
+ ParseException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/complex/complex-1",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ // check module versions
+ assertEquals(SemVer.valueOf("1.3.95"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("1.50.2"), foo.getSemanticVersion());
+
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("1.2.6"), bar.getSemanticVersion());
+
+ Module foobar = StmtTestUtils.findImportedModule(context, bar, "foobar");
+ assertEquals(SemVer.valueOf("2.26.465"), foobar.getSemanticVersion());
+
+ // check imported components
+ assertNotNull("This component should be present", SchemaContextUtil.findDataSchemaNode(context, foo,
+ new RevisionAwareXPathImpl("/bar:root/bar:test-container/bar:number", true)));
+
+ assertNotNull("This component should be present", SchemaContextUtil.findDataSchemaNode(context, foo,
+ new RevisionAwareXPathImpl("/bar:should-present", true)));
+
+ // check not imported components
+ assertNull("This component should not be present", SchemaContextUtil.findDataSchemaNode(context, foo,
+ new RevisionAwareXPathImpl("/bar:root/bar:test-container/bar:oldnumber", true)));
+
+ assertNull("This component should not be present", SchemaContextUtil.findDataSchemaNode(context, foo,
+ new RevisionAwareXPathImpl("/bar:should-not-be-present", true)));
+ }
+
+ @Test
+ public void complexTest2() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
+ ParseException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/complex/complex-2",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ // check module versions
+ assertEquals(SemVer.valueOf("2.5.50"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("2.32.2"), foo.getSemanticVersion());
+
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("4.9.8"), bar.getSemanticVersion());
+
+ Module foobar = StmtTestUtils.findImportedModule(context, bar, "foobar");
+ assertEquals(SemVer.valueOf("7.13.99"), foobar.getSemanticVersion());
+
+ // check used augmentations
+ assertNotNull("This component should be present", SchemaContextUtil.findDataSchemaNode(context, bar,
+ new RevisionAwareXPathImpl("/foobar:root/foobar:test-container/bar:should-present-leaf-1", true)));
+
+ assertNotNull("This component should be present", SchemaContextUtil.findDataSchemaNode(context, bar,
+ new RevisionAwareXPathImpl("/foobar:root/foobar:test-container/bar:should-present-leaf-2", true)));
+
+ // check not used augmentations
+ assertNull("This component should not be present",
+ SchemaContextUtil.findDataSchemaNode(context, bar, new RevisionAwareXPathImpl(
+ "/foobar:root/foobar:test-container/bar:should-not-be-present-leaf-1", true)));
+
+ assertNull("This component should not be present",
+ SchemaContextUtil.findDataSchemaNode(context, bar, new RevisionAwareXPathImpl(
+ "/foobar:root/foobar:test-container/bar:should-not-be-present-leaf-2", true)));
+
+ // check if correct foobar module was included
+ assertNotNull("This component should be present", SchemaContextUtil.findDataSchemaNode(context, bar,
+ new RevisionAwareXPathImpl("/foobar:root/foobar:included-correct-mark", true)));
+
+ assertNull("This component should not be present", SchemaContextUtil.findDataSchemaNode(context, bar,
+ new RevisionAwareXPathImpl("/foobar:root/foobar:included-not-correct-mark", true)));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionDefaultsTest {
+
+ @Test
+ public void defaultsTest() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/defaults/defaults",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.0"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.0.0"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void defaultMajorValidTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/defaults/default-major-valid",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.0"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.99.99"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void defaultMajorInvalidTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/defaults/default-major-invalid", StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(0.0.0)]."));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionIgnoringRevisionTest {
+
+ @Test
+ public void ignoringRevisionTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/ignoring-revision",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void ignoringRevision2Test() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/ignoring-revision-2",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionImportTest {
+
+ @Test
+ public void importValidTest() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/import/import-valid",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("1.0.0"), semVer.getSemanticVersion());
+ }
+
+ @Test
+ public void importInvalidDeprecatedTest1() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/import/import-invalid-deprecated-1",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid import of semantic-version module");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage().startsWith(
+ "Unable to find module compatible with requested import " + "[semantic-version(1.0.0)]."));
+ }
+ }
+
+ @Test
+ public void importInvalidDeprecatedTest2() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/import/import-invalid-deprecated-2",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid import of semantic-version module");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage().startsWith(
+ "Unable to find module compatible with requested import " + "[semantic-version(0.9.9)]."));
+ }
+ }
+
+ @Test
+ public void importInvalidNotsufficientTest1() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/import/import-invalid-notsufficient-1",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid import of semantic-version module");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage().startsWith(
+ "Unable to find module compatible with requested import " + "[semantic-version(2.0.0)]."));
+ }
+ }
+
+ @Test
+ public void importInvalidNotsufficientTest2() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/import/import-invalid-notsufficient-2",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid import of semantic-version module");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage().startsWith(
+ "Unable to find module compatible with requested import " + "[semantic-version(2.0.5)]."));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Set;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.ModuleImport;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionMultipleImportTest {
+
+ @Test
+ public void multipleInvalidDeprecatedTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/multiple/multiple-invalid-deprecated",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(1.0.0)]."));
+ }
+ }
+
+ @Test
+ public void multipleInvalidNosufficientTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/multiple/multiple-invalid-nosufficient",
+ StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(2.5.5)]."));
+ }
+ }
+
+ @Test
+ public void multipleValidDefaultsTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/multiple/multiple-valid-defaults",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("0.9.5"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void multipleValidSpecifiedTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/multiple/multiple-valid-specified",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("5.5.6"), bar.getSemanticVersion());
+ }
+
+ private static Module findImportedModule(SchemaContext context, Module rootModule, String importedModuleName) {
+ ModuleImport requestedModuleImport = null;
+ Set<ModuleImport> rootImports = rootModule.getImports();
+ for (ModuleImport moduleImport : rootImports) {
+ if (moduleImport.getModuleName().equals(importedModuleName)) {
+ requestedModuleImport = moduleImport;
+ break;
+ }
+ }
+
+ Module importedModule = context.findModuleByName(requestedModuleImport.getModuleName(),
+ requestedModuleImport.getRevision());
+ return importedModule;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionPositionTest {
+
+ @Test
+ public void positionHeadTest() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/position/position-head",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void positionMiddleTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/position/position-middle",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void positiontailTest() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/position/position-tail",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.semver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class SemanticVersionTest {
+ @Test
+ public void basicTest() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/basic", StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void basicTest2() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/basic-2", StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void basicTest3() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/basic-3", StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ }
+
+ @Test
+ public void basicImportTest1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/basic-import-1",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void multipleModulesTest() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/multiple-modules",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("0.10.4"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void basicImportErrTest1() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/basic-import-invalid-1", StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(0.1.2)]."));
+ }
+ }
+
+ @Test
+ public void basicImportErrTest2() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYangSources("/semantic-version/basic-import-invalid-2", StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(0.1.2)]."));
+ }
+ }
+
+ @Test
+ public void nodeTest() throws Exception {
+ SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/node-test", StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("2016.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("2016.4.6"), bar.getSemanticVersion());
+
+ QName root = QName.create("foo", "2016-01-01", "foo-root");
+ QName container20160404 = QName.create("foo", "2016-01-01", "con20160404");
+ SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
+ SchemaPath.create(true, root, container20160404));
+ assertTrue(findDataSchemaNode instanceof ContainerSchemaNode);
+
+ QName container20160405 = QName.create("foo", "2016-01-01", "con20160405");
+ findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
+ SchemaPath.create(true, root, container20160405));
+ assertTrue(findDataSchemaNode instanceof ContainerSchemaNode);
+
+ QName container20160406 = QName.create("foo", "2016-01-01", "con20160406");
+ findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
+ SchemaPath.create(true, root, container20160406));
+ assertTrue(findDataSchemaNode instanceof ContainerSchemaNode);
+
+ QName container20170406 = QName.create("foo", "2016-01-01", "con20170406");
+ findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
+ SchemaPath.create(true, root, container20170406));
+ assertNull(findDataSchemaNode);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt.semver.yin;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
+
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Test;
+import org.opendaylight.yangtools.concepts.SemVer;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
+
+public class YinSemanticVersionTest {
+
+ @Test
+ public void basicTest() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYinSources("/semantic-version/yin-input/basic",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module bar = context.findModuleByNamespace(new URI("bar")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void basicImportTest1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
+ SchemaContext context = StmtTestUtils.parseYinSources("/semantic-version/yin-input/basic-import",
+ StatementParserMode.SEMVER_MODE);
+ assertNotNull(context);
+
+ Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
+ Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
+ .iterator().next();
+
+ assertEquals(SemVer.valueOf("0.0.1"), semVer.getSemanticVersion());
+ assertEquals(SemVer.valueOf("0.1.1"), foo.getSemanticVersion());
+ Module bar = StmtTestUtils.findImportedModule(context, foo, "bar");
+ assertEquals(SemVer.valueOf("0.1.2"), bar.getSemanticVersion());
+ }
+
+ @Test
+ public void basicImportErrTest1() throws SourceException, FileNotFoundException, ReactorException,
+ URISyntaxException {
+ try {
+ StmtTestUtils.parseYinSources("/semantic-version/yin-input/basic-import-invalid", StatementParserMode.SEMVER_MODE);
+ fail("Test should fail due to invalid semantic version");
+ } catch (InferenceException e) {
+ assertTrue(e.getMessage()
+ .startsWith("Unable to find module compatible with requested import [bar(0.1.2)]."));
+ }
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02;}
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02;}
+ import bar { prefix bar; revision-date 2016-01-31;}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.1.3";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "3.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "4.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.2.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.3.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.4.5";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.3";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.4";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "4.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "6.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.4.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.6.5";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.4";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.6";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "1.2.012"; }
+ import foobar { prefix foobar; sv:semantic-version "2.25.3"; }
+
+ revision "2016-01-03" {
+ description "Imported version";
+ }
+ sv:semantic-version "1.2.6";
+
+ container root {
+ container test-container {
+ uses foobar:test-grouping;
+ }
+ }
+
+ leaf-list should-present {
+ type string;
+ description "List of strings";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "1.2.210"; }
+ import foobar { prefix foobar; sv:semantic-version "2.25.3"; }
+
+ revision "2016-01-04" {
+ description "Not-imported version";
+ }
+ sv:semantic-version "2.200.200";
+
+ container root {
+ container test-container {
+ uses foobar:test-grouping;
+ }
+ }
+
+ leaf-list should-not-be-present {
+ type uint32;
+ description "List of integers";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "1.0.0"; }
+ import bar { prefix bar; sv:semantic-version "1.2.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.50.02";
+}
--- /dev/null
+module foobar {
+ namespace "foobar";
+ prefix foobar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "1.2.95"; }
+
+ revision "2016-01-31" {
+ description "Not-imported version";
+ }
+ sv:semantic-version "2.25.2";
+
+ grouping test-grouping {
+ leaf name {
+ type string;
+ description "Name";
+ }
+ leaf oldnumber {
+ type uint8;
+ description "Old number";
+ }
+ }
+}
--- /dev/null
+module foobar {
+ namespace "foobar";
+ prefix foobar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "1.3.95"; }
+
+ revision "2016-02-28" {
+ description "Imported version";
+ }
+ sv:semantic-version "2.26.465";
+
+ grouping test-grouping {
+ leaf name {
+ type string;
+ description "Name";
+ }
+ leaf number {
+ type uint32;
+ description "Number";
+ }
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "1.3.95";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "2.0.40"; }
+ import foobar { prefix foobar; sv:semantic-version "7.12.54"; }
+
+ revision "2016-01-03" {
+ description "Imported version";
+ }
+ sv:semantic-version "4.9.8";
+
+ augment "/foobar:root/foobar:test-container" {
+ leaf should-present-leaf-1 {
+ type string;
+ }
+ leaf should-present-leaf-2 {
+ type uint8;
+ default 0;
+ }
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "2.0.50"; }
+ import foobar { prefix foobar; sv:semantic-version "7.12.54"; }
+
+ revision "2016-01-04" {
+ description "Not-imported version";
+ }
+ sv:semantic-version "3.0.5";
+
+ augment "/foobar:root/foobar:test-container" {
+ leaf should-not-be-present-leaf-1 {
+ type string;
+ }
+ leaf should-not-be-present-leaf-2 {
+ type uint8;
+ default 0;
+ }
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "2.5.40"; }
+ import bar { prefix bar; sv:semantic-version "4.1.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.32.2";
+}
--- /dev/null
+module foobar {
+ namespace "foobar";
+ prefix foobar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "2.1.950"; }
+
+ revision "2016-01-31" {
+ description "Not-imported version";
+ }
+ sv:semantic-version "8.0.0";
+
+ container root {
+ leaf included-not-correct-mark {
+ type empty;
+ }
+ container test-container {
+ }
+ }
+}
--- /dev/null
+module foobar {
+ namespace "foobar";
+ prefix foobar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "2.5.50"; }
+
+ revision "2016-02-27" {
+ description "Not-imported version";
+ }
+ sv:semantic-version "7.13.0";
+
+ container root {
+ leaf included-not-correct-mark {
+ type empty;
+ }
+ container test-container {
+ }
+ }
+}
--- /dev/null
+module foobar {
+ namespace "foobar";
+ prefix foobar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; sv:semantic-version "2.5.50"; }
+
+ revision "2016-02-28" {
+ description "Imported version";
+ }
+ sv:semantic-version "7.13.99";
+
+ container root {
+ leaf included-correct-mark {
+ type empty;
+ }
+ container test-container {
+ }
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "2.5.50";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.0.0";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.99.99";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import bar { prefix bar; revision-date 2016-01-31; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "1.0.0"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "2.0.0";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.9.9"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "1.0.0";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "2.0.0"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "1.0.0";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "2.0.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "2.0.0";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "1.0.0"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "1.0.0";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-03" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.3";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-04" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.10.4";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-28" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.2.28";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "4.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.0.0";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "1.0.0"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.0.0";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.1.0";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.5.0";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "2.5.4";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "2.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.0.1";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.0";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.9.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "1.0.0";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "4.4.0";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.0";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.5";
+
+ container root {
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-02" {
+ description "Initial version";
+ }
+ sv:semantic-version "5.5.6";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; sv:semantic-version "5.5.5"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision 2016-04-04 {
+ description "test";
+ }
+
+ sv:semantic-version "2016.4.4";
+
+ grouping grp {
+ container con20160404 {
+ }
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision 2016-04-05 {
+ description "test";
+ }
+
+ sv:semantic-version "2016.4.5";
+
+ grouping grp {
+ container con20160404 {
+ }
+ container con20160405 {
+ }
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision 2016-04-06 {
+ description "test";
+ }
+
+ sv:semantic-version "2016.4.6";
+
+ grouping grp {
+ container con20160404 {
+ }
+ container con20160405 {
+ }
+ container con20160406 {
+ }
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision 2017-04-06 {
+ description "test";
+ }
+
+ sv:semantic-version "2017.4.6";
+
+ grouping grp {
+ container con20160404 {
+ }
+ container con20160405 {
+ }
+ container con20160406 {
+ }
+ container con20170406 {
+ }
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2017-04-06; sv:semantic-version "2016.4.5"; }
+
+ revision 2016-01-01 {
+ description "test";
+ }
+
+ sv:semantic-version "2016.1.1";
+
+ container foo-root {
+ uses bar:grp;
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ sv:semantic-version "0.1.2";
+
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ sv:semantic-version "0.1.1";
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ sv:semantic-version "0.0.1";
+
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.2";
+
+ container root {
+ }
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+ sv:semantic-version "0.1.1";
+
+ container root {
+ }
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+ sv:semantic-version "0.0.1";
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+}
--- /dev/null
+module bar {
+ namespace "bar";
+ prefix bar;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-01-31" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+
+ sv:semantic-version "0.1.2";
+}
--- /dev/null
+module foo {
+ namespace "foo";
+ prefix foo;
+ yang-version 1;
+
+ import semantic-version { prefix sv; revision-date 2016-02-02; sv:semantic-version "0.0.1"; }
+
+ revision "2016-02-01" {
+ description "Initial version";
+ }
+
+ container root {
+ }
+
+ sv:semantic-version "0.1.1";
+ import bar { prefix bar; revision-date 2016-01-31; sv:semantic-version "0.1.2";}
+}
--- /dev/null
+module semantic-version {
+ namespace "urn:opendaylight:yang:extension:semantic-version";
+ prefix sv;
+ yang-version 1;
+
+ revision 2016-02-02 {
+ description "Initial verison";
+ }
+
+ extension semantic-version {
+ argument "semantic-version" {
+ yin-element false;
+ }
+ description
+ "The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.";
+ }
+
+ sv:semantic-version "0.0.1";
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="bar">
+ <yang-version value="1"></yang-version>
+ <namespace uri="bar"></namespace>
+ <prefix value="bar"></prefix>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-01-01"></revision>
+ <sv:semantic-version semantic-version="1.1.2"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="bar">
+ <yang-version value="1"></yang-version>
+ <namespace uri="bar"></namespace>
+ <prefix value="bar"></prefix>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-01-31"></revision>
+ <sv:semantic-version semantic-version="1.1.3"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:foo="foo" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="foo">
+ <yang-version value="1"></yang-version>
+ <namespace uri="foo"></namespace>
+ <prefix value="foo"></prefix>
+ <import module="bar">
+ <prefix value="bar"></prefix>
+ <revision-date date="2016-01-31"></revision-date>
+ <sv:semantic-version semantic-version="0.1.2"></sv:semantic-version>
+ </import>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-02-01"></revision>
+ <sv:semantic-version semantic-version="0.1.1"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:sv="urn:opendaylight:yang:extension:semantic-version"
+ name="semantic-version">
+ <yang-version value="1"></yang-version>
+ <namespace uri="urn:opendaylight:yang:extension:semantic-version"></namespace>
+ <prefix value="sv"></prefix>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-02-02"></revision>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ <extension name="semantic-version">
+ <argument name="semantic-version">
+ <yin-element value="false"></yin-element>
+ </argument>
+ <status value="current"></status>
+ <description>
+ <text>The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.
+ </text>
+ </description>
+ </extension>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="bar">
+ <yang-version value="1"></yang-version>
+ <namespace uri="bar"></namespace>
+ <prefix value="bar"></prefix>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-01-01"></revision>
+ <sv:semantic-version semantic-version="0.1.2"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="bar">
+ <yang-version value="1"></yang-version>
+ <namespace uri="bar"></namespace>
+ <prefix value="bar"></prefix>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-01-31"></revision>
+ <sv:semantic-version semantic-version="1.1.2"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:foo="foo" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="foo">
+ <yang-version value="1"></yang-version>
+ <namespace uri="foo"></namespace>
+ <prefix value="foo"></prefix>
+ <import module="bar">
+ <prefix value="bar"></prefix>
+ <revision-date date="2016-01-31"></revision-date>
+ <sv:semantic-version semantic-version="0.1.2"></sv:semantic-version>
+ </import>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-02-01"></revision>
+ <sv:semantic-version semantic-version="0.1.1"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:sv="urn:opendaylight:yang:extension:semantic-version"
+ name="semantic-version">
+ <yang-version value="1"></yang-version>
+ <namespace uri="urn:opendaylight:yang:extension:semantic-version"></namespace>
+ <prefix value="sv"></prefix>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-02-02"></revision>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ <extension name="semantic-version">
+ <argument name="semantic-version">
+ <yin-element value="false"></yin-element>
+ </argument>
+ <status value="current"></status>
+ <description>
+ <text>The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.
+ </text>
+ </description>
+ </extension>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="bar">
+ <yang-version value="1"></yang-version>
+ <namespace uri="bar"></namespace>
+ <prefix value="bar"></prefix>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-01-31"></revision>
+ <sv:semantic-version semantic-version="0.1.2"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:foo="foo" xmlns:bar="bar"
+ xmlns:sv="urn:opendaylight:yang:extension:semantic-version" name="foo">
+ <yang-version value="1"></yang-version>
+ <namespace uri="foo"></namespace>
+ <prefix value="foo"></prefix>
+ <import module="bar">
+ <prefix value="bar"></prefix>
+ <revision-date date="2016-01-31"></revision-date>
+ <sv:semantic-version semantic-version="0.1.2"></sv:semantic-version>
+ </import>
+ <import module="semantic-version">
+ <prefix value="sv"></prefix>
+ <revision-date date="2016-02-02"></revision-date>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ </import>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-02-01"></revision>
+ <sv:semantic-version semantic-version="0.1.1"></sv:semantic-version>
+ <container name="root">
+ <presence value="false"></presence>
+ <config value="true"></config>
+ <status value="current"></status>
+ </container>
+</module>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:sv="urn:opendaylight:yang:extension:semantic-version"
+ name="semantic-version">
+ <yang-version value="1"></yang-version>
+ <namespace uri="urn:opendaylight:yang:extension:semantic-version"></namespace>
+ <prefix value="sv"></prefix>
+ <organization>
+ <text></text>
+ </organization>
+ <contact>
+ <text></text>
+ </contact>
+ <revision date="2016-02-02"></revision>
+ <sv:semantic-version semantic-version="0.0.1"></sv:semantic-version>
+ <extension name="semantic-version">
+ <argument name="semantic-version">
+ <yin-element value="false"></yin-element>
+ </argument>
+ <status value="current"></status>
+ <description>
+ <text>The OpenConfig version number for the module. This is
+ expressed as a semantic version number of the form:
+ x.y.z
+ where:
+ * x corresponds to the major version,
+ * y corresponds to a minor version,
+ * z corresponds to a patch version.
+ This version corresponds to the model file within which it is
+ defined, and does not cover the whole set of OpenConfig models.
+ Where several modules are used to build up a single block of
+ functionality, the same module version is specified across each
+ file that makes up the module.
+
+ A major version number of 0 indicates that this model is still
+ in development (whether within OpenConfig or with industry
+ partners), and is potentially subject to change.
+
+ Following a release of major version 1, all modules will
+ increment major revision number where backwards incompatible
+ changes to the model are made.
+
+ The minor version is changed when features are added to the
+ model that do not impact current clients use of the model.
+
+ The patch-level version is incremented when non-feature changes
+ (such as bugfixes or clarifications to human-readable
+ descriptions that do not impact model functionality) are made
+ that maintain backwards compatibility.
+
+ The version number is stored in the module meta-data.
+ </text>
+ </description>
+ </extension>
+</module>
\ No newline at end of file