Exemplo n.º 1
0
        internal static void Initialize()
        {
            // For each blade
            for (int i = 0; i < ConfigLoaded.Population; i++)
            {
                // Initialize lock object for performing atomic blade power operations
                locker[i] = new object();

                // Initialize Hard Power On/Off Switches (Blade Enable)
                BladePower[i] = new BladePowerSwitch(Convert.ToByte(i + 1));
                // Get Actual Power State
                BladePower[i].GetBladePowerState();

                // Create Blade Serial Console Metadata objects and initialize token, timestamp and associated member objects using class constructor
                BladeSerialMetadata.Add(i + 1, new BladeSerialSessionMetadata(i + 1));
            }

            // For each PSU
            for (int i = 0; i < ConfigLoaded.NumPsus; i++)
            {
                psuLock[i] = new object();
            }
            PsuInitialize();

            // For each serial port
            // Create Serial Console Port Metadata objects and initialize the sessiontoken and timestamp using the class constructor
            SerialConsolePortsMetadata = new SerialConsoleMetadata[(uint)ConfigLoaded.MaxSerialConsolePorts];
            for (int numPorts = 0; numPorts < (int)ConfigLoaded.MaxSerialConsolePorts; numPorts++)
            {
                SerialConsolePortsMetadata[numPorts] = new SerialConsoleMetadata(ChassisManagerUtil.GetSerialConsolePortIdFromIndex(numPorts), DateTime.Now);
            }

            // Create AC Power Socket objects
            AcPowerSockets = new AcSocket[(uint)ConfigLoaded.NumPowerSwitches];
            for (int numSockets = 0; numSockets < (int)ConfigLoaded.NumPowerSwitches; numSockets++)
            {
                AcPowerSockets[numSockets] = new AcSocket((byte)(numSockets + 1));
            }

            WatchDogTimerInitialize();

            // Create fan objects
            for (int fanId = 0; fanId < (int)ConfigLoaded.NumFans; fanId++)
            {
                Fans[fanId] = new Fan((byte)(fanId + 1));
            }
        }
Exemplo n.º 2
0
        internal static void Initialize()
        {
            for (int i = 0; i < ConfigLoaded.Population; i++)
            {
                _lock[i] = new object();
            }

            // Create Serial Console Port Metadata objects and initialize the sessiontoken and timestamp using the class constructor
            SerialConsolePortsMetadata = new SerialConsoleMetadata[(uint)ConfigLoaded.MaxSerialConsolePorts];
            for (int numPorts = 0; numPorts < (int)ConfigLoaded.MaxSerialConsolePorts; numPorts++)
            {
                SerialConsolePortsMetadata[numPorts] = new SerialConsoleMetadata(ChassisManagerUtil.GetSerialConsolePortIdFromIndex(numPorts), ConfigLoaded.InactiveSerialPortSessionToken, DateTime.Now);
            }

            // Create AC Power Socket objects
            AcPowerSockets = new AcSocket[(uint)ConfigLoaded.NumPowerSwitches];
            for (int numSockets = 0; numSockets < (int)ConfigLoaded.NumPowerSwitches; numSockets++)
            {
                AcPowerSockets[numSockets] = new AcSocket((byte)(numSockets + 1));
            }

            // Create PSU objects
            for (int psuIndex = 0; psuIndex < (int)ConfigLoaded.NumPsus; psuIndex++)
            {
                // Initially create instance of the base class
                // Later.. based on the psu model number, we create the appropriate psu class object
                Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1));
            }

            // Create fan objects
            for (int fanId = 0; fanId < (int)ConfigLoaded.NumPsus; fanId++)
            {
                Fans[fanId] = new Fan((byte)(fanId + 1));
            }

            // Initialize Hard Power On/Off Switches (Blade Enable)
            for (int bladeId = 0; bladeId < BladePower.Length; bladeId++)
            {
                BladePower[bladeId] = new BladePowerSwitch(Convert.ToByte(bladeId + 1));
            }
        }
Exemplo n.º 3
0
        private static void ExecuteAllBladeCommands()
        {
            Tracer.Write("");
            Tracer.Write("*********************************************************");
            Tracer.Write(string.Format("***** BMC Command Execution: {0} ******", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
            Tracer.Write("*********************************************************");
            Tracer.Write("");

            ResponseBase response = new CustomResponse(failure);

            BladePowerSwitch powerPacket = new BladePowerSwitch(bladeId);
            BladePowerStatePacket powerOff = powerPacket.SetBladePowerState(0x00);

            if (powerOff.CompletionCode == CompletionCode.Success)
            {
                Console.WriteLine("Power Blade Off");
            }
            else
            {
                Console.WriteLine("ERROR: Could not power Blade Off");
            }

            BladePowerStatePacket powerOn = powerPacket.SetBladePowerState(0x01);
            Console.WriteLine("Power Blade On");
            if(powerOn.CompletionCode == CompletionCode.Success)
            {
                Console.WriteLine("Waiting for Decompression Time: {0}", powerOn.DecompressionTime);
                Tracer.Write("Waiting for Decompression Time: {0}", powerOn.DecompressionTime);
                Thread.Sleep(TimeSpan.FromSeconds(powerOn.DecompressionTime));
            }

            // Get the Power Status of a given device
            response = WcsBladeFacade.GetPowerStatus(bladeId);
            ValidateResponse(response, "Get Power Status");

            // Get Sensor Reading
            response = WcsBladeFacade.GetSensorReading(bladeId, 0x01);
            ValidateResponse(response, "Get Sensor Reading");

            // Get Blade Information
            BladeStatusInfo bladeInfo = WcsBladeFacade.GetBladeInfo(bladeId);
            ValidateResponse(response, "Get Blade Info");

            // Get Fru Device info for Given Device Id
            FruDevice fru = WcsBladeFacade.GetFruDeviceInfo(bladeId);
            ValidateResponse(response, "Get Fru Device");

            // Queries BMC for the currently set boot device.
            response = WcsBladeFacade.GetNextBoot(bladeId);
            ValidateResponse(response, "Get Next Boot");

            // Set next boot device
            response = WcsBladeFacade.SetNextBoot(bladeId, BootType.ForceDefaultHdd, true, false);
            ValidateResponse(response, "Set Next Boot");

            // Physically identify the computer by using a light or sound.
            if (WcsBladeFacade.Identify(bladeId, 255))
            {
                ValidateResponse(new CustomResponse(success), "Set Identify: On");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "Set Identify: On");
            }

            // Physically identify the computer by using a light or sound.
            if (WcsBladeFacade.Identify(bladeId, 0))
            {
                ValidateResponse(new CustomResponse(success), "Set Identify: Off");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "Set Identify: Off");
            }

            // Set the Power Cycle interval.
            if (WcsBladeFacade.SetPowerCycleInterval(bladeId, 0x08))
            {
                ValidateResponse(new CustomResponse(success), "Set Power Cycle Interval: 8");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "Set Power Cycle Interval: 8");
            }

            // Set the computer power state Off
            if (WcsBladeFacade.SetPowerState(bladeId, IpmiPowerState.Off) == 0x00)
            {
                ValidateResponse(new CustomResponse(success), "SetPowerState: Off");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "SetPowerState: Off");
            }

            // Set the computer power state On
            if (WcsBladeFacade.SetPowerState(bladeId, IpmiPowerState.On) == 0x00)
            {
                ValidateResponse(new CustomResponse(success), "SetPowerState: On");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "SetPowerState: On");
            }

            // Gets BMC firmware revision.  Returns HEX string.
            response = WcsBladeFacade.GetFirmware(bladeId);
            ValidateResponse(response, "Get Firmware");

            // Queries BMC for the GUID of the system.
            response = WcsBladeFacade.GetSystemGuid(bladeId);
            ValidateResponse(response, "Get System Guid");

            // Reset SEL Log
            WcsBladeFacade.ClearSel(bladeId);
            ValidateResponse(response, "Clear Sel");

            // Recursively retrieves System Event Log entries.
            response = WcsBladeFacade.GetSel(bladeId);
            ValidateResponse(response, "Get Sel");

            //  Get System Event Log Information. Returns SEL Info.
            response = WcsBladeFacade.GetSelInfo(bladeId);
            ValidateResponse(response, "Get Sel Info");

            // Get Device Id Command
            response = WcsBladeFacade.GetDeviceId(bladeId);
            ValidateResponse(response, "Get DeviceId");

            // Get/Set Power Policy
            response = WcsBladeFacade.SetPowerRestorePolicy(bladeId, PowerRestoreOption.StayOff);
            ValidateResponse(response, "Set Power Restore Policy: Off");

            response = WcsBladeFacade.SetPowerRestorePolicy(bladeId, PowerRestoreOption.AlwaysPowerUp);
            ValidateResponse(response, "Set Power Restore Policy: Always On");

            // Switches Serial Port Access from BMC to System for Console Redirection
            response = WcsBladeFacade.SetSerialMuxSwitch(bladeId);
            ValidateResponse(response, "Set Serial MuxSwitch");

            // Disable Safe Mode.
            CommunicationDevice.DisableSafeMode();

            // Switches Serial port sharing from System to Bmc
            response = WcsBladeFacade.ResetSerialMux(bladeId);
            ValidateResponse(response, "Reset Serial Mux");

            // Get the current advanced state of the host computer.
            response = WcsBladeFacade.GetChassisState(bladeId);
            ValidateResponse(response, "Get Chassis State");

            // Get Processor Information
            response = WcsBladeFacade.GetProcessorInfo(bladeId, 0x01);
            ValidateResponse(response, "Get Processor Info");

            // Get Memory Information
            response = WcsBladeFacade.GetMemoryInfo(bladeId, 0x01);
            ValidateResponse(response, "Get Memory Info");

            // Get PCIe Info
            response = WcsBladeFacade.GetPCIeInfo(bladeId, 0x01);
            ValidateResponse(response, "Get PCIe Info");

            // Get Nic Info
            response = WcsBladeFacade.GetNicInfo(bladeId, 0x01);
            ValidateResponse(response, "Get Nic Info");

            // Get Hardware Info
            HardwareStatus hwStatus = WcsBladeFacade.GetHardwareInfo(bladeId, true, true,
                        true, true, true, true, true, true, true);

            if (hwStatus.CompletionCode == 0x00)
            { ValidateResponse(new CustomResponse(success), "Hardware Status"); }
            else
            { ValidateResponse(new CustomResponse(failure), "Hardware Status"); }

            // DCMI Get Power Limit Command
            response = WcsBladeFacade.GetPowerLimit(bladeId);
            ValidateResponse(response, "Get Power Limit");

            // DCMI Set Power Limit Command
            response = WcsBladeFacade.SetPowerLimit(bladeId, 220, 6000, 0x00, 0x00);
            ValidateResponse(response, "Set Power Limit");

            // DCMI Get Power Reading Command
            List<PowerReading> pwReadings = WcsBladeFacade.GetPowerReading(bladeId);
            if(pwReadings.Count > 0)
            {
                ValidateResponse(pwReadings[0], "Get Power Reading");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "Get Power Reading");
            }

            // Activate/Deactivate DCMI power limit
            if (WcsBladeFacade.ActivatePowerLimit(bladeId, true))
            {
                ValidateResponse(new CustomResponse(success), "Activate Power Limit");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "Activate Power Limit");
            }

            if (WcsBladeFacade.ActivatePowerLimit(bladeId, false))
            {
                ValidateResponse(new CustomResponse(success), "Activate Power Limit");
            }
            else
            {
                ValidateResponse(new CustomResponse(failure), "Activate Power Limit");
            }

            StressSession();
        }
Exemplo n.º 4
0
        internal static void Initialize()
        {
            for (int i = 0; i < ConfigLoaded.Population; i++)
            {
                _lock[i] = new object();
            }

            // Create Serial Console Port Metadata objects and initialize the sessiontoken and timestamp using the class constructor
            SerialConsolePortsMetadata = new SerialConsoleMetadata[(uint)ConfigLoaded.MaxSerialConsolePorts];
            for (int numPorts = 0; numPorts < (int)ConfigLoaded.MaxSerialConsolePorts; numPorts++)
            {
                SerialConsolePortsMetadata[numPorts] = new SerialConsoleMetadata(ChassisManagerUtil.GetSerialConsolePortIdFromIndex(numPorts), ConfigLoaded.InactiveSerialPortSessionToken, DateTime.Now);
            }

            // Create AC Power Socket objects 
            AcPowerSockets = new AcSocket[(uint)ConfigLoaded.NumPowerSwitches];
            for (int numSockets = 0; numSockets < (int)ConfigLoaded.NumPowerSwitches; numSockets++)
            {
                AcPowerSockets[numSockets] = new AcSocket((byte)(numSockets + 1));
            }

            // Create PSU objects
            for (int psuIndex = 0; psuIndex < (int)ConfigLoaded.NumPsus; psuIndex++)
            {
                // Initially create instance of the base class
                // Later.. based on the psu model number, we create the appropriate psu class object
                Psu[psuIndex] = new PsuBase((byte)(psuIndex + 1));
            }

            // Create fan objects
            for (int fanId = 0; fanId < (int)ConfigLoaded.NumPsus; fanId++)
            {
                Fans[fanId] = new Fan((byte)(fanId + 1));
            }

            // Initialize Hard Power On/Off Switches (Blade Enable)
            for (int bladeId = 0; bladeId < BladePower.Length; bladeId++)
            {
                BladePower[bladeId] = new BladePowerSwitch(Convert.ToByte(bladeId + 1));
            }

        }
Exemplo n.º 5
0
        internal static void Initialize()
        {
            for (int i = 0; i < ConfigLoaded.Population; i++)
            {
                locker[i] = new object();
            }

            for (int i = 0; i < ConfigLoaded.NumPsus; i++)
            {
                psuLock[i] = new object();
            }

            // Create Serial Console Port Metadata objects and initialize the sessiontoken and timestamp using the class constructor
            SerialConsolePortsMetadata = new SerialConsoleMetadata[(uint)ConfigLoaded.MaxSerialConsolePorts];
            for (int numPorts = 0; numPorts < (int)ConfigLoaded.MaxSerialConsolePorts; numPorts++)
            {
                SerialConsolePortsMetadata[numPorts] = new SerialConsoleMetadata(ChassisManagerUtil.GetSerialConsolePortIdFromIndex(numPorts), ConfigLoaded.InactiveSerialPortSessionToken, DateTime.Now);
            }

            // Create AC Power Socket objects
            AcPowerSockets = new AcSocket[(uint)ConfigLoaded.NumPowerSwitches];
            for (int numSockets = 0; numSockets < (int)ConfigLoaded.NumPowerSwitches; numSockets++)
            {
                AcPowerSockets[numSockets] = new AcSocket((byte)(numSockets + 1));
            }

            PsuInitialize();
            WatchDogTimerInitialize();

            // Create fan objects
            for (int fanId = 0; fanId < (int)ConfigLoaded.NumFans; fanId++)
            {
                Fans[fanId] = new Fan((byte)(fanId + 1));
            }

            // Initialize Hard Power On/Off Switches (Blade Enable)
            for (int bladeId = 0; bladeId < BladePower.Length; bladeId++)
            {
                BladePower[bladeId] = new BladePowerSwitch(Convert.ToByte(bladeId + 1));
                // Get Actual Power State
                BladePower[bladeId].GetBladePowerState();
            }
        }