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 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 5 describes the fields that the SAE exports.
The script must set the field Ssp.routerInit to a factory function that instantiates a router initialization object:
- <VRName>—Name of the virtual router object that has been configured for the network device in the format: virtualRouterName@RouterName
- <virtualIp>—Virtual IP address of the SAE (string, dotted decimal; for example: 192.168.254.1)
- <realIp>—Real IP address of the SAE (string, dotted decimal; for example, 192.168.1.20)
- <VRIp>—IP address of the virtual router (string, dotted decimal)
- <transportVR>—Name of the virtual router
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 for a COPS server. 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:
- setup()—Is called when the connection is established and is operational. In case of problems, an exception should be raised that leads to the termination of the connection.
- shutdown()—Is called when the connection is terminated to the virtual router. This method should not raise any exceptions in case of problems.
Example: Router 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 = vrNameSsp.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 = SillyRouterInitSpecifying Router Initialization Scripts on the SAE
To use SDX Configuration Editor to specify router scripts:
- In the navigation pane, select a directory configuration object for the SAE that you want to configure.
- Select the Router tab, and expand the Router Scripts section.
![]()
- Edit or accept the default values in the appropriate fields.
See Router Script Fields.
- Select File > Save.
- Right-click the configuration file, select SDX System Configuration > Export to LDAP Directory.
Router Script Fields
In SDX Configuration Editor, you can edit the following fields in the Router Scripts section of the Router pane in an SAE configuration file.
Extension Path
- Path to router initialization scripts that are not in the default location, /opt/UMC/sae/lib.
- Value—List of paths separated by semicolons (;)
- Default—No value
- Property name—Extension.path
General Script