Esempio n. 1
0
        private void ConnectThread(object data)
        {
            try
            {
                ConnectInfo ci = data as ConnectInfo;

                int handle = -1;
                int status = -1;

                UpdateConnectionStatus("Connecting...");
                if (ci.Remote == true)
                {
                    ErrorLog.WriteLine(string.Format("Connecting to Remote Host ({0}, {1}, {2})...", ci.Ip, ci.User, ci.Pass));
                    NMPRK.nmprk_connect_remote_parameters_t input = new NMPRK.nmprk_connect_remote_parameters_t();
                    input.ipOrHostname = ci.Ip;
                    input.username = ci.User;
                    input.password = ci.Pass;
                    status = NMPRK.NMPRK_API.ConnectRemote(ref input, ref handle);
                }
                else
                {
                    ErrorLog.WriteLine("Connecting to Local Host...");
                    status = NMPRK.NMPRK_API.ConnectLocal(ref handle);
                }

                ErrorLog.WriteLine("Connect Status: " + status);
                if (status == 0)
                {
                    byte channel = 0;
                    byte address = 0;

                    if (ci.UseManualBridgingInfo == true)
                    {
                        channel = ci.Channel;
                        address = ci.Address;
                        AddConnectionInfoItem("Bridging Channel", "0x" + channel.ToString("X2"));
                        AddConnectionInfoItem("Bridging Address", "0x" + address.ToString("X2"));
                    }
                    else
                    {
                        ErrorLog.WriteLine("Searching for NM Discovery Parameters...");
                        UpdateConnectionStatus("Searching for NM Discovery Parameters...");
                        NMPRK.nm_discovery_parameters_t parameters = new NMPRK.nm_discovery_parameters_t();
                        status = NMPRK.NMPRK_API.GetDiscoveryParameters(handle, ref parameters);
                        if (status != NMPRK.NMPRK_API.NMPRK_SUCCESS)
                        {
                            DisplayNmprkError("GetDiscoveryParameters", status, "The server may not support Node Manager or has not implemented the 'Node Manager OEM SDR'");
                            NMPRK.NMPRK_API.Disconnect(handle);
                            ConnectThreadComplete(false);
                            return;
                        }

                        channel = parameters.channel;
                        address = parameters.address;

                        AddConnectionInfoItem("Bridging Channel", "0x" + channel.ToString("X2"));
                        AddConnectionInfoItem("Bridging Address", "0x" + address.ToString("X2"));
                        AddConnectionInfoItem("Health Event Sensor", "0x" + parameters.nmHealthEvSensor.ToString("X2"));
                        AddConnectionInfoItem("Exception Event Sensor", "0x" + parameters.nmExceptionEvSensor.ToString("X2"));
                        AddConnectionInfoItem("Operational Capabilities Sensor", "0x" + parameters.nmOperationalCapSensor.ToString("X2"));
                        AddConnectionInfoItem("Alert Threshold Exceeded Sensor", "0x" + parameters.nmAlertThresExcdSensor.ToString("X2"));
                    }

                    ErrorLog.WriteLine("NM Channel: 0x" + channel.ToString("X2"));
                    ErrorLog.WriteLine("NM Address: 0x" + address.ToString("X2"));
                    status = NMPRK.NMPRK_API.SetDefaultNmCommandBridging(handle, channel, address);
                    if (status != NMPRK.NMPRK_API.NMPRK_SUCCESS)
                    {
                        DisplayNmprkError("SetDefaultNmCommandBridging", status);
                        NMPRK.NMPRK_API.Disconnect(handle);
                        ConnectThreadComplete(false);
                        return;
                    }

                    NMPRK.nm_get_version_output_t versionOutput = new NMPRK.nm_get_version_output_t();
                    status = NMPRK.NMPRK_API.GetVersion(handle, ref versionOutput);
                    if (status == NMPRK.NMPRK_API.NMPRK_SUCCESS)
                    {
                        currentConnectionNmVersion = versionOutput.version;
                        AddConnectionInfoItem("IPMI Version", "0x" + versionOutput.ipmiVersion.ToString("X2"));
                        AddConnectionInfoItem("Node Manager Version", "0x" + versionOutput.version.ToString("X2"));
                        AddConnectionInfoItem("Major Firmware Revision", "0x" + versionOutput.majorFirmwareRevision.ToString("X2"));
                        AddConnectionInfoItem("Minor Firmware Revision", "0x" + versionOutput.minorFirmwareRevision.ToString("X2"));
                    }

                    _connectionHandle = handle;
                    _connected = true;
                    ConnectThreadComplete(true);
                }
                else
                {
                    DisplayNmprkError("Connect", status);
                    NMPRK.NMPRK_API.Disconnect(handle);
                    ConnectThreadComplete(false);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogException(ex);
            }
        }
Esempio n. 2
0
        private void ConnectThread(object data)
        {
            try
            {
                ConnectInfo ci = data as ConnectInfo;

                int handle = -1;
                int status = -1;

                UpdateConnectionStatus("Connecting...");
                if (ci.Remote == true)
                {
                    ErrorLog.WriteLine(string.Format("Connecting to Remote Host ({0}, {1}, {2})...", ci.Ip, ci.User, ci.Pass));
                    NMPRK.nmprk_connect_remote_parameters_t input = new NMPRK.nmprk_connect_remote_parameters_t();
                    input.ipOrHostname = ci.Ip;
                    input.username     = ci.User;
                    input.password     = ci.Pass;
                    status             = NMPRK.NMPRK_API.ConnectRemote(ref input, ref handle);
                }
                else
                {
                    ErrorLog.WriteLine("Connecting to Local Host...");
                    status = NMPRK.NMPRK_API.ConnectLocal(ref handle);
                }

                ErrorLog.WriteLine("Connect Status: " + status);
                if (status == 0)
                {
                    byte channel = 0;
                    byte address = 0;

                    if (ci.UseManualBridgingInfo == true)
                    {
                        channel = ci.Channel;
                        address = ci.Address;
                        AddConnectionInfoItem("Bridging Channel", "0x" + channel.ToString("X2"));
                        AddConnectionInfoItem("Bridging Address", "0x" + address.ToString("X2"));
                    }
                    else
                    {
                        ErrorLog.WriteLine("Searching for NM Discovery Parameters...");
                        UpdateConnectionStatus("Searching for NM Discovery Parameters...");
                        NMPRK.nm_discovery_parameters_t parameters = new NMPRK.nm_discovery_parameters_t();
                        status = NMPRK.NMPRK_API.GetDiscoveryParameters(handle, ref parameters);
                        if (status != NMPRK.NMPRK_API.NMPRK_SUCCESS)
                        {
                            DisplayNmprkError("GetDiscoveryParameters", status, "The server may not support Node Manager or has not implemented the 'Node Manager OEM SDR'");
                            NMPRK.NMPRK_API.Disconnect(handle);
                            ConnectThreadComplete(false);
                            return;
                        }

                        channel = parameters.channel;
                        address = parameters.address;

                        AddConnectionInfoItem("Bridging Channel", "0x" + channel.ToString("X2"));
                        AddConnectionInfoItem("Bridging Address", "0x" + address.ToString("X2"));
                        AddConnectionInfoItem("Health Event Sensor", "0x" + parameters.nmHealthEvSensor.ToString("X2"));
                        AddConnectionInfoItem("Exception Event Sensor", "0x" + parameters.nmExceptionEvSensor.ToString("X2"));
                        AddConnectionInfoItem("Operational Capabilities Sensor", "0x" + parameters.nmOperationalCapSensor.ToString("X2"));
                        AddConnectionInfoItem("Alert Threshold Exceeded Sensor", "0x" + parameters.nmAlertThresExcdSensor.ToString("X2"));
                    }

                    ErrorLog.WriteLine("NM Channel: 0x" + channel.ToString("X2"));
                    ErrorLog.WriteLine("NM Address: 0x" + address.ToString("X2"));
                    status = NMPRK.NMPRK_API.SetDefaultNmCommandBridging(handle, channel, address);
                    if (status != NMPRK.NMPRK_API.NMPRK_SUCCESS)
                    {
                        DisplayNmprkError("SetDefaultNmCommandBridging", status);
                        NMPRK.NMPRK_API.Disconnect(handle);
                        ConnectThreadComplete(false);
                        return;
                    }

                    NMPRK.nm_get_version_output_t versionOutput = new NMPRK.nm_get_version_output_t();
                    status = NMPRK.NMPRK_API.GetVersion(handle, ref versionOutput);
                    if (status == NMPRK.NMPRK_API.NMPRK_SUCCESS)
                    {
                        currentConnectionNmVersion = versionOutput.version;
                        AddConnectionInfoItem("IPMI Version", "0x" + versionOutput.ipmiVersion.ToString("X2"));
                        AddConnectionInfoItem("Node Manager Version", "0x" + versionOutput.version.ToString("X2"));
                        AddConnectionInfoItem("Major Firmware Revision", "0x" + versionOutput.majorFirmwareRevision.ToString("X2"));
                        AddConnectionInfoItem("Minor Firmware Revision", "0x" + versionOutput.minorFirmwareRevision.ToString("X2"));
                    }

                    _connectionHandle = handle;
                    _connected        = true;
                    ConnectThreadComplete(true);
                }
                else
                {
                    DisplayNmprkError("Connect", status);
                    NMPRK.NMPRK_API.Disconnect(handle);
                    ConnectThreadComplete(false);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogException(ex);
            }
        }
Esempio n. 3
0
 protected override int InvokeInternal(int handle)
 {
     NMPRK.nm_get_version_output_t output = new NMPRK.nm_get_version_output_t();
     int compCode = NMPRK.NMPRK_API.GetVersion(handle, ref output);
     _output.Update(compCode, output);
     return (ReturnValue = compCode);
 }