<version>6.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-model-api</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-parser-support</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc7952-data-api</artifactId>
<artifactId>rfc6536-parser-support</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-model-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-parser-support</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc7952-model-api</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc6536-model-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-model-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc7952-model-api</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc6536-parser-support</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-parser-support</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc7952-parser-support</artifactId>
<module>rfc6536-model-api</module>
<module>rfc6536-parser-support</module>
+ <!-- SMIv2-to-YANG translations support -->
+ <module>rfc6643-model-api</module>
+ <module>rfc6643-parser-support</module>
+
<!-- Metadata (annotation) metamodel support -->
<module>rfc7952-data-api</module>
<module>rfc7952-data-util</module>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2020 PANTHEON.tech, s.r.o. 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
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>bundle-parent</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ <relativePath>../../bundle-parent</relativePath>
+ </parent>
+
+ <artifactId>rfc6643-model-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>${project.artifactId}</name>
+ <description>RFC6643 extensions for SMIv2</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>concepts</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-model-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>org.opendaylight.yangtools.rfc6643.model.api</Automatic-Module-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface AliasEffectiveStatement extends EffectiveStatement<String, AliasStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.ALIAS;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface AliasSchemaNode extends UnknownSchemaNode {
+
+ String getArgument();
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.DocumentedDeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface AliasStatement extends UnknownStatement<String>, DocumentedDeclaredStatement.WithStatus<String> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.ALIAS;
+ }
+
+ default @NonNull OidStatement getOidStatement() {
+ return findFirstDeclaredSubstatement(OidStatement.class).orElseThrow();
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface DefValEffectiveStatement extends EffectiveStatement<String, DefValStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.DEFVAL;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface DefValSchemaNode extends UnknownSchemaNode {
+
+ String getArgument();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface DefValStatement extends UnknownStatement<String> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.DEFVAL;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface DisplayHintEffectiveStatement extends EffectiveStatement<String, DisplayHintStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.DISPLAY_HINT;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface DisplayHintSchemaNode extends UnknownSchemaNode {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface DisplayHintStatement extends UnknownStatement<String> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.DISPLAY_HINT;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import java.net.URI;
+import java.util.Collection;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+
+@Beta
+public final class IetfYangSmiv2Constants {
+ private static final String MODULE_NAME = "ietf-yang-smiv2";
+ private static final URI MODULE_NAMESPACE = URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-smiv2");
+ private static final Revision RFC6643_REVISION = Revision.of("2012-06-22");
+
+ /**
+ * Runtime RFC6643 identity.
+ */
+ public static final QNameModule RFC6643_MODULE = QNameModule.create(MODULE_NAMESPACE, RFC6643_REVISION).intern();
+
+ /**
+ * RFC6643 model source name.
+ */
+ public static final SourceIdentifier RFC6643_SOURCE = RevisionSourceIdentifier.create(MODULE_NAME,
+ RFC6643_REVISION);
+
+ /**
+ * Normative prefix to use when importing {@link #RFC6643_SOURCE}.
+ */
+ public static final String MODULE_PREFIX = "smiv2";
+
+ /**
+ * Return identifiers of all sources known to define NACM extension.
+ *
+ * @return Collection of identifiers.
+ */
+ public static Collection<SourceIdentifier> knownModelSources() {
+ return ImmutableList.of(RFC6643_SOURCE);
+ }
+
+ private IetfYangSmiv2Constants() {
+ // Hidden on purpose
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.ArgumentDefinition;
+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.StatementDefinition;
+
+@Beta
+public enum IetfYangSmiv2ExtensionsMapping implements StatementDefinition {
+ DISPLAY_HINT(DisplayHintStatement.class, DisplayHintEffectiveStatement.class, "display-hint", "format"),
+ MAX_ACCESS(MaxAccessStatement.class, MaxAccessEffectiveStatement.class, "max-access", "access"),
+ DEFVAL(DefValStatement.class, DefValEffectiveStatement.class, "defval", "value"),
+ IMPLIED(ImpliedStatement.class, ImpliedEffectiveStatement.class, "implied", "index"),
+ SUB_ID(SubIdStatement.class, SubIdEffectiveStatement.class, "subid", "value"),
+ OBJECT_ID(OidStatement.class, OidEffectiveStatement.class, "oid", "value"),
+ ALIAS(AliasStatement.class, AliasEffectiveStatement.class, "alias", "descriptor");
+
+ private final @NonNull Class<? extends DeclaredStatement<?>> type;
+ private final @NonNull Class<? extends EffectiveStatement<?, ?>> effectiveType;
+ private final @NonNull QName name;
+ private final @NonNull ArgumentDefinition argument;
+
+ IetfYangSmiv2ExtensionsMapping(final Class<? extends DeclaredStatement<?>> declared,
+ final Class<? extends EffectiveStatement<?, ?>> effective, final String nameStr,
+ final String argumentStr) {
+ type = requireNonNull(declared);
+ effectiveType = requireNonNull(effective);
+ name = createQName(nameStr);
+ argument = ArgumentDefinition.of(createQName(argumentStr), false);
+ }
+
+ private static @NonNull QName createQName(final String localName) {
+ return QName.create(IetfYangSmiv2Constants.RFC6643_MODULE, localName).intern();
+ }
+
+ @Override
+ public QName getStatementName() {
+ return name;
+ }
+
+ @Override
+ public Optional<ArgumentDefinition> getArgumentDefinition() {
+ return Optional.of(argument);
+ }
+
+ @Override
+ public Class<? extends DeclaredStatement<?>> getDeclaredRepresentationClass() {
+ return type;
+ }
+
+ @Override
+ public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
+ return effectiveType;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface ImpliedEffectiveStatement extends EffectiveStatement<String, ImpliedStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.IMPLIED;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface ImpliedSchemaNode extends UnknownSchemaNode {
+
+ String getArgument();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface ImpliedStatement extends UnknownStatement<String> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.IMPLIED;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface MaxAccessEffectiveStatement extends EffectiveStatement<String, MaxAccessStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.MAX_ACCESS;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface MaxAccessSchemaNode extends UnknownSchemaNode {
+
+ String getArgument();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface MaxAccessStatement extends UnknownStatement<String> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.MAX_ACCESS;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import com.google.common.annotations.Beta;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.regex.Pattern;
+import java.util.stream.IntStream;
+import org.checkerframework.checker.regex.qual.Regex;
+import org.opendaylight.yangtools.concepts.Identifier;
+import org.opendaylight.yangtools.concepts.WritableObject;
+
+/**
+ * An OID, or ObjectIdentifier, as defined by ITU and ISO/IEC.
+ */
+// TODO: this class could also be Comparable<ObjectIdentifier>
+@Beta
+public final class ObjectIdentifier implements Identifier, WritableObject {
+ private static final long serialVersionUID = 1L;
+ @Regex
+ private static final String CHECK_OID_REGEX = "^\\d+(\\.\\d+)*$";
+ private static final Pattern CHECK_OID_PATTERN = Pattern.compile(CHECK_OID_REGEX);
+ private static final Pattern SPLIT_PATTERN = Pattern.compile(".", Pattern.LITERAL);
+
+ private final int[] components;
+
+ private ObjectIdentifier(final int[] components) {
+ this.components = components;
+ }
+
+ /**
+ * Create an {@link ObjectIdentifier} from its integer components.
+ *
+ * @param components OID items
+ * @return An ObjectIdentifier.
+ */
+ public static ObjectIdentifier forComponents(final int... components) {
+ return new ObjectIdentifier(components.clone());
+ }
+
+ /**
+ * Create an {@link ObjectIdentifier} from its string representation.
+ *
+ * @param str String OID representation.
+ * @return An ObjectIdentifier.
+ */
+ public static ObjectIdentifier forString(final String str) {
+ return new ObjectIdentifier(parseObjectId(str));
+ }
+
+ public int[] getComponents() {
+ // Always make a defensive copy
+ return components.clone();
+ }
+
+ public IntStream streamComponents() {
+ return Arrays.stream(components);
+ }
+
+ /**
+ * Read an {@link ObjectIdentifier} from a DataInput, performing the inverse of {@link #writeTo(DataOutput)}. For
+ * details see {@link WritableObject}.
+ *
+ * @param in Data input
+ * @return Object identifier
+ * @throws IOException If an I/O error is reported
+ */
+ public static ObjectIdentifier readFrom(final DataInput in) throws IOException {
+ final int count = in.readInt();
+ checkArgument(count >= 0, "Illegal item count");
+
+ final int[] oid = new int[count];
+ for (int index = 0; index < count; ++index) {
+ oid[index] = in.readInt();
+ }
+
+ return new ObjectIdentifier(oid);
+ }
+
+ @Override
+ public void writeTo(final DataOutput out) throws IOException {
+ out.writeInt(components.length);
+ for (int i : components) {
+ out.writeInt(i);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(components);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return this == obj || obj instanceof ObjectIdentifier
+ && Arrays.equals(components, ((ObjectIdentifier) obj).components);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append(components[0]);
+ for (int index = 1; index < components.length; index++) {
+ stringBuilder.append('.').append(components[index]);
+ }
+ return stringBuilder.toString();
+ }
+
+ private static int[] parseObjectId(final String objectId) {
+ checkArgument(CHECK_OID_PATTERN.matcher(objectId).matches(), "Wrong format for OID: '%s'", objectId);
+
+ final String[] splitOid = SPLIT_PATTERN.split(objectId);
+ final int[] oid = new int[splitOid.length];
+ for (int index = 0; index < splitOid.length; index ++) {
+ oid[index] = Integer.parseInt(splitOid[index]);
+ }
+ return oid;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface OidEffectiveStatement extends EffectiveStatement<ObjectIdentifier, OidStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.OBJECT_ID;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface OidSchemaNode extends UnknownSchemaNode {
+
+ ObjectIdentifier getArgument();
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import static com.google.common.base.Verify.verifyNotNull;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface OidStatement extends UnknownStatement<ObjectIdentifier> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.OBJECT_ID;
+ }
+
+ default ObjectIdentifier getOid() {
+ return verifyNotNull(argument());
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+
+@Beta
+public interface SubIdEffectiveStatement extends EffectiveStatement<Integer, SubIdStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.SUB_ID;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+@Beta
+public interface SubIdSchemaNode extends UnknownSchemaNode {
+
+ int getArgument();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.model.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+@Beta
+public interface SubIdStatement extends UnknownStatement<Integer> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return IetfYangSmiv2ExtensionsMapping.SUB_ID;
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2020 PANTHEON.tech, s.r.o. 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
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>bundle-parent</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ <relativePath>../../bundle-parent</relativePath>
+ </parent>
+
+ <artifactId>rfc6643-parser-support</artifactId>
+ <packaging>bundle</packaging>
+ <name>${project.artifactId}</name>
+ <description>RFC6643 parser support</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>concepts</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-model-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-parser-rfc7950</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-xpath-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>org.opendaylight.yangtools.rfc6643.parser.support</Automatic-Module-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class AliasEffectiveStatementImpl extends UnknownEffectiveStatementBase<String, AliasStatement>
+ implements AliasEffectiveStatement, AliasSchemaNode {
+ private final SchemaPath path;
+
+ AliasEffectiveStatementImpl(final StmtContext<String, AliasStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public String getArgument() {
+ return argument();
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final AliasEffectiveStatementImpl other = (AliasEffectiveStatementImpl) 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawStringArgument.WithSubstatements;
+
+final class AliasStatementImpl extends WithSubstatements implements AliasStatement {
+ AliasStatementImpl(final String rawArgument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(rawArgument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
+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.meta.SubstatementValidator;
+
+@Beta
+public final class AliasStatementSupport
+ extends BaseStringStatementSupport<AliasStatement, AliasEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.ALIAS)
+ .add(YangStmtMapping.DESCRIPTION, 0, 1)
+ .add(YangStmtMapping.REFERENCE, 0, 1)
+ .add(YangStmtMapping.STATUS, 0, 1)
+ .add(IetfYangSmiv2ExtensionsMapping.OBJECT_ID, 0, 1)
+ .build();
+ private static final AliasStatementSupport INSTANCE = new AliasStatementSupport();
+
+ private AliasStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.ALIAS);
+ }
+
+ public static AliasStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(final Mutable<String, AliasStatement, AliasEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ getSubstatementValidator().validate(stmt);
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected AliasStatement createDeclared(final StmtContext<String, AliasStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new AliasStatementImpl(ctx.coerceRawStatementArgument(), substatements);
+ }
+
+ @Override
+ protected AliasStatement createEmptyDeclared(final StmtContext<String, AliasStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected AliasEffectiveStatement createEffective(
+ final StmtContext<String, AliasStatement, AliasEffectiveStatement> ctx, final AliasStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new AliasEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected AliasEffectiveStatement createEmptyEffective(
+ final StmtContext<String, AliasStatement, AliasEffectiveStatement> ctx, final AliasStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class DefValEffectiveStatementImpl extends UnknownEffectiveStatementBase<String, DefValStatement>
+ implements DefValEffectiveStatement, DefValSchemaNode {
+
+ private final SchemaPath path;
+
+ DefValEffectiveStatementImpl(final StmtContext<String, DefValStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public String getArgument() {
+ return argument();
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DefValEffectiveStatementImpl other = (DefValEffectiveStatementImpl) 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawStringArgument.WithSubstatements;
+
+final class DefValStatementImpl extends WithSubstatements implements DefValStatement {
+ DefValStatementImpl(final String rawArgument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(rawArgument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
+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.meta.SubstatementValidator;
+
+@Beta
+public final class DefValStatementSupport
+ extends BaseStringStatementSupport<DefValStatement, DefValEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.DEFVAL).build();
+ private static final DefValStatementSupport INSTANCE = new DefValStatementSupport();
+
+ private DefValStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.DEFVAL);
+ }
+
+ public static DefValStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(final Mutable<String, DefValStatement, DefValEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected DefValStatement createDeclared(final StmtContext<String, DefValStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new DefValStatementImpl(ctx.coerceRawStatementArgument(), substatements);
+ }
+
+ @Override
+ protected DefValStatement createEmptyDeclared(final StmtContext<String, DefValStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected DefValEffectiveStatement createEffective(
+ final StmtContext<String, DefValStatement, DefValEffectiveStatement> ctx, final DefValStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new DefValEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected DefValEffectiveStatement createEmptyEffective(
+ final StmtContext<String, DefValStatement, DefValEffectiveStatement> ctx, final DefValStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class DisplayHintEffectiveStatementImpl extends UnknownEffectiveStatementBase<String, DisplayHintStatement>
+ implements DisplayHintEffectiveStatement, DisplayHintSchemaNode {
+ private final SchemaPath path;
+
+ DisplayHintEffectiveStatementImpl(final StmtContext<String, DisplayHintStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DisplayHintEffectiveStatementImpl other = (DisplayHintEffectiveStatementImpl) 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawStringArgument.WithSubstatements;
+
+final class DisplayHintStatementImpl extends WithSubstatements implements DisplayHintStatement {
+ DisplayHintStatementImpl(final String rawArgument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(rawArgument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.DisplayHintStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
+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.meta.SubstatementValidator;
+
+@Beta
+public final class DisplayHintStatementSupport
+ extends BaseStringStatementSupport<DisplayHintStatement, DisplayHintEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.DISPLAY_HINT).build();
+ private static final DisplayHintStatementSupport INSTANCE = new DisplayHintStatementSupport();
+
+ private DisplayHintStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.DISPLAY_HINT);
+ }
+
+ public static DisplayHintStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(
+ final Mutable<String, DisplayHintStatement, DisplayHintEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected DisplayHintStatement createDeclared(final StmtContext<String, DisplayHintStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new DisplayHintStatementImpl(ctx.coerceRawStatementArgument(), substatements);
+ }
+
+ @Override
+ protected DisplayHintStatement createEmptyDeclared(final StmtContext<String, DisplayHintStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected DisplayHintEffectiveStatement createEffective(
+ final StmtContext<String, DisplayHintStatement, DisplayHintEffectiveStatement> ctx,
+ final DisplayHintStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new DisplayHintEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected DisplayHintEffectiveStatement createEmptyEffective(
+ final StmtContext<String, DisplayHintStatement, DisplayHintEffectiveStatement> ctx,
+ final DisplayHintStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+@Beta
+public interface IetfYangSmiv2Namespace extends IdentifierNamespace<StmtContext<?, ?, ?>, String> {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class ImpliedEffectiveStatementImpl extends UnknownEffectiveStatementBase<String, ImpliedStatement>
+ implements ImpliedEffectiveStatement, ImpliedSchemaNode {
+
+ private final SchemaPath path;
+
+ ImpliedEffectiveStatementImpl(final StmtContext<String, ImpliedStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public String getArgument() {
+ return argument();
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final ImpliedEffectiveStatementImpl other = (ImpliedEffectiveStatementImpl) 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawStringArgument.WithSubstatements;
+
+final class ImpliedStatementImpl extends WithSubstatements implements ImpliedStatement {
+ ImpliedStatementImpl(final String rawArgument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(rawArgument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
+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.meta.SubstatementValidator;
+
+@Beta
+public final class ImpliedStatementSupport
+ extends BaseStringStatementSupport<ImpliedStatement, ImpliedEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.IMPLIED).build();
+ private static final ImpliedStatementSupport INSTANCE = new ImpliedStatementSupport();
+
+ private ImpliedStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.IMPLIED);
+ }
+
+ public static ImpliedStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(final Mutable<String, ImpliedStatement, ImpliedEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected ImpliedStatement createDeclared(final StmtContext<String, ImpliedStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new ImpliedStatementImpl(ctx.coerceRawStatementArgument(), substatements);
+ }
+
+ @Override
+ protected ImpliedStatement createEmptyDeclared(final StmtContext<String, ImpliedStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected ImpliedEffectiveStatement createEffective(
+ final StmtContext<String, ImpliedStatement, ImpliedEffectiveStatement> ctx,
+ final ImpliedStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new ImpliedEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected ImpliedEffectiveStatement createEmptyEffective(
+ final StmtContext<String, ImpliedStatement, ImpliedEffectiveStatement> ctx,
+ final ImpliedStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class MaxAccessEffectiveStatementImpl extends UnknownEffectiveStatementBase<String, MaxAccessStatement>
+ implements MaxAccessEffectiveStatement, MaxAccessSchemaNode {
+ private final SchemaPath path;
+
+ MaxAccessEffectiveStatementImpl(final StmtContext<String, MaxAccessStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public String getArgument() {
+ return argument();
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final MaxAccessEffectiveStatementImpl other = (MaxAccessEffectiveStatementImpl) 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawStringArgument.WithSubstatements;
+
+final class MaxAccessStatementImpl extends WithSubstatements implements MaxAccessStatement {
+ MaxAccessStatementImpl(final String rawArgument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(rawArgument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
+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.meta.SubstatementValidator;
+
+@Beta
+public final class MaxAccessStatementSupport
+ extends BaseStringStatementSupport<MaxAccessStatement, MaxAccessEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.MAX_ACCESS).build();
+ private static final MaxAccessStatementSupport INSTANCE = new MaxAccessStatementSupport();
+
+ private MaxAccessStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.MAX_ACCESS);
+ }
+
+ public static MaxAccessStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(final Mutable<String, MaxAccessStatement, MaxAccessEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected MaxAccessStatement createDeclared(final StmtContext<String, MaxAccessStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new MaxAccessStatementImpl(ctx.coerceRawStatementArgument(), substatements);
+ }
+
+ @Override
+ protected MaxAccessStatement createEmptyDeclared(final StmtContext<String, MaxAccessStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected MaxAccessEffectiveStatement createEffective(
+ final StmtContext<String, MaxAccessStatement, MaxAccessEffectiveStatement> ctx,
+ final MaxAccessStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new MaxAccessEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected MaxAccessEffectiveStatement createEmptyEffective(
+ final StmtContext<String, MaxAccessStatement, MaxAccessEffectiveStatement> ctx,
+ final MaxAccessStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.ObjectIdentifier;
+import org.opendaylight.yangtools.rfc6643.model.api.OidEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.OidSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.OidStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class OidEffectiveStatementImpl extends UnknownEffectiveStatementBase<ObjectIdentifier, OidStatement>
+ implements OidEffectiveStatement, OidSchemaNode {
+
+ private final SchemaPath path;
+
+ OidEffectiveStatementImpl(final StmtContext<ObjectIdentifier, OidStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public ObjectIdentifier getArgument() {
+ return argument();
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final OidEffectiveStatementImpl other = (OidEffectiveStatementImpl) 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;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.ObjectIdentifier;
+import org.opendaylight.yangtools.rfc6643.model.api.OidStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.ArgumentToString.WithSubstatements;
+
+final class OidIdStatementImpl extends WithSubstatements<ObjectIdentifier> implements OidStatement {
+ OidIdStatementImpl(final ObjectIdentifier argument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(argument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.rfc6643.model.api.ObjectIdentifier;
+import org.opendaylight.yangtools.rfc6643.model.api.OidEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.OidStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
+
+@Beta
+public final class OidStatementSupport
+ extends BaseStatementSupport<ObjectIdentifier, OidStatement, OidEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.OBJECT_ID).build();
+ private static final OidStatementSupport INSTANCE = new OidStatementSupport();
+
+ private OidStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.OBJECT_ID);
+ }
+
+ public static OidStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public ObjectIdentifier parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
+ return ObjectIdentifier.forString(value);
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(
+ final StmtContext.Mutable<ObjectIdentifier, OidStatement, OidEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected OidStatement createDeclared(final StmtContext<ObjectIdentifier, OidStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new OidIdStatementImpl(ctx.coerceStatementArgument(), substatements);
+ }
+
+ @Override
+ protected OidStatement createEmptyDeclared(final StmtContext<ObjectIdentifier, OidStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected OidEffectiveStatement createEffective(
+ final StmtContext<ObjectIdentifier, OidStatement, OidEffectiveStatement> ctx,
+ final OidStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new OidEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected OidEffectiveStatement createEmptyEffective(
+ final StmtContext<ObjectIdentifier, OidStatement, OidEffectiveStatement> ctx, final OidStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Objects;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdStatement;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class SubIdEffectiveStatementImpl extends UnknownEffectiveStatementBase<Integer, SubIdStatement>
+ implements SubIdEffectiveStatement, SubIdSchemaNode {
+
+ private final SchemaPath path;
+
+ SubIdEffectiveStatementImpl(final StmtContext<Integer, SubIdStatement, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(ctx, substatements);
+ path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+ }
+
+ @Override
+ public int getArgument() {
+ return argument().intValue();
+ }
+
+ @Override
+ public QName getQName() {
+ return getNodeType();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, getNodeType(), getNodeParameter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final SubIdEffectiveStatementImpl other = (SubIdEffectiveStatementImpl) 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.ArgumentToString.WithSubstatements;
+
+final class SubIdStatementImpl extends WithSubstatements<Integer> implements SubIdStatement {
+ SubIdStatementImpl(final Integer argument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(argument, substatements);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
+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.meta.SubstatementValidator;
+
+@Beta
+public final class SubIdStatementSupport
+ extends BaseStatementSupport<Integer, SubIdStatement, SubIdEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.SUB_ID).build();
+ private static final SubIdStatementSupport INSTANCE = new SubIdStatementSupport();
+
+ private SubIdStatementSupport() {
+ super(IetfYangSmiv2ExtensionsMapping.SUB_ID);
+ }
+
+ public static SubIdStatementSupport getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public Integer parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
+ return Integer.parseUnsignedInt(value);
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(final Mutable<Integer, SubIdStatement, SubIdEffectiveStatement> stmt) {
+ stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
+ }
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
+
+ @Override
+ protected SubIdStatement createDeclared(final StmtContext<Integer, SubIdStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new SubIdStatementImpl(ctx.coerceStatementArgument(), substatements);
+ }
+
+ @Override
+ protected SubIdStatement createEmptyDeclared(final StmtContext<Integer, SubIdStatement, ?> ctx) {
+ return createDeclared(ctx, ImmutableList.of());
+ }
+
+ @Override
+ protected SubIdEffectiveStatement createEffective(
+ final StmtContext<Integer, SubIdStatement, SubIdEffectiveStatement> ctx,
+ final SubIdStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new SubIdEffectiveStatementImpl(ctx, substatements);
+ }
+
+ @Override
+ protected SubIdEffectiveStatement createEmptyEffective(
+ final StmtContext<Integer, SubIdStatement, SubIdEffectiveStatement> ctx, final SubIdStatement declared) {
+ return createEffective(ctx, declared, ImmutableList.of());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.sourceLocal;
+
+import java.io.IOException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.DefValSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.ImpliedSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.ObjectIdentifier;
+import org.opendaylight.yangtools.rfc6643.model.api.OidSchemaNode;
+import org.opendaylight.yangtools.rfc6643.model.api.SubIdSchemaNode;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors;
+import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+
+public class IetfYangSmiv2ExtensionPluginTest {
+ private static final String NS = "urn:opendaylight:yang:extension:third-party";
+ private static final String REV = "2016-06-09";
+
+ private static CrossSourceStatementReactor reactor;
+
+ @BeforeClass
+ public static void createReactor() {
+ reactor = RFC7950Reactors.defaultReactorBuilder()
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, DisplayHintStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, MaxAccessStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, DefValStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, ImpliedStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, AliasStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, OidStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, SubIdStatementSupport.getInstance())
+ .addNamespaceSupport(ModelProcessingPhase.FULL_DECLARATION, sourceLocal(IetfYangSmiv2Namespace.class))
+ .build();
+ }
+
+ @AfterClass
+ public static void freeReactor() {
+ reactor = null;
+ }
+
+ @Test
+ public void testExtensions() throws ReactorException, YangSyntaxErrorException, IOException {
+ SchemaContext schema = createSchema();
+
+ assertTrue(schema.getUnknownSchemaNodes().size() == 1);
+ AliasSchemaNode aliasExtEffectStmt = (AliasSchemaNode) schema.getUnknownSchemaNodes().iterator().next();
+ assertEquals(aliasExtEffectStmt.getArgument(), "ifXTable");
+ assertTrue(aliasExtEffectStmt.getUnknownSchemaNodes().size() == 1);
+ OidSchemaNode oidExtEffectStmt = (OidSchemaNode) aliasExtEffectStmt.getUnknownSchemaNodes().iterator().next();
+ assertEquals(oidExtEffectStmt.getArgument().toString(), "1.3.6.1.2.1.31.1.1");
+
+ final DataSchemaNode dataChildByName = schema.getDataChildByName(QName.create(NS, REV, "root"));
+ assertTrue(dataChildByName instanceof ContainerSchemaNode);
+ final ContainerSchemaNode root = (ContainerSchemaNode) dataChildByName;
+ assertTrue(root.getUnknownSchemaNodes().size() == 1);
+ OidSchemaNode oid = (OidSchemaNode) root.getUnknownSchemaNodes().iterator().next();
+ assertEquals(oid.getArgument().toString(), "1");
+
+ ListSchemaNode ifStackEntry = (ListSchemaNode) root.getDataChildByName(QName.create(NS, REV, "ifStackEntry"));
+ assertTrue(ifStackEntry.getUnknownSchemaNodes().size() == 2);
+ ifStackEntry.getUnknownSchemaNodes().forEach(unknownSchemaNode -> {
+ if (unknownSchemaNode instanceof OidSchemaNode) {
+ assertEquals(((OidSchemaNode) unknownSchemaNode).getArgument().toString(),
+ ObjectIdentifier.forString("1.1").toString());
+ } else if (unknownSchemaNode instanceof ImpliedSchemaNode) {
+ assertEquals(((ImpliedSchemaNode) unknownSchemaNode).getArgument(), "ifStackHigherLayer");
+ }
+ });
+
+ LeafSchemaNode ifStackHigherLayer = (LeafSchemaNode)
+ ifStackEntry.getDataChildByName(QName.create(NS, REV, "ifStackHigherLayer"));
+
+ ifStackHigherLayer.getUnknownSchemaNodes().forEach(unknownSchemaNode -> {
+ if (unknownSchemaNode instanceof MaxAccessSchemaNode) {
+ final MaxAccessSchemaNode maxAccess = (MaxAccessSchemaNode) unknownSchemaNode;
+ assertEquals(maxAccess.getArgument(), "not-accessible");
+ }
+ });
+
+ LeafSchemaNode testNumberLeaf = (LeafSchemaNode)
+ ifStackEntry.getDataChildByName(QName.create(NS, REV, "test-number"));
+ assertTrue(testNumberLeaf.getUnknownSchemaNodes().size() == 3);
+ testNumberLeaf.getUnknownSchemaNodes().forEach(unknownSchemaNode -> {
+ if (unknownSchemaNode instanceof SubIdSchemaNode) {
+ assertEquals(((SubIdSchemaNode) unknownSchemaNode).getArgument(), 2);
+ } else if (unknownSchemaNode instanceof DefValSchemaNode) {
+ assertEquals(((DefValSchemaNode) unknownSchemaNode).getArgument(), "0");
+ }
+ });
+ }
+
+ private static SchemaContext createSchema() throws ReactorException, YangSyntaxErrorException, IOException {
+ return reactor.newBuild()
+ .addSources(
+ YangStatementStreamSource.create(YangTextSchemaSource.forResource(
+ IetfYangSmiv2ExtensionPluginTest.class, "/foo.yang")),
+ YangStatementStreamSource.create(YangTextSchemaSource.forResource(
+ IetfYangSmiv2ExtensionPluginTest.class, "/ietf-yang-smiv2.yang")))
+ .buildEffective();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.rfc6643.model.api.AliasEffectiveStatement;
+import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
+
+public class IetfYangSmiv2ExtensionsMappingTest {
+ @Test
+ public void testGetEffectiveRepresentationClass() {
+ IetfYangSmiv2ExtensionsMapping extensionMapping = IetfYangSmiv2ExtensionsMapping.ALIAS;
+ assertEquals(extensionMapping.getEffectiveRepresentationClass(), AliasEffectiveStatement.class);
+ }
+
+ @Test
+ public void testIsArgumentYinElement() {
+ IetfYangSmiv2ExtensionsMapping extensionMapping = IetfYangSmiv2ExtensionsMapping.ALIAS;
+ assertFalse(extensionMapping.getArgumentDefinition().get().isYinElement());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015, 2020 PANTHEON.tech, s.r.o. 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.rfc6643.parser;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.rfc6643.model.api.ObjectIdentifier;
+
+public class ObjectIdentifierTest {
+ @Test(expected = IllegalArgumentException.class)
+ public void testObjectIdentifierCreationWithBadOID() {
+ ObjectIdentifier.forString("bad oid");
+ }
+}
--- /dev/null
+module foo {
+ namespace "urn:opendaylight:yang:extension:third-party";
+ prefix foo;
+ yang-version 1;
+
+ import ietf-yang-smiv2 { prefix "smiv2"; }
+
+ revision 2016-06-09;
+
+ typedef InterfaceIndexOrZero {
+ type int32 {
+ range "0..2147483647";
+ }
+ description
+ "This textual convention is an extension of the
+ InterfaceIndex convention. The latter defines a greater
+ than zero value used to identify an interface or interface
+ sub-layer in the managed system. This extension permits the
+ additional value of zero. the value zero is object-specific
+ and must therefore be defined as part of the description of
+ any object which uses this syntax. Examples of the usage of
+ zero might include situations where interface was unknown,
+ or when none or all interfaces need to be referenced.";
+ smiv2:display-hint "d";
+ }
+
+ container root {
+ smiv2:oid "1";
+
+ list ifStackEntry {
+ smiv2:oid "1.1";
+ smiv2:implied "ifStackHigherLayer";
+ key "ifStackHigherLayer";
+
+ leaf ifStackHigherLayer {
+ type foo:InterfaceIndexOrZero;
+ smiv2:max-access "not-accessible";
+ description "The value of ifIndex corresponding to the higher sub-layer
+ of the relationship, i.e., the sub-layer which runs on 'top'
+ of the sub-layer identified by the corresponding instance of
+ ifStackLowerLayer. If there is no higher sub-layer (below
+ the internetwork layer), then this object has the value 0.";
+ smiv2:oid "1.1.1";
+ }
+
+ leaf test-number {
+ type int32;
+ description "Test leaf;";
+ smiv2:max-access "not-accessible";
+ smiv2:subid "2";
+ smiv2:defval "0";
+ }
+ }
+ }
+
+ smiv2:alias "ifXTable" {
+ description "A list of interface entries. The number of entries is
+ given by the value of ifNumber. This table contains
+ additional objects for the interface table.";
+ smiv2:oid "1.3.6.1.2.1.31.1.1";
+ }
+
+
+}
--- /dev/null
+module ietf-yang-smiv2 {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-yang-smiv2";
+ prefix "smiv2";
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: David Kessens
+ <mailto:david.kessens@nsn.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>";
+
+ description
+ "This module defines YANG extensions that are used to translate
+ SMIv2 concepts into YANG.
+
+ Copyright (c) 2012 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 6643; see
+ the RFC itself for full legal notices.";
+
+ revision 2012-06-22 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 6643: Translation of Structure of Management Information
+ Version 2 (SMIv2) MIB Modules to YANG Modules";
+ }
+
+ identity object-identity {
+ description
+ "Base identity for all SMIv2 OBJECT-IDENTITYs.";
+ }
+
+ typedef opaque {
+ type binary;
+ description
+ "The Opaque type supports the capability to pass arbitrary ASN.1
+ syntax. A value is encoded using the ASN.1 Basic Encoding Rules
+ into a string of octets. This, in turn, is encoded as an OCTET
+ STRING, in effect 'double-wrapping' the original ASN.1 value.
+
+ In the value set and its semantics, this type is equivalent to
+ the Opaque type of the SMIv2. This type exists in the SMIv2
+ solely for backward-compatibility reasons and this is also
+ true for this YANG data type.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+ extension display-hint {
+ argument "format";
+ description
+ "The display-hint statement takes as an argument the DISPLAY-HINT
+ assigned to an SMIv2 textual convention.";
+ reference
+ "RFC 2579: Textual Conventions for SMIv2";
+ }
+
+ extension max-access {
+ argument "access";
+ description
+ "The max-access statement takes as an argument the MAX-ACCESS
+ assigned to an SMIv2 object definition.
+
+ The MAX-ACCESS value is SMIv2 specific and has no impact on
+ the access provided to YANG objects through protocols such
+ as NETCONF.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+ extension defval {
+ argument "value";
+ description
+ "The defval statement takes as an argument a default value
+ defined by an SMIv2 DEFVAL clause. Note that the value is in
+ the SMIv2 value space defined by the SMIv2 syntax of the
+ corresponding object and not in the YANG value space
+ defined by the corresponding YANG data type.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+ extension implied {
+ argument "index";
+ description
+ "If an SMIv2 INDEX object is preceded by the IMPLIED keyword, then
+ the implied statement is present in the YANG module and takes as
+ an argument the name of the IMPLIED index object.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+ extension alias {
+ argument "descriptor";
+ description
+ "The alias statement introduces an SMIv2 descriptor. The body of
+ the alias statement is expected to contain an oid statement that
+ provides the numeric OID associated with the descriptor.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+ extension oid {
+ argument "value";
+ description
+ "The oid statement takes as an argument the object identifier
+ assigned to an SMIv2 definition. The object identifier value
+ is written in decimal dotted notation.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+ extension subid {
+ argument "value";
+ description
+ "The subid statement takes as an argument the last sub-identifier
+ of the object identifier assigned to an SMIv2 definition. The
+ sub-identifier value is a single positive decimal natural number.
+ The subid statement may not be used as a substatement to any
+ top-level node in a YANG document. The subid substatement may
+ be used only as a substatement to a node having a parent node
+ defined with either an smiv2:oid or smiv2:subid substatement.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2 (SMIv2)";
+ }
+
+}
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc6536-parser-support</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-model-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc6643-parser-support</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc7952-model-api</artifactId>
*/
package org.opendaylight.yangtools.yang.parser.impl;
+import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.sourceLocal;
+
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.odlext.parser.AnyxmlSchemaLocationNamespace;
import org.opendaylight.yangtools.rfc6241.parser.GetFilterElementAttributesStatementSupport;
import org.opendaylight.yangtools.rfc6536.parser.DefaultDenyAllStatementSupport;
import org.opendaylight.yangtools.rfc6536.parser.DefaultDenyWriteStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.AliasStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.DefValStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.DisplayHintStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.IetfYangSmiv2Namespace;
+import org.opendaylight.yangtools.rfc6643.parser.ImpliedStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.MaxAccessStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.OidStatementSupport;
+import org.opendaylight.yangtools.rfc6643.parser.SubIdStatementSupport;
import org.opendaylight.yangtools.rfc7952.parser.AnnotationStatementSupport;
import org.opendaylight.yangtools.rfc8040.parser.YangDataStatementSupport;
import org.opendaylight.yangtools.rfc8528.parser.MountPointStatementSupport;
.addStatementSupport(ModelProcessingPhase.FULL_DECLARATION,
DefaultDenyWriteStatementSupport.getInstance())
+ // RFC6643 extensions
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, DisplayHintStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, MaxAccessStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, DefValStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, ImpliedStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, AliasStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, OidStatementSupport.getInstance())
+ .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, SubIdStatementSupport.getInstance())
+ .addNamespaceSupport(ModelProcessingPhase.FULL_DECLARATION, sourceLocal(IetfYangSmiv2Namespace.class))
+
// RFC7952 annotation support
.addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, AnnotationStatementSupport.getInstance())