[Contents] [Prev] [Next] [Index] [Report an Error] [No Frames]


Developing Initialization Scripts for Network Devices

When the SAE establishes a connection with a network device, it can run a script to customize the setup of the connection. These scripts are run when the connection between a network device and the SAE is established and again when the connection is dropped.

We provide the IorPublisher script in the /opt/UMC/sae/lib folder. The IorPublisher script publishes the interoperable object reference (IOR) of the SAE in the directory so that a NIC can associate a router with an SAE.

Interface Object Fields

Scripts for network devices interact with the SAE through an interface object called Ssp. The SAE exports a number of fields through the interface object to the script and expects the script to provide the entry point to the SAE.

Table 4 describes the fields that the SAE exports.




Table 4: Exported Fields  
Ssp Attribute
Description

Ssp.properties

System properties object (class: java.util.Properties)—The properties should be treated as read-only by the script.

Ssp.errorLog

Error logger—Use the SsperrorLog.printIn (message) to send error messages to the log.

Ssp.infoLog

Info logger—Use the Ssp.infoLog.printIn (message) to send informational messages to the log.

Ssp.debugLog

Debug logger—Use the Ssp.debugLog.printIn (message) to send debug messages to the log.

The script must set the field Ssp.routerInit to a factory function that instantiates a router initialization object:

The factory function must implement the following interface:

Ssp.routerInit(VRName,
virtualIp,
realIp,
VRIp,
transportVR)

The factory function returns an interface object that is used to set up and tear down a connection. A common case of a factory function is the constructor of a class.

The factory function is called directly after a connection is established. In case of problems, an exception should be raised that leads to the termination of the connection.

Required Methods

Instances of the interface object must implement the following methods:

Example: Initialization Script

The following script defines a router initialization class named SillyRouterInit. The interface class does not implement any useful functionality. The interface class just writes messages to the infoLog when the router connection is created or terminated.

class SillyRouterInit:
    def __init__(self, vrName, virtualIp, realIp, vrIp, transportVr):
        """ initialize router initialization object """
        self.vrName = vrName
        Ssp.infoLog.printin("SillyRouterInit created")

    def setup(self):
        """ initialize connection to router """
        Ssp.infoLog.printin("Setup connection to VR %(vrName)s" % 
                    vars(self))

    def shutdown(self):
        """ shutdown connection to router """
        Ssp.infoLog.printin("Shutdown connection to VR %(vrName)s" % 
                    vars(self))

#
# publish interface object to Ssp core
#
Ssp.routerInit = SillyRouterInit

Copying Initialization Scripts to the C-series Platform

If you use a script that is not provided with the SRC software, you need to use the file copy command to copy your script to the C-series platform. For example:

user@host> file copy ftp://user@myserver/routerinit.py /opt/UMC/sae/lib 
Password:

Specifying Initialization Scripts on the SAE

Use the following configuration statements to specify initialization scripts for third-party devices:

shared sae configuration driver scripts {
extension-path extension-path; 

general general; 
}

To configure initialization scripts for third-party devices:

  1. From configuration mode, access the configuration statements that configure initialization scripts.
  2. user@host# edit shared sae configuration driver scripts 
    
    
    
  3. Specify the initialization script for third-party devices.
  4. [edit shared sae configuration driver scripts]
    
    user@host# set general general 
    
    
    
  5. Configure a path to scripts that are not in the default location, /opt/UMC/sae/lib.
  6. [edit shared sae configuration driver scripts]
    
    user@host# set extension-path extension-path 
    
    
    
  7. (Optional) Verify your initialization script configuration.
  8. [edit shared sae configuration driver scripts]
    
    user@host# show 
    
    
    

[Contents] [Prev] [Next] [Index] [Report an Error] [No Frames]