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.
System requirements
We have successfully tested OpenNaaS is tested to both build and run in:
- Windows 7,
- GNU Linux system systems (Ubuntu +10.10 and Debian)
- MAC OSX systems
There's a limitation by using Windows XP. The reason is that OpenNaaS uses Fuse 4.4 version, which requires at least either a Windows 2003 Server, a Windows 2008 Server or Windows 7, in case you're using a Microsoft OS.
Although not tested, there is no reason to believe OpenNaaS should not be able to run in other systems.
...
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.
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.
A descriptor from the project examples directory, or a custom one can be used.
The CLI command to register a device with this descriptor will be:
Code Block |
---|
resource:create /path/to/descriptor/resource.descriptor
|
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.
In this example we're going to use netconf protocol. Hence, we introduce all netconf Protocol Context required data:
- protocol type
- authentication type
- uri
- authentication parameters
The following command illustrates how to register a protocol context for our resource using password authentication:
Code Block |
---|
protocols:context router:junos20 netconf password ssh://myuser:mypassword@193.1.190.254:22/netconf |
and the following, using key authentication:
Code Block |
---|
protocols:context router:junos20 netconf publickey ssh://myuser@193.1.190.254.22/netconf privateKeyPath {key-passphrase} |
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.
To start it, we use the following command:
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.
OpenNaaS supported capabilities are specified in this section.
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:
Code Block |
---|
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 OpenNaaS.
Code Block |
---|
resource:remove router:junos20
|
Note |
---|
Notice that stopping and removing a resource causes no changes in real device configuration (e.g. resource:remove router:logicalrouter1 does not delete the logical router, but only removes it from OpenNaaS.) |
Congratulations! Now that you have a running OpenNaaS instance, try loading some resources.