<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>benchmarks</artifactId>
<properties>
- <yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
- <yang.maven.plugin.version>0.7.0-SNAPSHOT</yang.maven.plugin.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
+ <yang.maven.plugin.version>0.8.0-SNAPSHOT</yang.maven.plugin.version>
<java.source.version>1.7</java.source.version>
<java.target.version>1.7</java.target.version>
<jmh.version>0.9.7</jmh.version>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
«FOR c : consts»
«IF c.name == TypeConstants.PATTERN_CONSTANT_NAME && c.value instanceof List<?>»
- boolean valid = false;
for (Pattern p : patterns) {
- if (p.matcher(_value).matches()) {
- valid = true;
- break;
- }
+ «Preconditions.importedName».checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match any of the permitted patterns %s", _value, «TypeConstants.PATTERN_CONSTANT_NAME»);
}
- «Preconditions.importedName».checkArgument(valid, "Supplied value \"%s\" does not match any of the permitted patterns %s", _value, «TypeConstants.PATTERN_CONSTANT_NAME»);
«ENDIF»
«ENDFOR»
«ENDIF»
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>bundle-parent</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
- <yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
<salGeneratorPath>src/main/yang-gen-sal</salGeneratorPath>
</properties>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-sal-api-gen-plugin</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>maven-code-gen-sample</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-generator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>modeling-sample</artifactId>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-artifacts</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<!-- Model versions -->
- <ietf.topology.version>2013.10.21.7-SNAPSHOT</ietf.topology.version>
+ <ietf.topology.version>2013.10.21.8-SNAPSHOT</ietf.topology.version>
</properties>
<dependencyManagement>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>iana-if-type-2014-05-08</artifactId>
- <version>2014.05.08.7-SNAPSHOT</version>
+ <version>2014.05.08.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-inet-types</artifactId>
- <version>2010.09.24.7-SNAPSHOT</version>
+ <version>2010.09.24.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-yang-types</artifactId>
- <version>2010.09.24.7-SNAPSHOT</version>
+ <version>2010.09.24.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-yang-types-20130715</artifactId>
- <version>2013.07.15.7-SNAPSHOT</version>
+ <version>2013.07.15.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-interfaces</artifactId>
- <version>2014.05.08.7-SNAPSHOT</version>
+ <version>2014.05.08.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-restconf</artifactId>
- <version>2013.10.19.7-SNAPSHOT</version>
+ <version>2013.10.19.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>opendaylight-l2-types</artifactId>
- <version>2013.08.27.7-SNAPSHOT</version>
+ <version>2013.08.27.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>yang-ext</artifactId>
- <version>2013.09.07.7-SNAPSHOT</version>
+ <version>2013.09.07.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<artifactId>checkstyle-logging</artifactId>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
- <version>5.7</version>
+ <version>6.1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.xml.sax.InputSource;
-
import com.google.common.collect.Lists;
import com.puppycrawl.tools.checkstyle.Checker;
import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
import com.puppycrawl.tools.checkstyle.api.AuditListener;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.xml.sax.InputSource;
public class CheckstyleTest {
@Before
public void setup() throws CheckstyleException {
baos = new ByteArrayOutputStream();
- AuditListener listener = new DefaultLogger(baos, false);
+ final AuditListener listener = new DefaultLogger(baos, false);
- InputSource inputSource = new InputSource(CheckstyleTest.class.getClassLoader().getResourceAsStream(
+ final InputSource inputSource = new InputSource(CheckstyleTest.class.getClassLoader().getResourceAsStream(
"checkstyle-logging.xml"));
- Configuration configuration = ConfigurationLoader.loadConfiguration(inputSource,
+ final Configuration configuration = ConfigurationLoader.loadConfiguration(inputSource,
new PropertiesExpander(System.getProperties()), false);
checker = new Checker();
@Test
public void testCodingChecks() {
verify(CheckCodingStyleTestClass.class, false, "9: Line has Windows line delimiter.", "14: Wrong order for", "24:1: Line contains a tab character.",
- "22: Line has trailing spaces.", "22: ctor def child at indentation level 16 not at correct indentation, 8", "17:8: Unused import",
+ "22: Line has trailing spaces.", "22: 'ctor def' child have incorrect indentation level 16, expected level should be 8.", "17:8: Unused import",
"23: Line has trailing spaces.");
}
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>features-test</artifactId>
<relocation>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>features-test</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<message>This artifact has been migrated to odlparent and will be removed in Lithium release</message>
</relocation>
</distributionManagement>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>features-parent</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<relativePath/>
</parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>features-yangtools</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencyManagement>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<packaging>bundle</packaging>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<packaging>bundle</packaging>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<relativePath></relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yangtools-parent</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
- <yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
<!-- FIXME: these will be upstreamed -->
<maven.depends.version>1.2</maven.depends.version>
<plugin>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-maven-plugin</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<packaging>bundle</packaging>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-binding</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-common</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<artifactId>yangtools-parent</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<artifactId>yangtools-parent</artifactId>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<artifactId>model-iana</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>iana-afn-safi</artifactId>
- <version>2013.07.04.7-SNAPSHOT</version>
+ <version>2013.07.04.8-SNAPSHOT</version>
<build>
<plugins>
<parent>
<artifactId>model-iana</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>iana-if-type-2014-05-08</artifactId>
- <version>2014.05.08.7-SNAPSHOT</version>
+ <version>2014.05.08.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-iana</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>iana-if-type</artifactId>
- <version>2013.07.04.7-SNAPSHOT</version>
+ <version>2013.07.04.8-SNAPSHOT</version>
<build>
<plugins>
<parent>
<artifactId>model-parent</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-inet-types</artifactId>
- <version>2010.09.24.7-SNAPSHOT</version>
+ <version>2010.09.24.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
@Test
public void testGetDefaultInstanceIpv4() throws Exception {
- Host host = HostBuilder.getDefaultInstance("127.0.0.1");
+ final Host host = HostBuilder.getDefaultInstance("127.0.0.1");
assertEquals(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))), host);
}
@Test
public void testGetDefaultInstanceIpv6() throws Exception {
- testIpv6("2001:db8:8s5a3:0:0:8a2e:370:7334");
- testIpv6("2001:db8:85a3::8a2e:370:7334");
+ testIpv6("1234:5678:9abc:def1:2345:6789:abcd:ef12");
}
private void testIpv6(final String ivp6string) {
- Host host = HostBuilder.getDefaultInstance(ivp6string);
+ final Host host = HostBuilder.getDefaultInstance(ivp6string);
assertEquals(new Host(new IpAddress(new Ipv6Address(ivp6string))), host);
}
@Test
public void testGetDefaultInstanceDomain() throws Exception {
- Host host = HostBuilder.getDefaultInstance("localhost");
+ final Host host = HostBuilder.getDefaultInstance("localhost");
assertEquals(new Host(new DomainName("localhost")), host);
}
}
\ No newline at end of file
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-interfaces</artifactId>
- <version>2014.05.08.7-SNAPSHOT</version>
+ <version>2014.05.08.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-restconf</artifactId>
- <version>2013.10.19.7-SNAPSHOT</version>
+ <version>2013.10.19.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-ted</artifactId>
- <version>2013.10.21.7-SNAPSHOT</version>
+ <version>2013.10.21.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-topology-isis</artifactId>
- <version>2013.10.21.7-SNAPSHOT</version>
+ <version>2013.10.21.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-topology-l3-unicast-igp</artifactId>
- <version>2013.10.21.7-SNAPSHOT</version>
+ <version>2013.10.21.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-topology-ospf</artifactId>
- <version>2013.10.21.7-SNAPSHOT</version>
+ <version>2013.10.21.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-topology</artifactId>
- <version>2013.10.21.7-SNAPSHOT</version>
+ <version>2013.10.21.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-yang-types-20130715</artifactId>
- <version>2013.07.15.7-SNAPSHOT</version>
+ <version>2013.07.15.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-ietf</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ietf-yang-types</artifactId>
- <version>2010.09.24.7-SNAPSHOT</version>
+ <version>2010.09.24.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<artifactId>model-parent</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>model-parent</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>opendaylight-l2-types</artifactId>
- <version>2013.08.27.7-SNAPSHOT</version>
+ <version>2013.08.27.8-SNAPSHOT</version>
<build>
<plugins>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<groupId>org.opendaylight.yangtools.model</groupId>
- <!--<version>0.7.0-SNAPSHOT</version>-->
+ <!--<version>0.8.0-SNAPSHOT</version>-->
<modelVersion>4.0.0</modelVersion>
<artifactId>model-parent</artifactId>
<packaging>pom</packaging>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<parent>
<artifactId>model-parent</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yang-ext</artifactId>
- <version>2013.09.07.7-SNAPSHOT</version>
+ <version>2013.09.07.8-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>common/parent</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>restconf-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>restconf-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>restconf-client-impl</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>restconf-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>restconf-common</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>restconf-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>restconf-jaxrs-api</artifactId>
<name>restconf-jaxrs-api</name>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>restconf-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>restconf-test-service</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>restconf-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>restconf-util</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>third-party-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-aggregator</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>yang-validation-tool</artifactId>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>../common/parent</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
return delegate.getInput();
case "output":
return delegate.getOutput();
+ default:
+ return null;
}
- return null;
}
@Override
@Override
public Collection<DataSchemaNode> getChildNodes() {
- final ArrayList<DataSchemaNode> ret = new ArrayList<>();
+ final List<DataSchemaNode> ret = new ArrayList<>();
final ContainerSchemaNode input = getInput();
final ContainerSchemaNode output = getOutput();
if(input != null) {
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
import com.google.common.base.MoreObjects.ToStringHelper;
+// FIXME: are attributes part of hashCode/equals?
public abstract class AbstractImmutableDataContainerAttrNode<K extends YangInstanceIdentifier.PathArgument>
extends AbstractImmutableDataContainerNode<K>
implements AttributesContainer {
return super.addToStringAttributes(toStringHelper).add("attributes", attributes);
}
-// FIXME: are attributes part of hashCode/equals?
-// @Override
-// protected int valueHashCode() {
-// int result = super.valueHashCode();
-// for (final Entry<?, ?> a : attributes.entrySet()) {
-// result = 31 * result + a.hashCode();
-// }
-// return result;
-// }
-
- // FIXME: are attributes part of hashCode/equals?
-// @Override
-// protected boolean valueEquals(final NormalizedNode<?, ?> other) {
-// if (!super.valueEquals(other)) {
-// return false;
-// }
-// final Set<Entry<QName, String>> tas = getAttributes().entrySet();
-// final Set<Entry<QName, String>> oas = container.getAttributes().entrySet();
-//
-// return tas.containsAll(oas) && oas.containsAll(tas);
-// return true;
-// }
}
@Override
protected int valueHashCode() {
final int result = getValue() != null ? getValue().hashCode() : 1;
-// FIXME: are attributes part of hashCode/equals?
-// for (final Entry<?, ?> a : attributes.entrySet()) {
-// result = 31 * result + a.hashCode();
-// }
+ // FIXME: are attributes part of hashCode/equals?
return result;
}
}
// FIXME: are attributes part of hashCode/equals?
- // final Set<Entry<QName, String>> tas = getAttributes().entrySet();
- // final Set<Entry<QName, String>> oas =
- // container.getAttributes().entrySet();
- //
- // return tas.containsAll(oas) && oas.containsAll(tas);
return true;
}
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
private final QName argument;
private final boolean yinElement;
- private Rfc6020Mapping(Class<? extends DeclaredStatement<?>> clz, final String nameStr) {
+ Rfc6020Mapping(Class<? extends DeclaredStatement<?>> clz, final String nameStr) {
type = Preconditions.checkNotNull(clz);
name = yinQName(nameStr);
argument = null;
yinElement = false;
}
- private Rfc6020Mapping(Class<? extends DeclaredStatement<?>> clz, final String nameStr, final String argumentStr) {
+ Rfc6020Mapping(Class<? extends DeclaredStatement<?>> clz, final String nameStr, final String argumentStr) {
type = Preconditions.checkNotNull(clz);
name = yinQName(nameStr);
argument = yinQName(argumentStr);
this.yinElement = false;
}
- private Rfc6020Mapping(Class<? extends DeclaredStatement<?>> clz, final String nameStr, final String argumentStr,
+ Rfc6020Mapping(Class<? extends DeclaredStatement<?>> clz, final String nameStr, final String argumentStr,
final boolean yinElement) {
type = Preconditions.checkNotNull(clz);
name = yinQName(nameStr);
@Rfc6020AbnfRule("leafref-specification")
interface LeafrefSpecification extends TypeStatement {
- @Nullable PathStatement getPath();
+ @Nonnull PathStatement getPath();
}
+ @Rfc6020AbnfRule("instanceidentifier-specification")
interface InstanceIdentifierSpecification extends TypeStatement {
@Nullable RequireInstanceStatement getRequireInstance();
}
-
+ @Rfc6020AbnfRule("identityref-specification")
interface IdentityRefSpecification extends TypeStatement {
+ @Nonnull BaseStatement getBase();
+
}
+
+ @Rfc6020AbnfRule("bits-specification")
interface BitsSpecification extends TypeStatement {
@Nonnull Collection<? extends BitStatement> getBits();
}
+ @Rfc6020AbnfRule("union-specification")
interface UnionSpecification extends TypeStatement {
@Nonnull Collection<? extends TypeStatement> getTypes();
}
+
+ @Rfc6020AbnfRule("binary-specification")
+ interface BinarySpecification extends TypeStatement {
+
+ @Nullable LengthStatement getLength();
+ }
}
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>bundle-parent</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<relativePath/>
</parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-model-parent</artifactId>
<packaging>pom</packaging>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<properties>
- <yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
</properties>
<dependencyManagement>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>0.8.0-SNAPSHOT</version>
<relativePath>/../../common/parent/pom.xml</relativePath>
</parent>
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.antlr.v4.runtime.tree.ParseTree;
import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser;
import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParserBaseListener;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementWriter;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import javax.annotation.concurrent.Immutable;
private QNameToStatementDefinition stmtDef;
private PrefixToModule prefixes;
private List<String> toBeSkipped = new ArrayList<>();
+ private boolean isType = false;
private static final Logger LOG = LoggerFactory.getLogger(YangStatementParserListenerImpl.class);
public YangStatementParserListenerImpl(StatementSourceReference ref) {
this.prefixes = prefixes;
}
+ private static boolean hasNotEmptyBody(List<ParseTree> children) {
+ for (ParseTree child : children) {
+ if (child instanceof YangStatementParser.StatementContext) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
public void enterStatement(YangStatementParser.StatementContext ctx) {
boolean action = true;
+ QName identifier;
for (int i = 0; i < ctx.getChildCount(); i++) {
ParseTree child = ctx.getChild(i);
if (child instanceof YangStatementParser.KeywordContext) {
try {
- QName identifier = new QName(YangConstants.RFC6020_YIN_NAMESPACE,
+ identifier = new QName(YangConstants.RFC6020_YIN_NAMESPACE,
((YangStatementParser.KeywordContext) child).children.get(0).getText());
if (stmtDef != null && Utils.isValidStatementDefinition(prefixes, stmtDef, identifier) && toBeSkipped.isEmpty()) {
- writer.startStatement(identifier, ref);
+ if (identifier.equals(Rfc6020Mapping.TYPE.getStatementName()) && hasNotEmptyBody(((YangStatementParser.KeywordContext) child).getParent().children)) {
+ isType = true;
+ } else {
+ writer.startStatement(identifier, ref);
+ }
} else {
action = false;
toBeSkipped.add(((YangStatementParser.KeywordContext) child).children.get(0).getText());
}
} else if (child instanceof YangStatementParser.ArgumentContext) {
try {
- if (action) {
- writer.argumentValue(
- Utils.stringFromStringContext((YangStatementParser.ArgumentContext) child), ref);
+ final String argument = Utils.stringFromStringContext((YangStatementParser.ArgumentContext) child);
+ if (isType) {
+ writer.startStatement(new QName(YangConstants.RFC6020_YIN_NAMESPACE, argument), ref);
+ writer.argumentValue(argument, ref);
+ isType = false;
+ } else if (action) {
+ writer.argumentValue(Utils.stringFromStringContext((YangStatementParser.ArgumentContext) child), ref);
} else {
action = true;
}
package org.opendaylight.yangtools.yang.parser.spi;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
/**
*
* identity identifier namespace.
*
*/
-public interface IdentityNamespace extends IdentifierNamespace<QName, IdentityStatement> {
+public interface IdentityNamespace extends IdentifierNamespace<QName, StmtContext.Mutable<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>>> {
}
switch (sourceProgress) {
case FINISHED:
currentSource.remove();
+ // Fallback to progress, since we were able to make progress in computation
case PROGRESS:
progressing = true;
+ break;
case NO_PROGRESS:
- // Noop;
+ // Noop
+ break;
+ default:
+ throw new IllegalStateException("Unsupported phase progress " + sourceProgress);
}
}
}
*/
package org.opendaylight.yangtools.yang.parser.stmt.reactor;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Objects;
-import javax.annotation.Nullable;
import org.opendaylight.yangtools.concepts.Mutable;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.YangConstants;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.util.BaseTypes;
import org.opendaylight.yangtools.yang.parser.spi.ExtensionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase.ContextBuilder;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.BitsSpecificationImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Decimal64SpecificationImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.EnumSpecificationImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.IdentityRefSpecificationImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.InstanceIdentifierSpecificationImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.LeafrefSpecificationImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.NumericalRestrictionsImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.StringRestrictionsImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.UnionSpecificationImpl;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.UnknownStatementImpl;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Objects;
+
public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBehaviour.Registry, Mutable {
public enum PhaseCompletionProgress {
ContextBuilder<?, ?, ?> createDeclaredChild(StatementContextBase<?, ?, ?> current, QName name, StatementSourceReference ref) {
StatementDefinitionContext<?,?,?> def = getDefinition(name);
- //extensions
- if (def == null) {
+ if (def == null && BaseTypes.isYangBuildInType(name.getLocalName())) {
+ //type-body-stmts
+ def = resolveTypeBodyStmts(name.getLocalName());
+ } else if (def == null) {
+ //extensions
if (Utils.isValidStatementDefinition(prefixToModuleMap, qNameToStmtDefMap, name)) {
def = new StatementDefinitionContext<>(new UnknownStatementImpl.Definition(qNameToStmtDefMap.get(Utils.trimPrefix(name))));
}
}
}
+ private StatementDefinitionContext<?,?,?> resolveTypeBodyStmts(String typeArgument) {
+ switch (typeArgument) {
+ case "int8": case "int16": case "int32": case "int64": case "uint8": case "uint16": case "uint32": case "uint64":
+ return new StatementDefinitionContext<>(new NumericalRestrictionsImpl.Definition());
+ case "decimal64":
+ return new StatementDefinitionContext<>(new Decimal64SpecificationImpl.Definition());
+ case "union":
+ return new StatementDefinitionContext<>(new UnionSpecificationImpl.Definition());
+ case "string":
+ return new StatementDefinitionContext<>(new StringRestrictionsImpl.Definition());
+ case "enumeration":
+ return new StatementDefinitionContext<>(new EnumSpecificationImpl.Definition());
+ case "leafref":
+ return new StatementDefinitionContext<>(new LeafrefSpecificationImpl.Definition());
+ case "bits":
+ return new StatementDefinitionContext<>(new BitsSpecificationImpl.Definition());
+ case "identityref":
+ return new StatementDefinitionContext<>(new IdentityRefSpecificationImpl.Definition());
+ case "instance-identifier":
+ return new StatementDefinitionContext<>(new InstanceIdentifierSpecificationImpl.Definition());
+ default:
+ return null;
+ }
+ }
+
+
private PrefixToModule prefixes() {
Map<String, QNameModule> prefixes = (Map<String, QNameModule>) currentContext.getAllFromNamespace(PrefixToModule.class);
for (Map.Entry<String, QNameModule> prefix : prefixes.entrySet()) {
private final A argument;
SubstatementContext(StatementContextBase<?,?,?> parent,ContextBuilder<A,D,E> builder) throws SourceException {
- //super(builder, builder.getDefinition().parseArgumentValue(parent, builder.getRawArgument()));
super(builder);
this.parent = Preconditions.checkNotNull(parent, "Parent must not be null");
this.argument = builder.getDefinition().parseArgumentValue(this, builder.getRawArgument());
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+
+import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.LengthStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+public class BinarySpecificationImpl extends AbstractDeclaredStatement<String> implements TypeStatement.BinarySpecification {
+
+ protected BinarySpecificationImpl(StmtContext<String, ?, ?> context) {
+ super(context);
+ }
+
+ public static class Definition extends AbstractStatementSupport<String, BinarySpecification, EffectiveStatement<String, BinarySpecification>> {
+
+ public Definition() {
+ super(Rfc6020Mapping.TYPE);
+ }
+
+ @Override
+ public String parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) throws SourceException {
+ return value;
+ }
+
+ @Override
+ public BinarySpecification createDeclared(StmtContext<String, BinarySpecification, ?> ctx) {
+ return new BinarySpecificationImpl(ctx);
+ }
+
+ @Override
+ public EffectiveStatement<String, BinarySpecification> createEffective(StmtContext<String, BinarySpecification, EffectiveStatement<String, BinarySpecification>> ctx) {
+ return null;
+ }
+ }
+
+ @Nullable
+ @Override
+ public LengthStatement getLength() {
+ return firstDeclared(LengthStatement.class);
+ }
+
+ @Nonnull
+ @Override
+ public String getName() {
+ return argument();
+ }
+}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
super(context);
}
- public static class Definition
- extends
- AbstractStatementSupport<String, BitStatement, EffectiveStatement<String, BitStatement>> {
+ public static class Definition extends AbstractStatementSupport<String, BitStatement, EffectiveStatement<String, BitStatement>> {
public Definition() {
super(Rfc6020Mapping.BIT);
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.BitsSpecificationEffectiveStatementImpl;
public class BitsSpecificationImpl extends AbstractDeclaredStatement<String>
implements TypeStatement.BitsSpecification {
@Override
public EffectiveStatement<String, TypeStatement.BitsSpecification> createEffective(
StmtContext<String, TypeStatement.BitsSpecification, EffectiveStatement<String, TypeStatement.BitsSpecification>> ctx) {
- throw new UnsupportedOperationException();
+ return new BitsSpecificationEffectiveStatementImpl(ctx);
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
-
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RangeStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.Decimal64SpecificationEffectiveStatementImpl;
public class Decimal64SpecificationImpl extends AbstractDeclaredStatement<String> implements TypeStatement.Decimal64Specification{
public static class Definition extends AbstractStatementSupport<String,TypeStatement.Decimal64Specification,EffectiveStatement<String,TypeStatement.Decimal64Specification>> {
public Definition() {
- super(Rfc6020Mapping.FRACTION_DIGITS);
+ super(Rfc6020Mapping.TYPE);
}
@Override public String parseArgumentValue(StmtContext<?, ?, ?> ctx,
@Override public EffectiveStatement<String, TypeStatement.Decimal64Specification> createEffective(
StmtContext<String, TypeStatement.Decimal64Specification, EffectiveStatement<String, TypeStatement.Decimal64Specification>> ctx) {
- throw new UnsupportedOperationException();
+ return new Decimal64SpecificationEffectiveStatementImpl(ctx);
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EnumSpecificationEffectiveStatementImpl;
public class EnumSpecificationImpl extends AbstractDeclaredStatement<String>
implements TypeStatement.EnumSpecification {
AbstractStatementSupport<String, TypeStatement.EnumSpecification, EffectiveStatement<String, TypeStatement.EnumSpecification>> {
public Definition() {
- super(Rfc6020Mapping.ENUM);
+ super(Rfc6020Mapping.TYPE);
}
@Override
@Override
public EffectiveStatement<String, TypeStatement.EnumSpecification> createEffective(
StmtContext<String, TypeStatement.EnumSpecification, EffectiveStatement<String, TypeStatement.EnumSpecification>> ctx) {
- throw new UnsupportedOperationException();
+ return new EnumSpecificationEffectiveStatementImpl(ctx);
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.parser.spi.ExtensionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
-import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
}
@Override
- public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) throws InferenceException, SourceException {
+ public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) throws SourceException {
stmt.addContext(ExtensionNamespace.class, stmt.getStatementArgument(), stmt);
}
}
}
@Override
- public void onFullDefinitionDeclared(
- Mutable<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> stmt) throws SourceException {
- stmt.getParentContext().addContext(GroupingNamespace.class, stmt.getStatementArgument(),stmt);
+ public void onFullDefinitionDeclared(Mutable<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> stmt) throws SourceException {
+ if (stmt != null && stmt.getParentContext() != null) {
+ stmt.getParentContext().addContext(GroupingNamespace.class, stmt.getStatementArgument(), stmt);
+ }
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
*/
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
+import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IdentityRefSpecificationEffectiveStatementImpl;
-public class IdentityRefSpecificationImpl extends
- AbstractDeclaredStatement<String> implements
- TypeStatement.IdentityRefSpecification {
+import javax.annotation.Nonnull;
+import java.util.Map;
+
+public class IdentityRefSpecificationImpl extends AbstractDeclaredStatement<String> implements TypeStatement.IdentityRefSpecification {
protected IdentityRefSpecificationImpl(
StmtContext<String, TypeStatement.IdentityRefSpecification, ?> context) {
AbstractStatementSupport<String, TypeStatement.IdentityRefSpecification, EffectiveStatement<String, TypeStatement.IdentityRefSpecification>> {
public Definition() {
- super(Rfc6020Mapping.BASE);
+ super(Rfc6020Mapping.TYPE);
}
@Override
@Override
public EffectiveStatement<String, TypeStatement.IdentityRefSpecification> createEffective(
StmtContext<String, TypeStatement.IdentityRefSpecification, EffectiveStatement<String, TypeStatement.IdentityRefSpecification>> ctx) {
- throw new UnsupportedOperationException();
+ return new IdentityRefSpecificationEffectiveStatementImpl(ctx);
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(StmtContext.Mutable<String, IdentityRefSpecification, EffectiveStatement<String, IdentityRefSpecification>> stmt) throws SourceException {
+ //FIXME:
+// StatementContextBase<?, ?, ?> stmtCtx = (StatementContextBase<?, ?, ?>) stmt.getFromNamespace(IdentityNamespace.class, Utils.qNameFromArgument(StmtContextUtils.findFirstDeclaredSubstatement(stmt, BaseStatement.class), (String) StmtContextUtils.findFirstDeclaredSubstatement(stmt, BaseStatement.class).getStatementArgument()));
+// Preconditions.checkArgument(stmtCtx != null, "Identity '%s' doesn't exist in given scope (module, imported submodules)", stmt.getStatementArgument());
}
}
return argument();
}
+ @Nonnull
+ @Override
+ public BaseStatement getBase() {
+ return firstDeclared(BaseStatement.class);
+ }
+
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
*/
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser;
+import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IdentityEffectiveStatementImpl;
-
import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
super(context);
}
- public static class Definition
- extends
- AbstractStatementSupport<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> {
+ public static class Definition extends AbstractStatementSupport<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> {
public Definition() {
super(Rfc6020Mapping.IDENTITY);
return new IdentityEffectiveStatementImpl(ctx);
}
+ @Override
+ public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> stmt) throws SourceException {
+ stmt.addToNs(IdentityNamespace.class, stmt.getStatementArgument(), stmt);
+ }
}
@Override
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.InstanceIdentifierSpecificationEffectiveStatementImpl;
public class InstanceIdentifierSpecificationImpl extends
AbstractDeclaredStatement<String> implements
AbstractStatementSupport<String, TypeStatement.InstanceIdentifierSpecification, EffectiveStatement<String, TypeStatement.InstanceIdentifierSpecification>> {
public Definition() {
- super(Rfc6020Mapping.REQUIRE_INSTANCE);
+ super(Rfc6020Mapping.TYPE);
}
@Override
@Override
public EffectiveStatement<String, TypeStatement.InstanceIdentifierSpecification> createEffective(
StmtContext<String, TypeStatement.InstanceIdentifierSpecification, EffectiveStatement<String, TypeStatement.InstanceIdentifierSpecification>> ctx) {
- throw new UnsupportedOperationException();
+ return new InstanceIdentifierSpecificationEffectiveStatementImpl(ctx);
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
-
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.LeafrefSpecificationEffectiveStatementImpl;
public class LeafrefSpecificationImpl extends AbstractDeclaredStatement<String>
implements TypeStatement.LeafrefSpecification {
AbstractStatementSupport<String, TypeStatement.LeafrefSpecification, EffectiveStatement<String, TypeStatement.LeafrefSpecification>> {
public Definition() {
- super(Rfc6020Mapping.PATH);
+ super(Rfc6020Mapping.TYPE);
}
@Override
@Override
public EffectiveStatement<String, TypeStatement.LeafrefSpecification> createEffective(
StmtContext<String, TypeStatement.LeafrefSpecification, EffectiveStatement<String, TypeStatement.LeafrefSpecification>> ctx) {
- throw new UnsupportedOperationException();
+ return new LeafrefSpecificationEffectiveStatementImpl(ctx);
}
}
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MustEffectiveStatementImpl;
@Override public RevisionAwareXPath parseArgumentValue(
StmtContext<?, ?, ?> ctx, String value) throws SourceException {
- return new RevisionAwareXPathImpl(value, false);
+ return new RevisionAwareXPathImpl(value, Utils.isXPathAbsolute(value));
}
@Override public MustStatement createDeclared(
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RangeStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.NumericalRestrictionsEffectiveStatementImpl;
public class NumericalRestrictionsImpl extends AbstractDeclaredStatement<String> implements TypeStatement.NumericalRestrictions{
public static class Definition extends AbstractStatementSupport<String,TypeStatement.NumericalRestrictions,EffectiveStatement<String,TypeStatement.NumericalRestrictions>> {
public Definition() {
- super(Rfc6020Mapping.RANGE);
+ super(Rfc6020Mapping.TYPE);
}
@Override public String parseArgumentValue(StmtContext<?, ?, ?> ctx,
@Override public EffectiveStatement<String, TypeStatement.NumericalRestrictions> createEffective(
StmtContext<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> ctx) {
- throw new UnsupportedOperationException();
+ return new NumericalRestrictionsEffectiveStatementImpl(ctx);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+
+import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
+import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MustEffectiveStatementImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.PathEffectiveStatementImpl;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+public class PathStatementImpl extends AbstractDeclaredStatement<RevisionAwareXPath> implements
+ PathStatement {
+
+ protected PathStatementImpl(StmtContext<RevisionAwareXPath, PathStatement, ?> context) {
+ super(context);
+ }
+
+ public static class Definition extends AbstractStatementSupport<RevisionAwareXPath,PathStatement,EffectiveStatement<RevisionAwareXPath,PathStatement>> {
+
+ public Definition() {
+ super(Rfc6020Mapping.PATH);
+ }
+
+ @Override public RevisionAwareXPath parseArgumentValue(
+ StmtContext<?, ?, ?> ctx, String value) throws SourceException {
+ return new RevisionAwareXPathImpl(value, Utils.isXPathAbsolute(value));
+ }
+
+ @Override public PathStatement createDeclared(
+ StmtContext<RevisionAwareXPath, PathStatement, ?> ctx) {
+ return new PathStatementImpl(ctx);
+ }
+
+ @Override public EffectiveStatement<RevisionAwareXPath, PathStatement> createEffective(
+ StmtContext<RevisionAwareXPath, PathStatement, EffectiveStatement<RevisionAwareXPath, PathStatement>> ctx) {
+ return new PathEffectiveStatementImpl(ctx);
+ }
+ }
+
+ @Nonnull
+ @Override
+ public String getValue() {
+ return rawArgument();
+ }
+
+}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StringRestrictionsEffectiveStatementImpl;
public class StringRestrictionsImpl extends AbstractDeclaredStatement<String>
implements TypeStatement.StringRestrictions {
@Override
public EffectiveStatement<String, TypeStatement.StringRestrictions> createEffective(
StmtContext<String, TypeStatement.StringRestrictions, EffectiveStatement<String, TypeStatement.StringRestrictions>> ctx) {
- throw new UnsupportedOperationException();
+ return new StringRestrictionsEffectiveStatementImpl(ctx);
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
*/
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+import com.google.common.base.Preconditions;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.model.util.BaseTypes;
+import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.TypeEffectiveStatementImpl;
import javax.annotation.Nonnull;
@Override public EffectiveStatement<String, TypeStatement> createEffective(
StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx) {
- throw new UnsupportedOperationException();
+ return new TypeEffectiveStatementImpl(ctx);
+ }
+
+ @Override
+ public void onFullDefinitionDeclared(StmtContext.Mutable<String, TypeStatement, EffectiveStatement<String, TypeStatement>> stmt) throws SourceException {
+ if (!BaseTypes.isYangBuildInType(stmt.getStatementArgument())) {
+ if (stmt.getParentContext() != null) {
+ StatementContextBase<?, ?, ?> stmtCtx = (StatementContextBase<?, ?, ?>) stmt.getParentContext().getFromNamespace(TypeNamespace.class, Utils.qNameFromArgument(stmt, stmt.getStatementArgument()));
+ Preconditions.checkArgument(stmtCtx != null, "Typedef '%s' doesn't exist in given scope", stmt.getStatementArgument());
+ }
+ }
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
+import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.TypeDefEffectiveStatementImpl;
+
import javax.annotation.Nullable;
public class TypedefStatementImpl extends AbstractDeclaredStatement<QName>
@Override
public EffectiveStatement<QName, TypedefStatement> createEffective(
StmtContext<QName, TypedefStatement, EffectiveStatement<QName, TypedefStatement>> ctx) {
- throw new UnsupportedOperationException();
+ return new TypeDefEffectiveStatementImpl(ctx);
+ }
+
+ @Override
+ public void onStatementDefinitionDeclared(StmtContext.Mutable<QName, TypedefStatement, EffectiveStatement<QName, TypedefStatement>> stmt) throws SourceException {
+ if (stmt != null && stmt.getParentContext() != null) {
+ stmt.getParentContext().addContext(TypeNamespace.class, stmt.getStatementArgument(), stmt);
+ }
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
import java.util.Collection;
+
+import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UnionSpecificationEffectiveStatementImpl;
public class UnionSpecificationImpl extends AbstractDeclaredStatement<String>
implements TypeStatement.UnionSpecification {
super(context);
}
- public static class Definition
- extends
- AbstractStatementSupport<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> {
+ public static class Definition extends AbstractStatementSupport<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> {
public Definition() {
super(Rfc6020Mapping.TYPE);
@Override
public EffectiveStatement<String, TypeStatement.UnionSpecification> createEffective(
StmtContext<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> ctx) {
- throw new UnsupportedOperationException();
+ return new UnionSpecificationEffectiveStatementImpl(ctx);
}
}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
@Override public RevisionAwareXPath parseArgumentValue(
StmtContext<?, ?, ?> ctx, String value) throws SourceException {
- return new RevisionAwareXPathImpl(value, false);
+ return new RevisionAwareXPathImpl(value, Utils.isXPathAbsolute(value));
}
@Override public WhenStatement createDeclared(
import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.treeScoped;
import org.opendaylight.yangtools.yang.parser.spi.ExtensionNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleQNameToModuleName;
import org.opendaylight.yangtools.yang.parser.spi.source.PrefixToModule;
import org.opendaylight.yangtools.yang.parser.spi.NamespaceToModule;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
-import org.opendaylight.yangtools.yang.parser.spi.source.QNameToStatementDefinition;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
public final class YangInferencePipeline {
.addSupport(sourceLocal(IncludedModuleContext.class))
.addSupport(sourceLocal(ImpPrefixToModuleIdentifier.class))
.addSupport(sourceLocal(BelongsToPrefixToModuleName.class))
- .addSupport(sourceLocal(QNameToStatementDefinition.class))
.build();
private static final StatementSupportBundle STMT_DEF_BUNDLE = StatementSupportBundle.
.addSupport(new ArgumentStatementImpl.Definition())
.addSupport(new ExtensionStatementImpl.Definition())
.addSupport(global(ExtensionNamespace.class))
+ .addSupport(new TypedefStatementImpl.Definition())
+ .addSupport(treeScoped(TypeNamespace.class))
+ .addSupport(new IdentityStatementImpl.Definition())
+ .addSupport(global(IdentityNamespace.class))
.build();
private static final StatementSupportBundle FULL_DECL_BUNDLE = StatementSupportBundle.
.addSupport(new DefaultStatementImpl.Definition())
.addSupport(new MustStatementImpl.Definition())
.addSupport(new MandatoryStatementImpl.Definition())
- .addSupport(new TypedefStatementImpl.Definition())
.addSupport(new AnyxmlStatementImpl.Definition())
.addSupport(new IfFeatureStatementImpl.Definition())
.addSupport(new UsesStatementImpl.Definition())
.addSupport(new WhenStatementImpl.Definition())
.addSupport(new AugmentStatementImpl.Definition())
.addSupport(new RefineStatementImpl.Definition())
- .addSupport(new IdentityStatementImpl.Definition())
.addSupport(new BaseStatementImpl.Definition())
.addSupport(new FractionDigitsStatementImpl.Definition())
.addSupport(new EnumStatementImpl.Definition())
.addSupport(new ValueStatementImpl.Definition())
.addSupport(new UnitsStatementImpl.Definition())
.addSupport(new RequireInstanceStatementImpl.Definition())
- //TODO: add mapping to Rfc6020Mapping class and uncomment following. Please test it.
-// .addSupport(new EnumSpecificationImpl.Definition())
-// .addSupport(new Decimal64SpecificationImpl.Definition())
-// .addSupport(new IdentityRefSpecificationImpl.Definition())
-// .addSupport(new InstanceIdentifierSpecificationImpl.Definition())
-// .addSupport(new LeafrefSpecificationImpl.Definition())
-// .addSupport(new NumericalRestrictionsImpl.Definition())
-// .addSupport(new StringRestrictionsImpl.Definition())
-// .addSupport(new UnionSpecificationImpl.Definition())
-// .addSupport(new BitStatementImpl.Definition())
+ .addSupport(new BitStatementImpl.Definition())
+ .addSupport(new PathStatementImpl.Definition())
.build();
public static final Map<ModelProcessingPhase, StatementSupportBundle> RFC6020_BUNDLES = ImmutableMap
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class BitsSpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.BitsSpecification> {
+
+ public BitsSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.BitsSpecification, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class Decimal64SpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.Decimal64Specification> {
+
+ public Decimal64SpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.Decimal64Specification, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class EnumSpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.EnumSpecification> {
+
+ public EnumSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.EnumSpecification, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class IdentityRefSpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.IdentityRefSpecification> {
+
+ public IdentityRefSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.IdentityRefSpecification, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class InstanceIdentifierSpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.InstanceIdentifierSpecification> {
+
+ public InstanceIdentifierSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.InstanceIdentifierSpecification, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class LeafrefSpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.LeafrefSpecification> {
+
+ public LeafrefSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.LeafrefSpecification, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class NumericalRestrictionsEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.NumericalRestrictions> {
+
+ public NumericalRestrictionsEffectiveStatementImpl(StmtContext<String, TypeStatement.NumericalRestrictions, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class PathEffectiveStatementImpl extends
+ EffectiveStatementBase<RevisionAwareXPath, PathStatement> {
+
+ public PathEffectiveStatementImpl(
+ StmtContext<RevisionAwareXPath, PathStatement, ?> ctx) {
+ super(ctx);
+
+ }
+
+}
\ No newline at end of file
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class StringRestrictionsEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.StringRestrictions> {
+
+ public StringRestrictionsEffectiveStatementImpl(StmtContext<String, TypeStatement.StringRestrictions, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class TypeDefEffectiveStatementImpl extends EffectiveStatementBase<QName, TypedefStatement> {
+
+ public TypeDefEffectiveStatementImpl(StmtContext<QName, TypedefStatement, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class TypeEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement> {
+
+ public TypeEffectiveStatementImpl(StmtContext<String, TypeStatement, ?> ctx) {
+ super(ctx);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class UnionSpecificationEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement.UnionSpecification> {
+
+ public UnionSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.UnionSpecification, ?> ctx) {
+ super(ctx);
+ }
+}
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.stmt.test;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
+
+import static org.junit.Assert.assertNotNull;
+
+public class YangTypesStmtTest {
+
+ private static final YangStatementSourceImpl TYPEFILE1 = new YangStatementSourceImpl("/semantic-statement-parser/types.yang");
+ private static final YangStatementSourceImpl TYPEFILE2 = new YangStatementSourceImpl("/semantic-statement-parser/simple-types.yang");
+
+ @Test
+ public void readAndParseYangFileTest() throws SourceException, ReactorException {
+ CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
+ addSources(reactor, TYPEFILE1, TYPEFILE2);
+ EffectiveModelContext result = reactor.build();
+ assertNotNull(result);
+ }
+
+ private void addSources(CrossSourceStatementReactor.BuildAction reactor, StatementStreamSource... sources) {
+ for (StatementStreamSource source : sources) {
+ reactor.addSource(source);
+ }
+ }
+}
--- /dev/null
+module simple-types {
+
+ yang-version 1;
+ namespace "urn:simple.types";
+ prefix "st";
+
+ organization "opendaylight";
+ contact "WILL-BE-DEFINED-LATER";
+ revision 2015-04-16;
+
+ typedef myint8 {
+ type int8 {
+ range "1..20";
+ }
+ }
+
+ identity my-base;
+
+ typedef myint32 {
+ type int32 {
+ range "1..2000";
+ }
+ }
+
+ container mycontainer {
+ leaf mynumerical {
+ type int32 {
+ range "1..3000";
+ }
+ }
+
+ leaf mynorestrictions {
+ type string;
+ }
+
+ leaf mytypedefuse1 {
+ type myint32;
+ }
+
+ leaf mytypedefuse2 {
+ type myint8;
+ }
+
+ leaf myunion {
+ type union {
+ type int8;
+ type int32;
+ }
+ }
+
+ leaf mydecimal64 {
+ type decimal64 {
+ fraction-digits 2;
+ range "1 .. 3.14 | 10 | 20..max";
+ }
+ }
+
+ leaf mystring {
+ type string {
+ length "1..255";
+ pattern "[0-9a-fA-F]*";
+ }
+ }
+
+ leaf myenum {
+ type enumeration {
+ enum zero;
+ enum one;
+ enum seven {
+ value 7;
+ }
+ }
+ }
+
+ leaf mybits {
+ type bits {
+ bit disable-nagle {
+ position 0;
+ }
+ bit auto-sense-speed {
+ position 1;
+ }
+ bit 10-Mb-only {
+ position 2;
+ }
+ }
+ default "auto-sense-speed";
+ }
+
+ leaf mgmt-interface {
+ type leafref {
+ path "../myenum";
+ }
+ }
+
+ leaf crypto {
+ type identityref {
+ base "my-base";
+ }
+ }
+
+ }
+}
--- /dev/null
+module custom-types-test {
+
+ yang-version 1;
+ namespace "urn:custom.types.demo";
+ prefix "iit";
+
+ organization "opendaylight";
+ contact "WILL-BE-DEFINED-LATER";
+ revision 2012-04-16 {
+ }
+
+ extension mountpoint {
+ description "enter point";
+ argument "name" {
+ yin-element "true";
+ }
+ }
+
+ typedef access-operations-type {
+ type bits {
+ bit create {
+ description "Any protocol operation that creates a new data node.";
+ }
+ bit read {
+ description "Any protocol operation or notification that returns the value of a data node.";
+ position 500;
+ }
+ bit update {
+ description "Any protocol operation that alters an existing data node.";
+ }
+ bit delete {
+ description "Any protocol operation that removes a data node.";
+ position 365;
+ }
+ bit exec {
+ description "Execution access to the specified protocol operation.";
+ }
+ }
+ description "NETCONF Access Operation.";
+ }
+
+ leaf inst-id-leaf1 {
+ type instance-identifier {
+ require-instance false;
+ }
+ iit:mountpoint "mnt-extension";
+ }
+
+ leaf inst-id-leaf2 {
+ type instance-identifier;
+ }
+
+ leaf type {
+ type service-type-ref;
+ }
+
+ identity crypto-id {
+ base "crypto-base";
+ description "crypto-id description";
+ iit:mountpoint "mnt-extension";
+ }
+
+ identity crypto-base {
+ description "crypto-base description";
+ }
+
+ identity crypto-alg {
+ base "crypto-base";
+ description "crypto-alg description";
+ }
+
+ identity crypto-def {
+ base "crypto-base";
+ description "crypto-def description";
+ }
+
+ leaf mybits {
+ type bits {
+ bit disable-nagle {
+ position 0;
+ }
+ bit auto-sense-speed {
+ position 1;
+ }
+ bit 10-Mb-only {
+ position 2;
+ }
+ }
+ default "auto-sense-speed";
+ }
+
+ typedef ip-version {
+ type enumeration {
+ enum unknown {
+ description "An unknown or unspecified version of the Internet protocol.";
+ }
+ enum ipv4 {
+ value "19";
+ description "The IPv4 protocol as defined in RFC 791.";
+ }
+ enum ipv6 {
+ value "7";
+ description "The IPv6 protocol as defined in RFC 2460.";
+ }
+ enum default {
+ description "default ip";
+ }
+ }
+ }
+
+ identity service-type {
+ description
+ "Service identity base type. All service identities must be
+ derived from this type. A service type uniquely defines a single
+ atomic API contract, such as a Java interface, a set of C
+ function declarations, or similar.
+
+ If the service type has a corresponding Java interface, the name
+ of that interface should be attached to the derived identity MUST
+ include a java-class keyword, whose name argument points to that
+ interface.";
+ }
+
+ typedef service-type-ref {
+ description
+ "Internal type of references to service type identity.";
+ type identityref {
+ base service-type;
+ }
+ }
+
+}