Re: How do I pass in an array of references to cimcli?
Ashok K Pathak <[email protected]>
| Newsgroups | gmane.network.open-pegasus.general |
|---|---|
| Message-ID | <OF7BE9B3D0.BD000A7E-ON65257A1B.00228028-65257A1B.0022C2EF@in.ibm.com> |
The reference could be specified using the string form of a CIM object
path. For a
class reference, it is simply specifying the class name or
"<namespace>:<classname>".
some test example
TestMethodTestProvider.cpp
(src/Providers/TestProviders/MethodTestProvider/testclient)
/* Test for method invoke and response that handles ref parameter arrays.
This functions sends two ref array in parameters and expects exactly the
same reference arrays back in the two out parameters.
*/
void callMethodRefParamArray(const CIMName& methodName)
{
try
{
CIMClient client;
client.connectLocal();
Array<CIMParamValue> inParams;
Array<CIMParamValue> outParams;
CIMObjectPath instName =
CIMObjectPath("Test_MethodProviderClass.Id=1");
CIMObjectPath inParamA1(
String("//atp:77/root/cimv2:CIM_ComputerSystem."
"last=\"Rafter\",first=\"Patrick\""));
CIMObjectPath inParamA2(
String("//atp:77/root/cimv2:CIM_ComputerSystem."
"last=\"Rafter\",first=\"Rafter\""));
CIMObjectPath inParamB1(
String("//atp:77/root/cimv2:CIM_ComputerSystem."
"last=\"Rafter\",first=\"Fred\""));
CIMObjectPath inParamB2(
String("//atp:77/root/cimv2:CIM_ComputerSystem."
"last=\"Rafter\",first=\"John\""));
Array<CIMObjectPath> InParamAArray;
InParamAArray.append(inParamA1);
InParamAArray.append(inParamA2);
CIMValue inParam1(InParamAArray);
Array<CIMObjectPath> InParamBArray;
InParamBArray.append(inParamB1);
InParamBArray.append(inParamB2);
CIMValue inParam2(InParamBArray);
inParams.append(CIMParamValue("InParam1", inParam1));
inParams.append(CIMParamValue("InParam2", inParam2));
CIMValue returnValue = client.invokeMethod(ou
NAMESPACE,
instName,
methodName,
inParams,
outParams);
Uint32 rc;
returnValue.get(rc);
PEGASUS_TEST_ASSERT(rc == 10);
PEGASUS_TEST_ASSERT(outParams.size() == 2);
Array<CIMObjectPath> outParam1;
Array<CIMObjectPath> outParam2;
for (Uint32 i = 0; i < 2; i++)
{
if (outParams[i].getParameterName() == "OutParam1")
{
outParams[i].getValue().get(outParam1);
}
else if (outParams[i].getParameterName() == "OutParam2")
{
outParams[i].getValue().get(outParam2);
}
else
{k
PEGASUS_TEST_ASSERT(0);
}
}
PEGASUS_TEST_ASSERT(outParam1 == inParam1);
PEGASUS_TEST_ASSERT(outParam2 == inParam2);
}
catch (Exception& e)
{
cerr << "Error: " << e.getMessage() << endl;
exit(1);
}
}
I am not sure whether cimcli handles that parameter type correctly , if you
see any issue with ref parameter passing you can
raise a defect in bugzilla to address it
Regards
Ashok
"Hwang, Johnny"
<Johnny.Hwang@net
app.com> To
"[email protected]"
06/12/2012 05:49 <[email protected]>,
AM cc
Subject
How do I pass in an array of
references to cimcli?
I’m using Pegasus 2.11.1 with Bug 9007 patch
http://bugzilla.openpegasus.org/show_bug.cgi?id=9007
This is what I need to pass:
Description ("The list of Identities to assign privilege to share")
: Translatable] reference Identities[],
This is what I’m trying to do:
[root@smis-rhel5x64-07 ~]# cimcli -n root/ontap im
'ONTAP_FileExportService.CreationClassName="ONTAP_FileExportService",Name="ONTAP
File Export
Service",SystemCreationClassName="ONTAP_StorageSystem",SystemName="ONTAP:12345"'
AssignPrivilegeToExportedShare Identities=
{ 'ONTAP_Identity.InstanceID="ONTAP:12345:NETAPP\\user1"'
'ONTAP_Identity.InstanceID="ONTAP:12345:NETAPP\\user2"'}
/usr/ontap/smis/pegasus/bin/cimcli Pegasus Exception: The CIM name is not
valid: ONTAP_Identity.InstanceID="ONTAP:12345:NETAPP\\user1". Cmd = im
Object =
ONTAP_FileExportService.CreationClassName="ONTAP_FileExportService",Name="ONTAP
File Export
Service",SystemCreationClassName="ONTAP_StorageSystem",SystemName="ONTAP:12345"
WARNING: Expected exit code 0. Program delivered exit code (50) Pegasus
Exception
How do I pass an array reference as a parameter properly?