Using the yang-parser - An Example

Using the yang-parser - An Example

How to Include yang-parser in your Project

1. Maven: Include the “oran-public” repository in your settings.xml

Create a profile for the “oran-public” repository

Then, include the profile under activeProfiles. The complete settings.xml file should resemble the one below, which is based on this file.

Finally add as a dependency in the pom.xml

<dependency> <groupId>org.oran.smo.yangtools.parser</groupId> <artifactId>yang-parser-jar</artifactId> <version>1.1.0</version> </dependency>

2. Install the JAR into the Local Repository

Download the yang-parser-jar from https://nexus.o-ran-sc.org/#view-repositoriesthen install in the local repository

mvn install:install-file -Dfile=/path/to/yang-parser-jar-1.1.0.jar \ -DgroupId=org.oran.smo.yangtools.parser \ -DartifactId=yang-parser-jar \ -Dversion=1.1.0 \ -Dpackaging=jar

Then add as a dependency

<dependency> <groupId>org.oran.smo.yangtools.parser</groupId> <artifactId>yang-parser-jar</artifactId> <version>1.1.0</version> </dependency>

3. Add local dependencies directly (deprecated but still working)

Download the yang-parser-jar from https://nexus.o-ran-sc.org/#view-repositories then add as a local dependency

<dependency> <groupId>org.oran.smo.yangtools.parser</groupId> <artifactId>yang-parser-jar</artifactId> <version>1.1.0</version> <scope>system</scope> <systemPath>${project.basedir}/src/main/resources/yang-parser-jar-1.1.0.jar</systemPath> </dependency>

Sample project using “yang-parser 1.0

This small sample project should provide enough information to help you start using yang-parser in your project.