HP 2000sa HP StorageWorks MSA2000 G2 SMI-S Proxy Provider User Guide (573100-0 - Page 35

Client API Interface

Page 35 highlights

5 Client API Interface Client applications can use any supported client interface that is supported by the Pegasus CIMOM. Please refer to http://cvs.opengroup.org/pegasus-doc/ClientInterfaces.html for more details on the client interfaces supplied by Open Pegasus. Provided below is a sample C++ client application to collect Disk asset information using the HP MSA2000 G2 proxy provider. This application assumes that the proxy provider has already been configured to manage at least one MSA2000 G2 system. #include #include #include #include #include #include #include #include #include #include #include #include #include #include PEGASUS_USING_PEGASUS; PEGASUS_USING_STD; static AtomicInt errorCount(0); Array instanceRef; void connectClient( CIMClient *client, String host, Uint32 portNumber, String userName, String password, Boolean useSSL, Boolean localConnection, Uint32 timeout) { try { client->setTimeout(timeout); if (useSSL) { cout

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48

5 Client API Interface
Client applications can use any supported client interface that is supported by the Pegasus CIMOM.
Please refer to
h
t
tp://cv
s
.ope
ngr
o
u
p
.o
r
g/pega
su
s
-doc/C
li
e
n
tIn
t
e
r
f
ace
s
.h
tml
for more details on the
client interfaces supplied by Open Pegasus.
Provided below is a sample C++ client application to collect Disk asset information using the HP
MSA2000 G2 proxy provider. This application assumes that the proxy provider has already been
configured to manage at least one MSA2000 G2 system.
#include <Pegasus/Common/Thread.h>
#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/Constants.h>
#include <Pegasus/Common/PegasusVersion.h>
#include <Pegasus/Common/PegasusAssert.h>
#include <Pegasus/Client/CIMClient.h>
#include <Pegasus/Common/CIMName.h>
#include <Pegasus/Common/OptionManager.h>
#include <Pegasus/Common/FileSystem.h>
#include <Pegasus/Common/Stopwatch.h>
#include <Pegasus/Common/Exception.h>
#include <Pegasus/Common/XmlWriter.h>
#include <Pegasus/Common/AutoPtr.h>
#include <Pegasus/Common/HostLocator.h>
PEGASUS_USING_PEGASUS;
PEGASUS_USING_STD;
static AtomicInt errorCount(0);
Array<CIMObjectPath> instanceRef;
void connectClient(
CIMClient *client,
String host,
Uint32 portNumber,
String userName,
String password,
Boolean useSSL,
Boolean localConnection,
Uint32 timeout)
{
try
{
client->setTimeout(timeout);
if (useSSL)
{
cout << "SSL not supported " << endl;
exit(1);
}
else
{
if (localConnection)
{
cout << "Using local connection mechanism " << endl;
client->connectLocal();
}
else
{
cout << "Connecting to " << host << ":" << portNumber << endl;
client->connect (host, portNumber, userName, password);
#define NAMESPACE CIMNamespaceName ("root/HPQ")
#define CLASSNAME CIMName ("DHS_TopComputerSystem")
// Locate the Top Computer System instance
Array<CIMInstance> cimNInstances =
client->enumerateInstances(NAMESPACE, CLASSNAME,
MSA2000 G2 SMI-S Proxy Provider User Guide
35