version 1.6, 2007/06/26 20:26:16
|
version 1.7, 2007/06/29 17:43:11
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Yi Zhou, Hewlett-Packard Company (Yi.Zhou@hp.com) |
|
// |
|
// Modified By: |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/PegasusAssert.h> | #include <Pegasus/Common/PegasusAssert.h> |
|
|
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
class T_Parms{ |
class T_Parms |
|
{ |
public: | public: |
AutoPtr<CIMClient> client; | AutoPtr<CIMClient> client; |
Uint32 indicationSendCount; | Uint32 indicationSendCount; |
|
|
| |
/////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////// |
| |
CIMObjectPath _getFilterObjectPath |
CIMObjectPath _getFilterObjectPath(const String & name) |
(const String & name) |
|
{ | { |
Array<CIMKeyBinding> keyBindings; | Array<CIMKeyBinding> keyBindings; |
keyBindings.append (CIMKeyBinding ("SystemCreationClassName", | keyBindings.append (CIMKeyBinding ("SystemCreationClassName", |
|
|
PEGASUS_CLASSNAME_INDFILTER, keyBindings)); | PEGASUS_CLASSNAME_INDFILTER, keyBindings)); |
} | } |
| |
CIMObjectPath _getHandlerObjectPath |
CIMObjectPath _getHandlerObjectPath(const String & name) |
(const String & name) |
|
{ | { |
Array<CIMKeyBinding> keyBindings; | Array<CIMKeyBinding> keyBindings; |
keyBindings.append (CIMKeyBinding ("SystemCreationClassName", | keyBindings.append (CIMKeyBinding ("SystemCreationClassName", |
|
|
PEGASUS_CLASSNAME_INDHANDLER_SNMP, keyBindings)); | PEGASUS_CLASSNAME_INDHANDLER_SNMP, keyBindings)); |
} | } |
| |
CIMObjectPath _getSubscriptionObjectPath |
CIMObjectPath _getSubscriptionObjectPath( |
(const String & filterName, |
const String & filterName, |
const String & handlerName) | const String & handlerName) |
{ | { |
CIMObjectPath filterObjectPath = _getFilterObjectPath(filterName); | CIMObjectPath filterObjectPath = _getFilterObjectPath(filterName); |
|
|
PEGASUS_CLASSNAME_INDSUBSCRIPTION, subscriptionKeyBindings)); | PEGASUS_CLASSNAME_INDSUBSCRIPTION, subscriptionKeyBindings)); |
} | } |
| |
CIMObjectPath _createHandlerInstance |
CIMObjectPath _createHandlerInstance( |
(CIMClient & client, |
CIMClient & client, |
const String & name, | const String & name, |
const String & targetHost, | const String & targetHost, |
const String & securityName, | const String & securityName, |
|
|
handlerInstance.addProperty (CIMProperty (CIMName ("PortNumber"), | handlerInstance.addProperty (CIMProperty (CIMName ("PortNumber"), |
CIMValue ((Uint32) PORT_NUMBER))); | CIMValue ((Uint32) PORT_NUMBER))); |
| |
return(client.createInstance (PEGASUS_NAMESPACENAME_INTEROP, handlerInstance)); |
return client.createInstance( |
|
PEGASUS_NAMESPACENAME_INTEROP, handlerInstance); |
} | } |
| |
CIMObjectPath _createFilterInstance |
CIMObjectPath _createFilterInstance( |
(CIMClient & client, |
CIMClient & client, |
const String & name, | const String & name, |
const String & query, | const String & query, |
const String & qlang) | const String & qlang) |
|
|
filterInstance.addProperty (CIMProperty (CIMName ("SourceNamespace"), | filterInstance.addProperty (CIMProperty (CIMName ("SourceNamespace"), |
SOURCE_NAMESPACE.getString ())); | SOURCE_NAMESPACE.getString ())); |
| |
return(client.createInstance (PEGASUS_NAMESPACENAME_INTEROP, filterInstance)); |
return client.createInstance(PEGASUS_NAMESPACENAME_INTEROP, filterInstance); |
} | } |
| |
CIMObjectPath _createSubscriptionInstance |
CIMObjectPath _createSubscriptionInstance( |
(CIMClient & client, |
CIMClient & client, |
const CIMObjectPath & filterPath, | const CIMObjectPath & filterPath, |
const CIMObjectPath & handlerPath) | const CIMObjectPath & handlerPath) |
{ | { |
|
|
subscriptionInstance.addProperty (CIMProperty | subscriptionInstance.addProperty (CIMProperty |
(CIMName ("SubscriptionState"), CIMValue ((Uint16) 2))); | (CIMName ("SubscriptionState"), CIMValue ((Uint16) 2))); |
| |
return(client.createInstance (PEGASUS_NAMESPACENAME_INTEROP, subscriptionInstance)); |
return client.createInstance( |
|
PEGASUS_NAMESPACENAME_INTEROP, subscriptionInstance); |
} | } |
| |
void _sendTestIndication(CIMClient* client, const CIMName & methodName, |
void _sendTestIndication( |
|
CIMClient* client, |
|
const CIMName & methodName, |
Uint32 indicationSendCount) | Uint32 indicationSendCount) |
{ | { |
// | // |
|
|
PEGASUS_TEST_ASSERT (result == 0); | PEGASUS_TEST_ASSERT (result == 0); |
} | } |
| |
void _deleteSubscriptionInstance |
void _deleteSubscriptionInstance( |
(CIMClient & client, |
CIMClient & client, |
const String & filterName, | const String & filterName, |
const String & handlerName) | const String & handlerName) |
{ | { |
CIMObjectPath subscriptionObjectPath = | CIMObjectPath subscriptionObjectPath = |
_getSubscriptionObjectPath(filterName, handlerName); | _getSubscriptionObjectPath(filterName, handlerName); |
client.deleteInstance (PEGASUS_NAMESPACENAME_INTEROP, subscriptionObjectPath); |
client.deleteInstance( |
|
PEGASUS_NAMESPACENAME_INTEROP, subscriptionObjectPath); |
} | } |
| |
void _deleteHandlerInstance |
void _deleteHandlerInstance( |
(CIMClient & client, |
CIMClient & client, |
const String & name) | const String & name) |
{ | { |
CIMObjectPath handlerObjectPath = _getHandlerObjectPath(name); | CIMObjectPath handlerObjectPath = _getHandlerObjectPath(name); |
client.deleteInstance (PEGASUS_NAMESPACENAME_INTEROP, handlerObjectPath); | client.deleteInstance (PEGASUS_NAMESPACENAME_INTEROP, handlerObjectPath); |
} | } |
| |
void _deleteFilterInstance |
void _deleteFilterInstance( |
(CIMClient & client, |
CIMClient & client, |
const String & name) | const String & name) |
{ | { |
CIMObjectPath filterObjectPath = _getFilterObjectPath(name); | CIMObjectPath filterObjectPath = _getFilterObjectPath(name); |
|
|
} | } |
catch (Exception & e) | catch (Exception & e) |
{ | { |
cerr << "----- sendTestIndication failed: " << e.getMessage () << endl; |
cerr << "----- sendTestIndication failed: " << e.getMessage () << |
|
endl; |
exit (-1); | exit (-1); |
} | } |
elapsedTime.stop(); | elapsedTime.stop(); |
|
|
| |
Uint32 iterations = 0; | Uint32 iterations = 0; |
| |
// Wait until snmptrapd startted |
// Wait until snmptrapd started |
while (iterations < MAX_ITERATIONS) | while (iterations < MAX_ITERATIONS) |
{ | { |
iterations++; | iterations++; |
|
|
} | } |
} | } |
| |
void _receiveExpectedTraps(CIMClient& workClient, |
void _receiveExpectedTraps( |
|
CIMClient& workClient, |
Uint32 indicationSendCount, | Uint32 indicationSendCount, |
Uint32 runClientThreadCount) | Uint32 runClientThreadCount) |
{ | { |
|
|
CIMClient * clientConnections = new CIMClient[runClientThreadCount]; | CIMClient * clientConnections = new CIMClient[runClientThreadCount]; |
| |
// determine total number of indication send count | // determine total number of indication send count |