Changes between Version 8 and Version 9 of Simple Driver HOWTO

Show
Ignore:
Timestamp:
05/18/10 17:44:33 (9 years ago)
Author:
ibaldin (IP: 152.54.9.131)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Simple Driver HOWTO

    v8 v9  
    11= Creating a simple driver without Node Agent = 
    22 
    3 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 drivers/network/NLRSherpa driver as an example. To use it for other types of drivers substitute  
     3Many 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  
    44  * Package paths orca.handlers.nlr for orca.drivers or orca.drivers.<other> 
    55  * Directory paths orca/handlers/nlr for orca/drivers or orca/drivers/<other> 
    66 
    7 '''NOTE:''' There is a separate [wiki:"Network driver HOWTO" document] that discusses creating network element drivers. 
     7'''NOTE:''' There is a separate [wiki:"Network driver development HOWTO" document] that discusses creating network element drivers. 
    88 
    99== Creating directory structure == 
    1010 
    11  1. Locate appropriate place for your driver (e.g. all network substrate drivers go under $ORCA_ROOT/drivers/network) 
     11 1. Locate appropriate place for your driver (e.g. handlers/) 
    1212{{{ 
    13 $ cd drivers/network 
     13$ cd handlers/\ 
    1414}}} 
    1515 2. Execute the following maven command that will create the directory structure. The following parameters must be specified:  
    16   * <Device Driver name> name of the device driver (e.g. Cisco65xx or Arista or NEC) 
     16  * <Device Driver name> name of the device driver 
    1717{{{ 
    1818$ mvn archetype:create -DgroupId=orca.drivers.network -DartifactId=<Device Driver Name> 
     
    2626 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). 
    2727 6. You should add to the build path  
    28   * drivers/network/<Device Driver name>/src/main/java  
    29   * drivers/network/<Device Driver name>/src/main/resources 
    30   * drivers/network/<Device Driver name>/src/test/java 
     28  * handlers/<Device Driver name>/src/main/java  
     29  * handlers/<Device Driver name>/src/main/resources 
     30  * handlers/<Device Driver name>/src/test/java 
    3131 7. You will need at least two packages created in the source (src/main/java) directory (e.g. using Eclipse):  
    32   * orca.drivers.network.<Device Driver name> 
    33   * orca.drivers.network.<Device Driver name>.tasks 
    34  8. To facilitate unit tests you should also create the orca.drivers.network.<Device Driver name> package in src/test/java folder 
     32  * orca.handlers.<Device Driver name> 
     33  * orca.handlers.<Device Driver name>.tasks 
     34 8. To facilitate unit tests you should also create the orca.handlers.<Device Driver name> package in src/test/java folder 
    3535 
    3636== Developing the driver == 
    3737 
    38 Now you are ready to develop the driver. This involves identifying 'tasks'- operations on the substrate it will perform. For a networking device these may be e.g. 'Enable vlan tag T on a set of ports S' or 'Translate vlan tag T1 to T2 on port P' (each operation should have a concomitant 'undo/disable/unmap' operation). These operations must be coded as individual tasks, children of '''AntBaseTask class''' (see NLRSherpa example). 
     38Now 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). 
    3939 
    40 Helper classes should go into orca.drivers.network.<Device Driver name> package, while specific tasks will go into orca.drivers.network.<Device Driver name>.tasks package. 
     40Helper classes should go into orca.handlers.<Device Driver name> package, while specific tasks will go into orca.handlers.<Device Driver name>.tasks package. 
    4141 
    4242== Testing the driver == 
     
    4444Once you have coded all the tasks, it is time to test them. Testing drivers is a multi-layered process that includes: 
    4545 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.  
    46  2. Running simple ant-based tests. Create drivers/network/<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 
     46 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 
    4747{{{ 
    4848$ ant -f test.xml -Dproperty1=property1Value -Dproperty2=property2Value targetName