Remote Lights-Out Mgmt (iLO 2, iLO, RILOE II) Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

iLO 3 read times out when I send my simple RIBCL XML commands.

Highlighted
rmcateer
Occasional Contributor

iLO 3 read times out when I send my simple RIBCL XML commands.

Hi All,

I'm using C# .NET to connect to iLO via ssl and write simple RIBCL XML commands and read the responses. This works great for iLO 1 and iLO 2 (once I got by all  the invalid xml syntax issues...)

 

But a brand new iLO 3 machine (firmware 1.26 Aug 26 2011) justs won't respond to the read at all! It always times out. No matter what I throw at it, good commands, bad commands etc, the read times out. My customers have all reported the same issue.

Are there new xml formatting issues/bugs introduced in iLO3? Even so, why is there no response at all???

 

I believe my ssl connection is fine because if I exclude the <?xml version=\"1.1\"?> line from the xml, then the web server responds with "unknown method".

I've checked all the iLO 3 settings using the browser and I'm really stuck.

Any ideas?

Rob.

16 REPLIES
rmcateer
Occasional Contributor

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

After stumbling on http://practicaladmin.wordpress.com/tag/locfg-pl/ and downloading the .tgz and looking at the locfg.pl, I see that a new http 1.1 headers are needed for iLO 3. I'm no perl expert but here's what I think is interesting from the locfg.pl file...

 

# iLO 3
print "\n----- Connected to iLO 3\n\n" if ($verbose);

my $updateribfwcmd = 0;
my $boundary;
my $sendsize;

send_or_calculate(0);                                    # Calculate $sendsize

if (!$updateribfwcmd) {
    # Send the HTTP header and begin processing the file
    send_to_client(0, "POST /ribcl HTTP/1.1\r\n");
    send_to_client(0, "HOST: $localhost\r\n");           # Mandatory for http 1.1
    send_to_client(0, "TE: chunked\r\n");
    send_to_client(0, "Connection: Close\r\n");          # Required
    send_to_client(0, "Content-length: $sendsize\r\n");  # Mandatory for http 1.1
    send_to_client(0, "\r\n");
    send_or_calculate(1);  #Send it to iLO
}

 

So I have some clues to work with now. But three new questions pop into my head...

1 - What document can I read that talks about this?

2 - Is that "TE" string for a header valid? ie will .net produce TE for the "Transfer-Encoding" header or will I have to create a boat load of my own code to deal with more non standard stuff?

/carp on

3 - Is it me or is this whole iLO thingy a dog's breakfast? Crap docs, invalid xml, bizarro headers, web site from hell...

/carp off

Ben Short
Regular Collector

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

Hi There.

 

You found my practicaladmin site :) glad it may have been of use. I moved away from using locfg.pl some time ago now due to issues with the output. mind you the windows cpqlocfg.exe is not that much better.

 

I have to agree with you on point 3. I have had issues where the XML output from the tools is invalid, which spaces getting injected into tags being the main issue along with the <?xml version> tags causing problems. The documentation is not all that bad and I have found the scripting guides (http://h20000.www2.hp.com/bizsupport/TechSupport/DocumentIndex.jsp?contentType=SupportManual&lang=en&cc=us&docIndexId=64179&taskId=101&prodTypeId=18964&prodSeriesId=1146658) reasonably comprehensive.

 

Unfortunately there is no specific "developer" documentation for the perl code - I could work out bits looking at the programming, but how all that talks back to the iLO is a bit of a dark art to me, other than knowing some HTTP interface is doing stuff.

 

Having a look at the W3 site, TE: should correspond to transfer encoding however the exact syntax is not valid:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Section 14.41

 

 

 

 

 

casantia
Acclaimed Contributor

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

Hi do you was able to resolve the communication issue to the ilo3 using c#. I'm having the same issue during the read time and I have done a few things and have not been able to get it work. The way I'm connection is using the tcpclient class that is already part of the .net framework. Let me know if you can give me a hand on it.

 

code: 

 

TcpClient

client = newTcpClient(machineName, port);

 

SslStream

sslStream = newSslStream(

client.GetStream(),

false, newRemoteCertificateValidationCallback(ValidateServerCertificate),

 

null);

 

byte[] messsage = Encoding.UTF8.GetBytes("<?xml version=\"1.1\"?>\r\n");

sslStream.Write(messsage);

sslStream.Flush();

 

string serverMessage = ReadMessage(sslStream);

 

Console.WriteLine("Server says: {0}", serverMessage);

 

Thanks

rmcateer
Occasional Contributor

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

I use HttpWebRequest from .NET. Here is some code doing a POST of a RIBCL command

 

        public string doiLO3Request(string requestRibcl)
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(iLOCertificateValidation);
            HttpWebRequest request = WebRequest.Create("https://192.168.0.100/ribcl") as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "text/xml";
            request.KeepAlive = false;
            request.SendChunked = true;
            request.Headers.Add("TE: chunked"); //iLO 3 needs this TE header instead of the proper Transfer-Encoding header
            request.ContentLength = requestRibcl.Length;
            request.GetRequestStream().Write(Encoding.ASCII.GetBytes(requestRibcl), 0, requestRibcl.Length);
            request.GetRequestStream().Flush();
            request.GetRequestStream().Close();

            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            Stream responseStream = response.GetResponseStream();
            StreamReader responseReader = new StreamReader(responseStream);
            string results = "";
            results = responseReader.ReadToEnd();
            response.Close();
            return results;
        }

        public bool iLOCertificateValidation(Object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors Errors) {
            //we don't care about certificate validity, we just want to read what the server provides
            return true;
        }

 

and requestRibcl looks like this to read server name, uid status etc...

<?xml version="1.0"?>

<RIBCL VERSION="2.22">

<LOGIN USER_LOGIN="Administrator" PASSWORD="yourAdminPasswd">

<SERVER_INFO MODE="read"><GET_SERVER_NAME/></SERVER_INFO>

<SERVER_INFO MODE="read"><GET_UID_STATUS/></SERVER_INFO>

<SERVER_INFO MODE="read"><GET_HOST_POWER_STATUS/></SERVER_INFO>

<SERVER_INFO MODE="read"><GET_SERVER_AUTO_PWR/></SERVER_INFO>

<RIB_INFO MODE="read"><GET_FW_VERSION/></RIB_INFO>

</LOGIN>

</RIBCL>

BUT, be warned, the xml required and returned is CRAP, full of non standard junk, so don't expect any xml parsing tools (ie the excellent .NET Xml.Linq.XElement) to be able to help .

 

Good luck.

Michael Leu
Occasional Visitor

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

Thanks for all for the info in this thread.

 

Regarding valid XML, have a look at the Chapter "XML enhancements" on page 113 in the Scripting Guide:

http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02774508/c02774508.pdf#page=113

---------------------------------------------------------------------------------
Navigation: Forum Site Map // ye olde ITRC Tree
@HP: please get rid of the Passport login timeout
silviudc
Occasional Contributor

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

Hi rmcateer,

Your c# code for the RIBCL POST method works great with ilo 3 and 4. However I am not getting anything but an error 404 when I run this on ilo 2 servers (with default ILO settings)

I believe it might be due to the syntax of https://192.168.0.100/ribcl as the command line scripts run and return the XML just fine.

If you just go to https://192.168.0.100/ribcl in ilo 3 or 4, you do get an XML response in the browser but error 404 in ilo 2.

Do you know if the syntax for the ilo 2 https link is different? I could not find anything in the documentation pdf for ilo 2.

Any help would be much appreciated.

rmcateer
Occasional Contributor

Re: iLO 3 read times out when I send my simple RIBCL XML commands.

I'm glad to read that the code works for iLO 4, I have no access to that version.

 

The RIBCL syntax for iLO 2 is, IIRC, bascially the same. But I could never get it to respond to a .net WebRequest, instead I write directly to the stream. Here's a sample.

        private string doiLO2Request(string requestRibcl)
        {
            SslStream sslStream = new SslStream(sslClient.GetStream(), false, new RemoteCertificateValidationCallback (iLOCertificateValidation), null);
            sslStream.AuthenticateAsClient(ServerName);
            StreamWriter writer = new StreamWriter(sslStream);
            writer.Write(requestRibcl);
            writer.Write("\r\n");
            writer.Flush();
            StreamReader reader = new StreamReader(sslStream);
            String result = reader.ReadToEnd();
            reader.Close();
            sslClient.Close();
            sslClient = null;
            return result;
        }

Good luck!

silviudc
Occasional Contributor

Great. I shall test that later on and post the results....

Great. I shall test that later on and post the results. 

Thanks again.

rmcateer
Occasional Contributor

Re: Great. I shall test that later on and post the results....

About the sslStream creation, the sslClient is a simple .NET TcpClient. I create it like so...

 

        private TcpClient sslClient {
            get {
                if (_tcpClient == null){
                    _tcpClient = new TcpClient(ServerName, 443);
                }
                return _tcpClient;
            }
            set {
                _tcpClient.Close();
                _tcpClient = value;
            }
        }

silviudc
Occasional Contributor

Re: Great. I shall test that later on and post the results....

Ok quick question, the variable ServerName, can that be the ILO ip (if yes then what is the format) or just the ILO name?

 

I have tried ILO name for your ServerName variable and I get this response:

 

 

"HTTP/1.1 405 Method Not Allowed\r\nContent-Type:text/html\r\n\r\n<HTML><HEAD><TITLE>Remote Insight</TITLE></HEAD><BODY>\r\n<H1>Request Error</H1>\r\nHTTP/1.1 405 Method Not Allowed\r\n</BODY></HTML>\r\n"

 

When sending this text to it:

 

string test = doiLO2Request("<RIBCL VERSION='2.0'>"
                            + "<LOGIN USER_LOGIN='Administrator' PASSWORD='password'>"
                            + "<SERVER_INFO MODE='read'><GET_HOST_DATA /></SERVER_INFO>"
                            + "</LOGIN>"
                            + "</RIBCL>");

 

 The thing is if I run that from the command line with CPQLOCFG, works just fine.

 

Thanks

rmcateer
Occasional Contributor

Re: Great. I shall test that later on and post the results....

ServerName can be the host name or in IPv4 format something like "192.168.0.100". I think you will the <?xml version=\"1.0\"?> part in your command.

silviudc
Occasional Contributor

Re: Great. I shall test that later on and post the results....

Yes you were right, that's what was missing. Seems it is required for ilo2 but not for 3 and 4.

Now if only there was a way to check all versions with the same code, instead of running the same thing twice basically.

 

If I run the ilo 2 pull on ilo 3 and 4 it seems it always gets Login credentials rejected:

 

"<?xml version=\"1.0\"?>\r\n<RIBCL VERSION=\"2.22\"/>\n<RESPONSE\n    STATUS=\"0x0000\"\n    MESSAGE='No error'\n     />\n</RIBCL>\n<?xml version=\"1.0\"?>\r\n<RIBCL VERSION=\"2.22\"/>\n<RESPONSE\n    STATUS=\"0x0000\"\n    MESSAGE='No error'\n     />\n<INFORM>Scripting utility should be updated to the latest version.</INFORM>\n</RIBCL>\n<?xml version=\"1.0\"?>\r\n<RIBCL VERSION=\"2.22\"/>\n<RESPONSE\n    STATUS=\"0x005F\"\n    MESSAGE='Login credentials rejected.'\n     />\n</RIBCL>\n"

 

rmcateer
Occasional Contributor

Re: Great. I shall test that later on and post the results....

I hear you on wanting a nice way to determine which version of ilo is running, but I do the "run the same thing twice" style of detection as well. I do ilo 3 first, assuming that ilo 2 will eventually disappear over time. I have a seperate detection phase where I determine the ilo version for a server. During the detection phase I use a short request.timeout so if the machine actually is ilo 2 I don't hang around for too long, but during other operatioins I use a much longer request.timeout because some of the operations take a long time (IIRC getting the status of the fans can take a long time, or maybe it was the "check health" call).

 

silviudc
Occasional Contributor

Re: Great. I shall test that later on and post the results....

Yes, that's exactly what I'm doing, try ilo3 then revert back to ilo2 depending on the response.

One could just run the get fw version script off all the servers and determine the ilo version that way then run the correct getilo#response but it will be longer to execute due to timeouts etc...

Trying both ilo scripts isn't too bad takes < 10 mins for ~100 servers which can be improved further but still this information would take a few hours to get manually :)

 

What is a good timeout value for getilo3 method, just so that you don't miss any legit servers which might take a bit longer to respond?

Ben Short
Regular Collector

Re: Great. I shall test that later on and post the results....

Another way to work out the iLO version is to query the device itself via RIMP URL:

 

http://iLOHostName/xmldata?item=ALL

 

the <PN> XML Tag will give you the data.

 

The iLO PS Library I wrote (http://practicaladmin.wordpress.com/ilo-ps-library/) has a get-iLOInfo function that can return all this information in object form if thats useful.

 

Cheers

rmcateer
Occasional Contributor

Re: Great. I shall test that later on and post the results....

That RIMP stuff is cool, never stumbled on it when I was going RIBCL work... too bad.

 

I use 10 seconds for the TCP timeout when I am doing a iLO 3 detection via httpwebrequest. Just an arbitrary choice.

//Add this to "OnDomLoad" event