Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial describes the first steps to use OpenNaaS. We are going to add a device and perform first operations to manage it. For this tutorial we are going to use the karaf shell to interact with OpenNaaS. This shell is described in detail in Server Console section.

In this tutorial we are going to use commands from "resources" and "protocols" namespaces.

OpenNaaS concepts

OpenNaaS is a framework which is based on the OSGi technology. OSGi consists of a set of components (named bundles) which provide required logic. OpenNaaS includes many bundles providing resources and capabilities abstraction (see System Architecture section). When running OpenNaaS (see Getting started section), all its bundles are loaded and exported functionality is available through the command line.

Run OpenNaaS

To start OpenNaaS, launch the executable named opennaas in the following folder:

/platform/target/opennaas-${project.version}/opennaas-${project.version}/bin
Note

Notice that there is a .sh and a .bat file.

Please use .bat if you are using Windows, and .sh if you are in a GNU-Linux or Mac OS box.

So, for version 0.10 on linux, you will run it as follows:

Code Block
cd opennaas/platform/target/opennaas-0.10/opennaas-0.10/
./bin/opennaas.sh

By default, OpenNaaS will open a CLI prompt on the terminal. To avoid this you can execute it this way:

Code Block
cd opennaas/platform/target/opennaas-0.10/opennaas-0.10/
./bin/opennaas.sh server

Please note that you will have to configure Karaf's SSH daemon to login the CLI via regular SSH. 

Creating resources

First step in OpenNaaS is registering existing infrastructure. For this tutorial, there is a single router device to be registered.

...

Note: For this guide, we used a router descriptor, specifying junos20 as name.

Registering protocol contexts

Each resource can use many different protocols to communicate with the physical device it represents. Required protocols are determined by the driver in use. For a resource to be able to use a required protocol, a Protocol Context is needed. Protocol Context stores all required information to communicate with the device using a protocol known to OpenNaaS.

...

Notice that only one context per protocol type is registered in a resource. Last one lasts.

Starting resources

A resource will populate its model and enable all its capabilities when started. Hence, in order to operate with it using opennaas, it must be started.

...

Code Block
resource:start router:junos20
 

Doing operations with resources

A resource includes a set of capabilities or features. These capabilities determine the set of available operations for this resource.

...

Please, remember that capabilities to load for a particular resource are specified in the resource descriptor.

Removing resources

Finally, if the resource isn't needed anymore, it can be stopped and removed. First, we stop it:

...