You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 49 Next »

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.

 

Creating resources

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

In order to register a resource, a resource descriptor file is required. This file describes resource device type and name, all capabilities OpenNaaS should load for it, and what drivers will it use. More information about the Resource descriptor concept is available in System Architecture section.

For this tutorial, a descriptor from the project examples directory can be used. The command will be:

resource:create /path/to/descriptor/resource.descriptor

 

Adding protocols

Each resource has to be linked to the necessary protocols which are used to communicate with the physical device and send its operations. This is an example which uses a netconf protocol to connect with the resource:

protocols:context router:junos20  netconf password ssh://myuser:mypassword@193.1.190.254:22/netconf

or the following if you're using key uathentication:

protocols:context router:junos20 netconf publickey ssh://myuser@193.1.190.254.22/netconf privateKeyPath {key-passphrase}

 

Description of the connection parameters:

  • router:junos20 -  specify resource type (router) and resource name (junos20) for the resource we want to assign a protocol to.
  • netconf - name to identify the protocol configuration.
  • ssh://myuser:mypassword@1.1.1.1:22/netconf - URI to describe connection parameters.
  • privateKeyPath - path where the private key is stored.
  • key-passphrase - passphrase to unlock the private key (if any)

The information about the used protocols is in this link.

Resources states

A resource is in a set of states which each allow a set of operations. This picture describes these states:

Mainly, a resource will enable all its capabilities when started. For this reason, the next step will be start our resource:

resource:start router:junos20

Doing operations with the resource

A resource includes a set of capabilities or features. These capabilities are the available operations a device has. Mantychore supports:

Removing a resource

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

resource:stop router:junos20

The resource will deactivate all its capabilities and it will be reset. After, we'll destroy it and delete any resource information in Mantychore..

resource:remove router:junos20
  • No labels