Creating a simple driver without Node Agent

Many types of substrate allow for RPC-like access (examples are XML-RPC, CGI, proprietary RPC protocols). These types of substrate can use a simplified version of the driver that executes tasks on the substrate directly without the need for Node Agent and associated security setup. This document briefly describes how to do it. You can look at handlers/nlr driver as an example. To use it for other types of drivers substitute

  • Package paths orca.handlers.nlr for orca.drivers or orca.drivers.<other>
  • Directory paths orca/handlers/nlr for orca/drivers or orca/drivers/<other>

NOTE: There is a separate document that discusses creating network element drivers.

Creating directory structure

  1. Locate appropriate place for your driver (e.g. handlers/)
    $ cd handlers/
  2. Execute the following maven command that will create the directory structure. The following parameters must be specified:
    • <Device Driver name> name of the device driver
      $ mvn archetype:create -DartifactId=<Device Driver Name>
  3. This will automatically update the pom file of the parent directory (drivers/ or drivers/network)
  4. Note that ORCA frequently uses additional directories (ant/ for storing additional ant scripts, resources/ for storing properties)
    $ cd <Device Driver Name>
    $ mkdir -p ant resource src/main/resources/orca/drivers/network/<Device Driver Name> 
  5. If you open your IDE (Beans or Eclipse) you should see the new module in the directory structure (in Eclipse it sometimes requires doubleclicking the pom.xml file in the parent directory).
  6. You should add to the build path
    • handlers/<Device Driver name>/src/main/java
    • handlers/<Device Driver name>/src/main/resources
    • handlers/<Device Driver name>/src/test/java
  7. You will need at least two packages created in the source (src/main/java) directory (e.g. using Eclipse):
    • orca.handlers.<Device Driver name>
    • orca.handlers.<Device Driver name>.tasks
  8. To facilitate unit tests you should also create the orca.handlers.<Device Driver name> package in src/test/java folder

Developing the driver

Now you are ready to develop the driver. This involves identifying 'tasks'- operations on the substrate it will perform. These operations must be coded as individual tasks, children of AntBaseTask? class (see NLR example).

Helper classes should go into orca.handlers.<Device Driver name> package, while specific tasks will go into orca.handlers.<Device Driver name>.tasks package.

Testing the driver

Once you have coded all the tasks, it is time to test them. Testing drivers is a multi-layered process that includes:

  1. Running unit-tests built into the code. This is strongly recommended. Please familiarize yourself with JUnit framework. These tests are run as part of Maven build process. Look at driver tests in other drivers for ideas.
  2. Running simple ant-based tests. Create handlers/<Device Driver name>/test.xml ant script to invoke individual tasks. Look at similar scripts in other drivers for ideas. They can be invoked as simply as
    $ ant -f test.xml -Dproperty1=property1Value -Dproperty2=property2Value targetName
  3. Creating and invoking a handler script to invoke the tasks and pass appropriate parameters to them. This is described in handler testing page.