Cisco Cisco Configuration Engine 3.5 Entwickleranleitung

Seite von 344
4-12
Cisco Configuration Engine Software Development Kit API Reference and Programmer Guide 3.5
OL-17661-02
Chapter 4      Namespace Mapping Service
Mapping Algorithm
The next step is to set up configuration files for the Namespace Mapper. There are configuration files on 
both, the client and server side.
Client side configuration involves setting up the nsm.conf file in the directory where the client 
application runs. A template file (nsm.conf) is provided to simplify client side configuration.The 
directives for the nsm.conf file have been discussed in the section on client modes.
The C++ client library tries to locate nsm.conf passed in the NSMClient constructor. If it cannot find it, 
then it is prepend with the path specified in the environment variable NSM_PATH. The Java client library 
tries to locate nsm.conf in the path specified in the CLASSPATH. If it cannot find it, it looks for nsm.conf 
in the current directory.
Server configuration includes setting up property files for the Namespace Mapper server and the Data 
Access Server. This should be done using the host setup program.
The Event Gateway on host is started off with an application parameter. This is prompted during host 
setup as “Enter Event Gateway Application Parameter.” The default value for this parameter is “config.” 
For every application parameter entered here, there must be a corresponding Application Namespace 
object in the directory. Under the application namespace there must be event objects that correspond to 
subjects in that namespace. For example:
Under the “config” application the event objects are as listed below.
cisco.mgmt.cns.config.load
cisco.mgmt.cns.config.failure
cisco.mgmt.cns.config.complete
cisco.mgmt.cns.config.warning
NSM API Usage
Cisco network devices must be configured to publish or subscribe to individual events using Cisco IOS 
syntax (such as cisco.mgmt.cns.config.load).
When the device R1 signals to the Event Gateway that it wants to subscribe to an event, the gateway will 
use the NSM API to retrieve all appropriate namespace mappings—the customized event strings created 
by the network administrator—from the directory (such as westcoast.load or eastcoast.load, as 
appropriate for that device). The Event Gateway will then subscribe to the mapped subjects on the Event 
Bus. 
When you want to post an event from your client application, you use the NSM API to retrieve all 
appropriate namespace mappings for the event, and then you post the mapped events to the Event Bus. 
For example, when you want publish a cisco.mgmt.cns.config.load event to all of the devices in the 
/config/california group, which are associated with the config application namespace, you would first 
“attach” to the config namespace, then invoke the resolve() operation with the string 
cisco.mgmt.cns.config.load as the event argument and the string “/config/california” as the dev_id 
argument. 
The list of custom events that are mapped to the cisco.mgmt.cns.config.load and which are appropriate 
for devices in the /config/california group will be returned in the result argument.
You would then publish the events returned in the result argument to the Event Bus using the Event API. 
Se
 (C++) and 
 (Java). More examples with the Event and Namespace Mapper 
APIs are listed in the appendix.