/// <summary> /// Get all blades datasafe power state /// </summary> /// <returns>Blade state response class object</returns> public DatasafeAllBladesPowerStateResponse GetAllBladesDatasafePowerState() { byte MaxbladeCount = (byte)ConfigLoaded.Population; DatasafeAllBladesPowerStateResponse responses = new DatasafeAllBladesPowerStateResponse(); responses.completionCode = Contracts.CompletionCode.Unknown; responses.statusDescription = string.Empty; responses.datasafeBladePowerStateResponseCollection = new List<DatasafeBladePowerStateResponse>(); Contracts.CompletionCode[] bladeInternalResponseCollection = new Contracts.CompletionCode[MaxbladeCount]; uint bladeCount = MaxbladeCount; Tracer.WriteUserLog("Invoked GetAllBladesDatasafePowerState()"); Tracer.WriteInfo("Invoked GetAllBladesDatasafePowerState()"); for (int loop = 0; loop < bladeCount; loop++) { responses.datasafeBladePowerStateResponseCollection.Add(GetBladeDatasafePowerState(loop + 1)); // Set the internal blade response to the blade completion code. bladeInternalResponseCollection[loop] = responses.datasafeBladePowerStateResponseCollection[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() { DatasafeBladePowerStateResponse myResponse = new DatasafeBladePowerStateResponse(); DatasafeAllBladesPowerStateResponse myResponses = new DatasafeAllBladesPowerStateResponse(); try { if (this.argVal.ContainsKey('a')) { myResponses = WcsCli2CmConnectionManager.channel.GetAllBladesDatasafePowerState(); } else if (this.argVal.ContainsKey('i')) { dynamic bladeId = null; if (this.argVal.TryGetValue('i', out bladeId)) { myResponse = WcsCli2CmConnectionManager.channel.GetBladeDatasafePowerState((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.datasafeBladePowerStateResponseCollection == null) || myResponse == null) { Console.WriteLine(WcsCliConstants.serviceResponseEmpty); return; } if (this.argVal.ContainsKey('a')) { foreach (var response in myResponses.datasafeBladePowerStateResponseCollection) { if (ResponseValidation.ValidateBladeResponse(response.bladeNumber, null, response, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + " DataSafe blade power state = " + response.bladePowerState); Console.WriteLine("DataSafe power backup in progress?: " + response.isDatasafeBackupInProgress); } } } else { if (ResponseValidation.ValidateBladeResponse(myResponse.bladeNumber, null, myResponse, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + string.Format(" DataSafe blade power state = " + myResponse.bladePowerState)); Console.WriteLine("DataSafe power backup in progress?: " + myResponse.isDatasafeBackupInProgress); } } }