/// <summary> /// Get All Blades PSU ALERT Default Power Cap /// </summary> public AllBladesPsuAlertDpcResponse GetAllBladesPsuAlertDefaultPowerCap() { AllBladesPsuAlertDpcResponse responses = new AllBladesPsuAlertDpcResponse(); responses.completionCode = Contracts.CompletionCode.Unknown; responses.statusDescription = String.Empty; responses.bladeDpcResponseCollection = new List<BladePsuAlertDpcResponse>(); Contracts.CompletionCode[] bladeInternalResponseCollection = new Contracts.CompletionCode[ConfigLoaded.Population]; Tracer.WriteUserLog("Invoked GetAllBladesPsuAlertDefaultPowerCap"); Tracer.WriteInfo("Received GetAllBladsePsuAlertDefaultPowerCap for all blades"); for (int loop = 0; loop < ConfigLoaded.Population; loop++) { responses.bladeDpcResponseCollection.Add(GetBladePsuAlertDefaultPowerCap(loop + 1)); // Set the internal blade response to the blade completion code. bladeInternalResponseCollection[loop] = responses.bladeDpcResponseCollection[loop].completionCode; } Contracts.ChassisResponse varResponse = new Contracts.ChassisResponse(); varResponse = ChassisManagerUtil.ValidateAllBladeResponse(bladeInternalResponseCollection); responses.completionCode = varResponse.completionCode; responses.statusDescription = varResponse.statusDescription; return responses; }
/// <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() { BladePsuAlertDpcResponse myResponse = new BladePsuAlertDpcResponse(); AllBladesPsuAlertDpcResponse myResponses = new AllBladesPsuAlertDpcResponse(); try { if (this.argVal.ContainsKey('a')) { myResponses = WcsCli2CmConnectionManager.channel.GetAllBladesPsuAlertDefaultPowerCap(); } else if (this.argVal.ContainsKey('i')) { dynamic bladeId = null; if (this.argVal.TryGetValue('i', out bladeId)) { myResponse = WcsCli2CmConnectionManager.channel.GetBladePsuAlertDefaultPowerCap((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.bladeDpcResponseCollection == null) || myResponse == null) { Console.WriteLine(WcsCliConstants.serviceResponseEmpty); return; } if (this.argVal.ContainsKey('a')) { foreach (var response in myResponses.bladeDpcResponseCollection) { if (ResponseValidation.ValidateBladeResponse(response.bladeNumber, null, response, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + string.Format(" Default Power Cap in Watts for blade: {0} = {1}", response.bladeNumber, response.DefaultPowerCap)); Console.WriteLine("Time in milliseconds to wait before de-asserting the PROCHOT for blade: {0} = {1}", response.bladeNumber, response.WaitTime); Console.WriteLine("Default Power Cap Enabled/Disabled for blade: {0} = {1}", response.bladeNumber, response.DefaultCapEnabled); } } } else { if (ResponseValidation.ValidateBladeResponse(myResponse.bladeNumber, null, myResponse, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + string.Format(" Default Power Cap in Watts for blade: {0} = {1}", myResponse.bladeNumber, myResponse.DefaultPowerCap)); Console.WriteLine("Time in milliseconds to wait before de-asserting the PROCHOT for blade: {0} = {1}", myResponse.bladeNumber, myResponse.WaitTime); Console.WriteLine("Default Power Cap Enabled/Disabled for blade: {0} = {1}", myResponse.bladeNumber, myResponse.DefaultCapEnabled); } } }