Server Management - Remote Server Management
1752777 Members
6017 Online
108789 Solutions
New Discussion

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

 
rmcateer
Occasional Advisor

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 16
rmcateer
Occasional Advisor

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

Anonymous
Not applicable

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
New Member

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 Advisor

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
Honored Contributor

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

silviudc
Occasional Advisor

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 Advisor

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 Advisor

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 Advisor

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;
            }
        }