HMC

 View Only
Expand all | Collapse all

HMC RestAPI & CLIRunner

  • 1.  HMC RestAPI & CLIRunner

    Posted Sat November 03, 2018 06:06 AM

    Originally posted by: Bart_G


    Hello,

    HMC development, can you confirm that CLIRunner works thru REST API? I followed this instruction https://www.ibm.com/support/knowledgecenter/9040-MR9/p9ehl/apis/CLIRunner_ManagementConsole.htm but I wasn't able to get positive result for any listed 'supported' commands. I opened PMR for it - TS001559713. I need an alternative way to communicate with VIOS using viosvrcmd command ( I don't want to use ssh). According to the documentation I should be able to do it but I wasn't successful. All CLIRunner commands  ends with error 'An internal error has occurred. This indicates either an unexpected framework problem or a programming defect. Please contact support."

    Moreover, in the XML body example, lssyscfg -r sys command is used for the example. While lssyscfg command is not on the list of supported commands for CLIRunnner.

     

    I thought CLIRunner is used for PowerVC for communication, so it should be possible to use it. However, there is completely lack of documentation.



  • 2.  Re: HMC RestAPI & CLIRunner

    Posted Sat November 03, 2018 10:52 PM

    Originally posted by: manjunathns


    Hi,

     

    The CLIRunner Job is still being supported in the HMC. I am not sure on the version of HMC you are using. And yes, we did not want to support all the CLI commands through this REST Job. PowerVC still uses this Job for performing some operations.

    Having said that, we agree that the documentation needs to be updated. We will look into the PMR you have opened for the reason for failure of the Job. But below is the sample CLIRunner payload to execute the viosvrcmd command. Please try this and let me know if you see any issue..

     

    Along wit the X-Api-Session token, you also need to pass Content-Type = application/vnd.ibm.powervm.web+xml; type=JobRequest in the header.

     

    <JobRequest:JobRequest
     xmlns:JobRequest="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"
     xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/"
     xmlns:ns2="http://www.w3.org/XML/1998/namespace/k2" schemaVersion="V1_0">
        <Metadata>
            <Atom/>
        </Metadata>
        <RequestedOperation kxe="false" kb="CUR" schemaVersion="V1_0">
            <Metadata>
                <Atom/>
            </Metadata>
            <OperationName kxe="false" kb="ROR">CLIRunner</OperationName>
            <GroupName kxe="false" kb="ROR">ManagementConsole</GroupName>
        </RequestedOperation>
        <JobParameters kxe="false" kb="CUR" schemaVersion="V1_0">
            <Metadata>
                <Atom/>
            </Metadata>
          <JobParameter schemaVersion="V1_0">
                <Metadata>
                    <Atom/>
                </Metadata>
                <ParameterName kxe="false" kb="ROR">cmd</ParameterName>
                <ParameterValue kxe="false" kb="CUR">viosvrcmd -m jill --id 1 -c "ioslevel"</ParameterValue>
            </JobParameter>
          <JobParameter schemaVersion="V1_0">
                <Metadata>
                    <Atom/>
                </Metadata>
                <ParameterName kxe="false" kb="ROR">acknowledgeThisAPIMayGoAwayInTheFuture</ParameterName>
                <ParameterValue kxe="false" kb="CUR">true</ParameterValue>
            </JobParameter>
        </JobParameters>
    </JobRequest:JobRequest>

     

    Please try this payload, and let me know if you see any issue. Thanks!

    -Manju



  • 3.  Re: HMC RestAPI & CLIRunner

    Posted Sun November 04, 2018 07:43 AM

    Originally posted by: Bart_G


    Thank you Manju,

    It helped, and I'm able to submit CLIRunner query. It would be appreciated if the documentation gets updated.



  • 4.  Re: HMC RestAPI & CLIRunner

    Posted Sun November 04, 2018 10:54 PM

    Originally posted by: manjunathns


    Hi,

     

    Sure, We will update the REST Api documentation accordingly. Thanks!

    -Manju



  • 5.  Re: HMC RestAPI & CLIRunner

    Posted Fri December 07, 2018 09:19 AM

    Originally posted by: Sridevi Joshi


    KC REST API documentation is updated with allowed command for CLI runner Job