Skip to content

Instantly share code, notes, and snippets.

@subh007
Created September 15, 2015 15:09
Show Gist options
  • Save subh007/860305da5df5cd021373 to your computer and use it in GitHub Desktop.
Save subh007/860305da5df5cd021373 to your computer and use it in GitHub Desktop.
Exercise 1:
First Hello Program
1. First to the root directory of Hello project:
$ cd /home/opendaylight/bootcamp/opendaylight-application-dev-training/Code-Sample/Md-Sal-Demo/hello
How we generated the project directory structure:
2. Compile the code
$ mvn clean install -DskipTests -X ( -o to build offline)
3. start the application
$ ./karaf/target/assembly/bin/karaf
4.
- Wait for few minutes to come up the application. You can check the logs using ( root@karaf>log:tail ).
- Launch the postman.
- click on the tab : ODL-Bootcamp-mdsal
- send the requeset to ODL
Request
http://2.2.2.10:8181/restconf/operations/hello:hello-world
Body
{
input : {
name : "Bootcamp"
}
}
Controller will response with:
{
output : {
greating : "Hello Bootcamp"
}
}
Exercise 2:
Expose rest API using the Hello program:
1. Edit the yang model "api/src/main/yang/hello.yang" to add the new api.
2. Build the whole project (mvn clean install -DskipTests -X -o).
3. Give the implementation for the new API "impl/src/main/java/org/opendaylight/hello/impl/HelloWorldImpl.java".
4. Build the project (mvn clean install -DskipTests -X -o).
5. Finally run the project "$ ./karaf/target/assembly/bin/karaf"
6. Invoke the API using the postman.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment