Cisco Cisco Security Manager 4.0 仕様ガイド

ページ / 217
 
 
 
  
 
Cisco Security Manager 4.4 API Specification (Version 1.1) 
 
OL- 29074-01 
Page  186
 
    } 
 
8.8 Subscribing to change notifications – Deployment, OOB 
 
The following simple sample program implemented in java demonstrates a REST client that registers for change 
notifications from CSM to receive Deployment and Out of Band (OOB) events. Please note that to receive change 
notifications, the client registers a specific syslog service (IP and Port) to which CSM will sent ‘asynchronous’ 
notifications
. To see the actual notifications, please use any open source Syslog server or implement a simple UDP 
listener at the specified IP/Port (see SyslogServer element below) to list the notification content.  
 
Use the client.properties file as listed below: 
 
USER=admin 
PASSWORD=admin 
HOST=localhost 
XML_REQUEST=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\ 
<csm:eventSubRequest xmlns:csm=\"csm\">\ 
   <op>add</op>\ 
   <subscriptionId>123454</subscriptionId>\ 
   <eventFilterItem>\ 
   <filterEventType>syslog</filterEventType>\ 
   <filterEventFormat>xml</filterEventFormat>\ 
   <filterEventCategory>configChange</filterEventCategory>\ 
   </eventFilterItem>\ 
   <syslogServer>\ 
       <port>514</port>\ 
       <destAddress>10.10.10.10</destAddress>\ 
   </syslogServer>\ 
</csm:eventSubRequest> 
 
# Set LOGIN_REQUIRED to true if the URI supplied  
# requires login to be done as a prerequisite. 
LOGIN_REQUIRED=true 
URI=https://localhost/nbi/eventservice/eventSubscription
 
 
 
After compiling, use the following command to run the program: 
Command Prompt> java RestClient <path_to_client.properties> [<uri>]
 
 
Class 
RestClient.java 
 
/**
 
 * Sample program to subscribe to change events and get more details on latest change.
 
 */
 
import
 java.io.ByteArrayInputStream; 
import
 java.io.FileInputStream; 
import
 java.io.IOException; 
import
 java.net.URI; 
import
 java.security.KeyManagementException; 
import
 java.security.NoSuchAlgorithmException;