/// <summary> /// Get the Status of Blade PSU ALERT /// </summary> public BladePsuAlertResponse GetBladePsuAlert(int bladeId) { BladePsuAlertResponse response = new BladePsuAlertResponse(); response.bladeNumber = bladeId; response.completionCode = Contracts.CompletionCode.Unknown; response.statusDescription = String.Empty; Tracer.WriteUserLog("Invoked GetBladePsuAlert({0})", bladeId); Tracer.WriteInfo("Received GetBladePsuAlert({0})", bladeId); if (!ConfigLoaded.PowerAlertDrivenPowerCapAPIsEnabled) { Tracer.WriteInfo("GetBladePsuAlert: User requested API not enabled in app.config"); response.completionCode = Contracts.CompletionCode.CommandNotValidAtThisTime; response.statusDescription = "PSU alert driven power cap commands are not enabled for this blade"; return response; } Contracts.ChassisResponse varResponse = ValidateRequest("GetBladePsuAlert", bladeId); if (varResponse.completionCode != Contracts.CompletionCode.Success) { response.completionCode = varResponse.completionCode; response.statusDescription = varResponse.statusDescription; return response; } BladePsuAlertResponse psuAlert = GetPsuAlert(bladeId); response = psuAlert; response.completionCode = ChassisManagerUtil.GetContractsCompletionCodeMapping((byte)psuAlert.completionCode); response.statusDescription = response.completionCode.ToString(); return response; }
/// <summary> /// Get the Status of PSU ALERT /// </summary> private BladePsuAlertResponse GetPsuAlert(int bladeId) { BladePsuAlertResponse response = new BladePsuAlertResponse(); response.bladeNumber = bladeId; response.completionCode = Contracts.CompletionCode.Unknown; response.statusDescription = String.Empty; // Issue IPMI command Ipmi.PsuAlert psuAlert = WcsBladeFacade.GetPsuAlert((byte)bladeId); if (psuAlert.CompletionCode != (byte)Contracts.CompletionCode.Success) { response.completionCode = Contracts.CompletionCode.Failure; Tracer.WriteError("GetPsuAlert failed with completion code: {0:X}", psuAlert.CompletionCode); } else { response.completionCode = Contracts.CompletionCode.Success; response.AutoProchotEnabled = psuAlert.AutoProchotEnabled; response.BmcProchotEnabled = psuAlert.BmcProchotEnabled; response.PsuAlertGpi = psuAlert.PsuAlertGpi; } response.completionCode = ChassisManagerUtil.GetContractsCompletionCodeMapping((byte)psuAlert.CompletionCode); response.statusDescription = response.completionCode.ToString(); return response; }
/// <summary> /// command specific implementation /// argVal command class member has all user-entered command argument indicators and parameter values /// Currently just prints all argument indicators and argument values /// </summary> internal override void commandImplementation() { BladePsuAlertResponse myResponse = new BladePsuAlertResponse(); AllBladesPsuAlertResponse myResponses = new AllBladesPsuAlertResponse(); try { if (this.argVal.ContainsKey('a')) { myResponses = WcsCli2CmConnectionManager.channel.GetAllBladesPsuAlert(); } else if (this.argVal.ContainsKey('i')) { dynamic bladeId = null; if (this.argVal.TryGetValue('i', out bladeId)) { myResponse = WcsCli2CmConnectionManager.channel.GetBladePsuAlert((int)bladeId); } else { Console.WriteLine(WcsCliConstants.commandFailure + " No blade ID specified, please look at command help"); return; } } } catch (Exception ex) { SharedFunc.ExceptionOutput(ex); return; } if ((this.argVal.ContainsKey('a') && myResponses == null) || (this.argVal.ContainsKey('a') && myResponses.bladePsuAlertCollection == null) || myResponse == null) { Console.WriteLine(WcsCliConstants.serviceResponseEmpty); return; } if (this.argVal.ContainsKey('a')) { foreach (var response in myResponses.bladePsuAlertCollection) { if (ResponseValidation.ValidateBladeResponse(response.bladeNumber, "PSU ALERT BMC GPI Status", response, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + string.Format(" PSU Alert BMC GPI Status for blade: {0} = {1}", response.bladeNumber, response.PsuAlertGpi)); Console.WriteLine("Auto PROCHOT on switch GPI Enabled/Disabled for blade: {0} = {1}", response.bladeNumber, response.AutoProchotEnabled); Console.WriteLine("BMC PROCHOT on switch GPI Enabled/Disabled for blade: {0} = {1}", response.bladeNumber, response.BmcProchotEnabled); } } } else { if (ResponseValidation.ValidateBladeResponse(myResponse.bladeNumber, "PSU ALERT BMC GPI Status", myResponse, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + string.Format(" PSU Alert BMC GPI Status for blade: {0} = {1}", myResponse.bladeNumber, myResponse.PsuAlertGpi)); Console.WriteLine("Auto PROCHOT on switch GPI Enabled/Disabled for blade: {0} = {1}", myResponse.bladeNumber, myResponse.AutoProchotEnabled); Console.WriteLine("BMC PROCHOT on switch GPI Enabled/Disabled for blade: {0} = {1}", myResponse.bladeNumber, myResponse.BmcProchotEnabled); } } }