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 <OFE5C37529.1CDB493B-ON65257A1B.00335E51-65257A1B.0033AB26@in.ibm.com>
I think you can look into example that is given in

src/Providers/TestProviders/Load/CLITestProviderR.mof
src/Providers/TestProviders/CLITestProvider(ReferenceParamTest)

for example ( how to pass ref parameter array to invoke method )
>>>
bash-4.1# cimcli im Test_CLITestEmbeddedClass -n test/TestProvider
embeddedInstParamMethod referenceParamArray={Test_CLITestProviderClass
id=100 }  referenceParamArray={Test_CLITestProviderClass id=101 }
Return Value= 0
reference referenceParamArray=Test_CLITestProviderClass.Id="100"
Test_CLITestProviderClass.Id="101"
<<<

Regards
Ashok


                                                                           
             "Hwang, Johnny"                                               
             <Johnny.Hwang@net                                             
             app.com>                                                   To 
                                       "Hwang, Johnny"                     
             06/12/2012 12:15          <[email protected]>, Ashok K  
             PM                        Pathak/India/IBM@IBMIN,             
                                                                        cc 
                                       "[email protected]"         
                                       <[email protected]>         
                                                                   Subject 
                                       RE: How do I pass in an array of    
                                       references to cimcli?               
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Ugh retract previous message. Brain is fried. The provider is fine
accepting reference param array. The problem is cimcli doesn't support
passing an array of refs.

-----Original Message-----
From: Hwang, Johnny
Sent: Monday, June 11, 2012 11:44 PM
To: 'Ashok K Pathak'
Cc: [email protected]
Subject: RE: How do I pass in an array of references to cimcli?

References is fine, but for array of references, it looks like I need to
pull some changes from the nightlies.

-----Original Message-----
From: Ashok K Pathak [mailto:[email protected]]
Sent: Monday, June 11, 2012 11:19 PM
To: Hwang, Johnny
Cc: [email protected]
Subject: Re: How do I pass in an array of references to cimcli?

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?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.