private TestResponse FailureForSoftOffGetBladeMezzAssetInfo(int bladeId) { TestCase testCase = new TestCase("FailureForSoftOffGetBladeMezzAssetInfo", 27200); CmTestLog.Info(string.Format( "\n !!!!!!Verifying {0} Returns Failure for Server Blade Soft-Powered Off. WorkItemId: {1}!!!!!!", this.currentApi, testCase.WorkItemId)); TestResponse response = new TestResponse(); BladeMessAssetInfoResponse getMezzAssetResponse = new BladeMessAssetInfoResponse(); this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin]; // Soft-Power Off server blade BladeResponse bladeResponse = this.TestChannelContext.SetBladeOff(bladeId); if (bladeResponse.completionCode != CompletionCode.Success) { LogMessage.Message = string.Format( "{0}: Unable to soft-power off server blade {1}", this.currentApi, bladeId); LogMessage.Log(LogMessage.MessageType.Failure, ref response); } else { CmTestLog.Info(string.Format("Soft-powered off blade {0}. Thread sleeping for {1} seconds...", bladeId, CmConstants.BladePowerOffSeconds)); Thread.Sleep(TimeSpan.FromSeconds(CmConstants.BladePowerOffSeconds)); // Call API and verify Failure getMezzAssetResponse = this.TestChannelContext.GetBladeMezzAssetInfo(bladeId); if (getMezzAssetResponse.completionCode != CompletionCode.Failure) { LogMessage.Message = string.Format( "{0}: Command returns completion code {1} after blade {2} is soft-powered off", this.currentApi, getMezzAssetResponse.completionCode, bladeId); LogMessage.Log(LogMessage.MessageType.Failure, ref response); } else { LogMessage.Message = string.Format( "{0}: Command successfully returns completion code Failure after blade {1} is soft-powered off", this.currentApi, bladeId); LogMessage.Log(LogMessage.MessageType.Success, ref response); } } // Code clean-up. Soft-power on blade bladeResponse = this.TestChannelContext.SetBladeOn(bladeId); if (bladeResponse.completionCode != CompletionCode.Success) { LogMessage.Message = string.Format( "{0}: Unable to soft-power on server blade {1}", this.currentApi, bladeId); LogMessage.Log(LogMessage.MessageType.Failure, ref response); return response; } CmTestLog.Info(string.Format("Soft-powered on blade {0}. Thread sleeping for {1} seconds...", bladeId, CmConstants.BladePowerOnSeconds)); Thread.Sleep(TimeSpan.FromSeconds(CmConstants.BladePowerOnSeconds)); testCase.LogPassOrFail(ref response, this.currentApi); return response; }
/// <summary> /// Get the Blade Mezz FRU EEPROM /// </summary> /// <param name="bladeId">Target Blade Id</param> /// <returns>GetBladeMezzFru</returns> public BladeMessAssetInfoResponse GetBladeMezzAssetInfo(int bladeId) { string cmd = "GetBladeMezzAssetInfo"; // Initialize Response Tracer.WriteInfo(string.Format("Received {0}(bladeId: {1})", cmd, bladeId)); Tracer.WriteUserLog(string.Format("Invoked {0}(bladeId: {1})", cmd, bladeId)); BladeMessAssetInfoResponse bladeMezz = new BladeMessAssetInfoResponse(); bladeMezz.bladeNumber = bladeId; try { // Validate Request Contracts.ChassisResponse varResponse = ValidateRequest(cmd, bladeId); if (varResponse.completionCode != Contracts.CompletionCode.Success) { bladeMezz.completionCode = varResponse.completionCode; bladeMezz.statusDescription = varResponse.statusDescription; return bladeMezz; } // Invoke GetBladeMezzFru to send MasterWriteRead IPMI command to blade BMC Ipmi.FruDevice fruDevice = WcsBladeMezz.GetMezzFruEeprom(bladeId); if (fruDevice.CompletionCode == (byte)CompletionCode.Success) { if (fruDevice.ProductInfo.ManufacturerName != null) bladeMezz.productAreaManufactureName = fruDevice.ProductInfo.ManufacturerName.ToString(); if (fruDevice.ProductInfo.AssetTag != null) bladeMezz.productAreaAssetTag = fruDevice.ProductInfo.AssetTag.ToString(); if (fruDevice.ProductInfo.PartModelNumber != null) bladeMezz.productAreaPartModelNumber = fruDevice.ProductInfo.PartModelNumber.ToString(); if (fruDevice.ProductInfo.SerialNumber != null) bladeMezz.productAreaSerialNumber = fruDevice.ProductInfo.SerialNumber.ToString(); if (fruDevice.ProductInfo.ProductVersion != null) bladeMezz.productAreaProductVersion = fruDevice.ProductInfo.ProductVersion.ToString(); if (fruDevice.ProductInfo.ProductName != null) bladeMezz.productAreaProductName = fruDevice.ProductInfo.ProductName.ToString(); } } catch (Exception ex) { Tracer.WriteError(string.Format("Exception occured in {0}(): {1}", cmd, ex)); bladeMezz.completionCode = Contracts.CompletionCode.Failure; bladeMezz.statusDescription = bladeMezz.completionCode.ToString() + ": " + ex.Message; } return bladeMezz; }
private TestResponse CorrectFruContentForGetBladeMezzAssetInfo(int bladeId) { TestCase testCase = new TestCase("CorrectFruContentForGetBladeMezzAssetInfo", 27202); CmTestLog.Info(string.Format("\n !!!!!!Verifying {0} Returns Correct Fru Information. WorkItemId: {1}!!!!!!", this.currentApi, testCase.WorkItemId)); TestResponse response = new TestResponse(); BladeMessAssetInfoResponse getMezzAssetResponse = new BladeMessAssetInfoResponse(); this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin]; // Call API and verify FRU output is correct getMezzAssetResponse = this.TestChannelContext.GetBladeMezzAssetInfo(bladeId); VerifyMezzFruContent(getMezzAssetResponse, ref response); testCase.LogPassOrFail(ref response, this.currentApi); return response; }
private TestResponse FailureForEmptyGetBladeMezzAssetInfo(int bladeId) { TestCase testCase = new TestCase("FailureForEmptyGetBladeMezzAssetInfo", 27199); CmTestLog.Info(string.Format("\n !!!!!!Verifying {0} Returns Failure for Empty Location. WorkItemId: {1}!!!!!!", this.currentApi, testCase.WorkItemId)); TestResponse response = new TestResponse(); BladeMessAssetInfoResponse getMezzAssetResponse = new BladeMessAssetInfoResponse(); this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin]; // Call API and verify Failure getMezzAssetResponse = this.TestChannelContext.GetBladeMezzAssetInfo(bladeId); LogMessage.Message = string.Format( "{0}: Command for empty location with completion code {1} and blade Id {2}", this.currentApi, getMezzAssetResponse.completionCode, bladeId); if (getMezzAssetResponse.completionCode != CompletionCode.Failure) LogMessage.Log(LogMessage.MessageType.Failure, ref response); else LogMessage.Log(LogMessage.MessageType.Success, ref response); testCase.LogPassOrFail(ref response, this.currentApi); return response; }
private TestResponse AllGroupsCanExecuteGetBladeMezzAssetInfo(int bladeId) { TestCase testCase = new TestCase("AllGroupsCanExecuteGetBladeMezzAssetInfo", 27197); CmTestLog.Info(string.Format("\n !!!!!!Verifying {0} Can Be Executed By All Users. WorkItemId: {1}.!!!!!!", this.currentApi, testCase.WorkItemId)); TestResponse response = new TestResponse(); // Loop through different user types foreach (WCSSecurityRole roleId in Enum.GetValues(typeof(WCSSecurityRole))) { BladeMessAssetInfoResponse getMezzAssetInfoResponse = new BladeMessAssetInfoResponse(); // Use different user context this.TestChannelContext = this.ListTestChannelContexts[(int)roleId]; // Get Pass Through Mode and verify getMezzAssetInfoResponse = this.TestChannelContext.GetBladeMezzAssetInfo(bladeId); LogMessage.Message = string.Format( "{0}: Command returned completion code {1} for user {2} and blade Id {3}", this.currentApi, getMezzAssetInfoResponse.completionCode, Enum.GetName(typeof(WCSSecurityRole), roleId), bladeId); if (getMezzAssetInfoResponse.completionCode != CompletionCode.Success) LogMessage.Log(LogMessage.MessageType.Failure, ref response); else LogMessage.Log(LogMessage.MessageType.Success, ref response); } testCase.LogPassOrFail(ref response, this.currentApi); return response; }
private void VerifyMezzFruContent(BladeMessAssetInfoResponse getMezzAssetResponse, ref TestResponse response) { LogMessage.Message = string.Format( "{0}: Command for Blade {1} returns completionCode {2}", this.currentApi, getMezzAssetResponse.bladeNumber, getMezzAssetResponse.completionCode); if (getMezzAssetResponse.completionCode != CompletionCode.Success) { LogMessage.Log(LogMessage.MessageType.Failure, ref response); return; } else LogMessage.Log(LogMessage.MessageType.Success, ref response); // Product Area Manufacturer Name VerifyFruStringsMatch("Microsoft", getMezzAssetResponse.productAreaManufactureName, ref response); // Product Area Product Name VerifyFruStringsMatch("PPFPGA", getMezzAssetResponse.productAreaProductName, ref response); // Product Area Part Model Number VerifyFruStringsMatch("X900563-001", getMezzAssetResponse.productAreaPartModelNumber, ref response); // Product Area Product Version VerifyFruStringsMatch("2.0", getMezzAssetResponse.productAreaProductVersion, ref response); // Product Area Product Serial Number VerifyFruStringLength("Product Serial Number", getMezzAssetResponse.productAreaSerialNumber, 14, ref response); // Product Area Asset Tag VerifyFruStringLength("Product Asset Tag", getMezzAssetResponse.productAreaAssetTag, 7, ref response); }
private TestResponse ParameterOutOfRangeBladeIdGetBladeMezzAssetInfo() { TestCase testCase = new TestCase("ParameterOutOfRangeBladeIdGetBladeMezzAssetInfo", 27201); CmTestLog.Info(string.Format( "\n !!!!!!Verifying {0} Returns ParameterOutOfRange for Invalid BladeId. WorkItemId: {1}!!!!!!", this.currentApi, testCase.WorkItemId)); TestResponse response = new TestResponse(); BladeMessAssetInfoResponse getMezzAssetResponse = new BladeMessAssetInfoResponse(); this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin]; foreach (int invalidValue in Enum.GetValues(typeof(InvalidBladeId))) { getMezzAssetResponse = this.TestChannelContext.GetBladeMezzAssetInfo(invalidValue); LogMessage.Message = string.Format( "{0}: Command returns completion code {1} for invalid Blade Id {2}", this.currentApi, getMezzAssetResponse.completionCode, invalidValue); if (getMezzAssetResponse.completionCode != CompletionCode.ParameterOutOfRange) LogMessage.Log(LogMessage.MessageType.Failure, ref response); else LogMessage.Log(LogMessage.MessageType.Success, ref response); } testCase.LogPassOrFail(ref response, currentApi); return response; }
private TestResponse FruContentMatchesAfterSoftCycleForGetBladeMezzAssetInfo(int bladeId) { TestCase testCase = new TestCase("FruContentMatchesAfterSoftCycleForGetBladeMezzAssetInfo", 27450); CmTestLog.Info(string.Format("\n !!!!!!Verifying {0} Returns Same Fru Information After Soft-Power Cycle. WorkItemId: {1}!!!!!!", this.currentApi, testCase.WorkItemId)); TestResponse response = new TestResponse(); BladeMessAssetInfoResponse previousGetMezzAssetResponse = new BladeMessAssetInfoResponse(); BladeMessAssetInfoResponse currentGetMezzAssetResponse = new BladeMessAssetInfoResponse(); this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin]; previousGetMezzAssetResponse = this.TestChannelContext.GetBladeMezzAssetInfo(bladeId); // Soft-Power Cycle Blade BladeResponse setPowerResponse = this.TestChannelContext.SetBladeActivePowerCycle(bladeId, (int)CmConstants.OffTimeSec); LogMessage.Message = string.Format("{0}: Soft-Power Cycled Blade {1}", this.currentApi, bladeId); if (setPowerResponse.completionCode != CompletionCode.Success) { LogMessage.Log(LogMessage.MessageType.Failure, ref response); return response; } else LogMessage.Log(LogMessage.MessageType.Success, ref response); // Thread Sleep LogMessage.Message = string.Format("Blade Soft-Power Cycling. Thread sleeping for {0} seconds...", (CmConstants.BladePowerOffSeconds + CmConstants.BladePowerOnSeconds)); LogMessage.Log(LogMessage.MessageType.Info, ref response); Thread.Sleep(TimeSpan.FromSeconds(CmConstants.BladePowerOffSeconds + CmConstants.BladePowerOnSeconds)); // Get Fru Content after Soft-Power cycle currentGetMezzAssetResponse = this.TestChannelContext.GetBladeMezzAssetInfo(bladeId); LogMessage.Message = string.Format( "{0}: Command returns completionCode {1} for blade {2}", this.currentApi, currentGetMezzAssetResponse.completionCode, bladeId); if (currentGetMezzAssetResponse.completionCode != CompletionCode.Success) { LogMessage.Log(LogMessage.MessageType.Failure, ref response); return response; } else LogMessage.Log(LogMessage.MessageType.Success, ref response); // Verify Fru Contents are same as before VerifyFruStringsMatch(previousGetMezzAssetResponse.bladeNumber.ToString(), currentGetMezzAssetResponse.bladeNumber.ToString(), ref response); VerifyFruStringsMatch(previousGetMezzAssetResponse.productAreaManufactureName, currentGetMezzAssetResponse.productAreaManufactureName, ref response); VerifyFruStringsMatch(previousGetMezzAssetResponse.productAreaProductName, currentGetMezzAssetResponse.productAreaProductName, ref response); VerifyFruStringsMatch(previousGetMezzAssetResponse.productAreaPartModelNumber, currentGetMezzAssetResponse.productAreaPartModelNumber, ref response); VerifyFruStringsMatch(previousGetMezzAssetResponse.productAreaProductVersion, currentGetMezzAssetResponse.productAreaProductVersion, ref response); VerifyFruStringsMatch(previousGetMezzAssetResponse.productAreaSerialNumber, currentGetMezzAssetResponse.productAreaSerialNumber, ref response); VerifyFruStringsMatch(previousGetMezzAssetResponse.productAreaAssetTag, currentGetMezzAssetResponse.productAreaAssetTag, ref response); testCase.LogPassOrFail(ref response, this.currentApi); return response; }
/// <summary> /// command specific implementation /// </summary> internal override void commandImplementation() { BladeMessAssetInfoResponse myResponse = new BladeMessAssetInfoResponse(); try { if (!(this.argVal.ContainsKey('i'))) { Console.WriteLine(WcsCliConstants.commandFailure + " No blade ID specified, please look at command help."); return; } else { dynamic bladeId = null; this.argVal.TryGetValue('i', out bladeId); myResponse = WcsCli2CmConnectionManager.channel.GetBladeMezzAssetInfo((int)bladeId); } } catch (Exception ex) { SharedFunc.ExceptionOutput(ex); return; } if (ResponseValidation.ValidateBladeResponse(myResponse.bladeNumber, null, myResponse, false)) { Console.WriteLine(WcsCliConstants.commandSuccess); Console.WriteLine(); Console.WriteLine("Blade Product Info Area"); Console.WriteLine("--------------------------------------"); Console.WriteLine( "Product Manufacturer Name = " + myResponse.productAreaManufactureName); Console.WriteLine( "Product Product Name = " + myResponse.productAreaProductName); Console.WriteLine( "Product Part/Model Number = " + myResponse.productAreaPartModelNumber); Console.WriteLine( "Product Version = " + myResponse.productAreaProductVersion); Console.WriteLine( "Product Serial Number = " + myResponse.productAreaSerialNumber); Console.WriteLine("PD Product Asset Tag = " + myResponse.productAreaAssetTag); Console.WriteLine("--------------------------------------"); Console.WriteLine(); } }