Book Image

OpenDaylight Cookbook

By : Rashmi Pujar, ICARO CAMELO, Yrineu Rodrigues
Book Image

OpenDaylight Cookbook

By: Rashmi Pujar, ICARO CAMELO, Yrineu Rodrigues

Overview of this book

OpenDaylight is an open source platform to program and build Software-Defined Networks (SDN). Its aim is to accelerate the adoption of SDN and NFV. With above 90 practical recipes, this book will help you to solve day-to-day problems and maintenance tasks surrounding OpenDaylight’s implementation. This book starts with the OpenDaylight fundamentals. In this book, you will gain a sound understanding of the methods and techniques when deploying OpenDaylight in production environment. Later on, you will learn to create a Service Chain using SFC. This book will address common problems and day-to-day maintenance tasks with OpenDaylight. We’ll also will teach you how to interact with OpenDaylight APIs and use the necessary tools to simulate networks. You will also explore how to create your own branded OpenDaylight along with authorising and authenticating users using OpenDaylight Identity Manager. By the end of this book, you will have the necessary skills to operate an OpenDaylight SDN environment.
Table of Contents (9 chapters)

Browsing data models with YANGUI

YANGUI is a user interface application through which one can navigate among all YANG models available in the OpenDaylight controller. Not only does it aggregate all data models, it also enables their usage. Using this interface, you can create, remove, update, and delete any part of the model-driven data store. It provides a nice, smooth user interface making it easier to browse through the model(s).

This recipe will guide you through those functionalities.

Getting ready

This recipe only requires the OpenDaylight controller and a web browser.

How to do it...

Perform the following steps:

  1. Start your OpenDaylight distribution using the karaf script. Using this client will give you access to the Karaf CLI:
$ ./bin/karaf
  1. Install the user-facing feature responsible to pull in all dependencies needed to use YANGUI:
opendaylight-user@root>feature:install odl-dlux-yangui  

It might take a minute or so to complete the installation.

  1. Navigate to http://localhost:8181/index.html#/yangui/index:
    • Username: admin
    • Password: admin

Once logged in, all modules will be loaded until you see this message at the bottom of the screen:

Loading completed successfully

You should see the API tab listing all YANG models in the following format:

<module-name> rev.<revision-date>

For instance:

  • cluster-admin rev.2015-10-13
  • config rev.2013-04-05
  • credential-store rev.2015-02-26

By default, there isn't much you can do with the provided YANG models. So let's connect an OpenFlow switch to better understand how to use this YANGUI. To do so, please refer to the first recipe, Connecting OpenFlow switches, step 2.

Once done, refresh your web page to load newly added modules.

  1. Look for opendaylight-inventory rev.2013-08-19 and select the operational tab, as nothing will yet be in the config data store. Then click on nodes and you'll see a request bar at the bottom of the page with multiple options.

You can either copy the request to the clipboard to use it in your browser, send it, show a preview of it, or define a custom API request.

For now, we will only send the request.

You should see Request sent successfully and under this message should be the retrieved data. As we only have one switch connected, there is only one node. All the switch operational information is now printed on your screen.

You could do the same request by specifying the node-id in the request. To do that you will need to expand nodes and click on node {id}, which will enable a more fine-grained search.

How it works...

OpenDaylight has a model-driven architecture, which means that all of its components are modeled using YANG. While installing features, OpenDaylight loads YANG models, making them available within the MD-SAL data store.

YANGUI is a representation of this data store. Each schema represents a subtree based on the name of the module and its revision-date. YANGUI aggregates and parses all those models. It also acts as a REST client; through its web interface we can execute functions such as GET, POST, PUT, and DELETE.

There's more...

The example shown previously can be improved upon, as there was no user YANG model loaded. For instance, if you mount a NETCONF device containing its own YANG model, you could interact with it through YANGUI.

You would use the config data store to push/update some data, and you would see the operational data store updated accordingly. In addition, accessing your data would be much easier than having to define the exact URL, as mentioned in the Mounting a NETCONF device recipe.

See also

  • Using API doc as a REST API client