/// <summary> /// Basic validation test to set NextBoot test /// </summary> protected Boolean SetNextBootToJbodTest() { CmTestLog.Start(); bool testPassed = true; bool isJBodServer = false; int bladeIndex = 1; string failureMessage; EmptyLocations = GetEmptyLocations(); JbodLocations = GetJbodLocations(); CmTestLog.Info("!!!!!!!!! Starting execution of SetNextBootTest."); //Find first Jbod Server while (!isJBodServer && bladeIndex <= CmConstants.Population) { if (JbodLocations.Contains(bladeIndex)) { isJBodServer = true; } else { bladeIndex++; } } if (bladeIndex > CmConstants.Population) { failureMessage = "!!!Failed to find a server blade to run the test."; CmTestLog.Failure(failureMessage); return(false); } Channel.SetPowerOn(bladeIndex); Thread.Sleep(50000); BootResponse bBootType; foreach (BladeBootType testedBootType in Enum.GetValues(typeof(BladeBootType))) { //Doing the same setting twice to make sure we are handling this properly. if (testedBootType.ToString() != BladeBootType.Unknown.ToString()) { //set to persistent. bBootType = Channel.SetNextBoot(bladeIndex, testedBootType, false, false, 0); if (bBootType.completionCode == CompletionCode.Success && bBootType.completionCode != CompletionCode.CommandNotValidForBlade) { failureMessage = string.Format("Test failed, successfully set nextboot to JBOD type to: {0}", testedBootType); CmTestLog.Failure(failureMessage); testPassed = false; } bBootType = Channel.GetNextBoot(bladeIndex); if (bBootType.completionCode == CompletionCode.Success && bBootType.completionCode != CompletionCode.CommandNotValidForBlade) { failureMessage = string.Format("Test failed, successfully GET nextboot to JBOD type to: {0}", testedBootType); CmTestLog.Failure(failureMessage); testPassed = false; } } } // end of the test CmTestLog.End(testPassed); return(testPassed); }
/// <summary> /// Basic validation test to set NextBoot test /// </summary> protected Boolean SetNextBootTest() { CmTestLog.Start(); bool testPassed = true; bool isServer = false; int bladeIndex = 1; string failureMessage; EmptyLocations = GetEmptyLocations(); JbodLocations = GetJbodLocations(); CmTestLog.Info("!!!!!!!!! Starting execution of SetNextBootTest."); //Make sure blade is reacheable //Loop through servers listing and find first Blad to test while (!isServer && bladeIndex <= CmConstants.Population) { if (!JbodLocations.Contains(bladeIndex) && !EmptyLocations.Contains(bladeIndex)) { isServer = true; } else { bladeIndex++; } } if (bladeIndex > CmConstants.Population) { failureMessage = "!!!Failed to find a server blade to run the test."; CmTestLog.Failure(failureMessage); return(false); } Channel.SetPowerOn(bladeIndex); Thread.Sleep(50000); BootResponse bBootType; int index = 1; foreach (BladeBootType testedBootType in Enum.GetValues(typeof(BladeBootType))) { //Doing the same setting twice to make sure we are handling this properly. if (testedBootType.ToString() != BladeBootType.Unknown.ToString()) { //set to persistent. bBootType = Channel.SetNextBoot(bladeIndex, testedBootType, false, false, 0); if (bBootType.completionCode != CompletionCode.Success) { failureMessage = string.Format("!!!Failed to set non persistant boot type to: {0}", testedBootType); CmTestLog.Failure(failureMessage); testPassed = false; } bBootType = Channel.GetNextBoot(bladeIndex); if (testedBootType.ToString() != bBootType.nextBoot.ToString()) { failureMessage = "!!!The Non persistent boot type did not match what it was set to."; CmTestLog.Failure(failureMessage); testPassed = false; } //set to non persistent. bBootType = Channel.SetNextBoot(bladeIndex, testedBootType, false, true, 1); if (bBootType.completionCode != CompletionCode.Success) { failureMessage = string.Format("!!!Failed to set Persistent boot type to: {0}", testedBootType); CmTestLog.Failure(failureMessage); testPassed = false; } //Make sure if no restart happens it keeps its value. bBootType = Channel.GetNextBoot(bladeIndex); if (testedBootType.ToString() != bBootType.nextBoot.ToString()) { failureMessage = "!!!The boot type did not match what it was set to."; CmTestLog.Failure(failureMessage); testPassed = false; } //Make sure it loses its value after restart Channel.SetBladeActivePowerCycle(bladeIndex, 0); Thread.Sleep(60000); bBootType = Channel.GetNextBoot(bladeIndex); if (testedBootType.ToString() != BladeBootType.ForcePxe.ToString() && testedBootType.ToString() != bBootType.nextBoot.ToString()) { failureMessage = string.Format( "!!!The boot type did not match what it was set to before power cycle. {0} vs {1} this is round# {2}", testedBootType, bBootType.nextBoot, index); CmTestLog.Failure(failureMessage); testPassed = false; } } } Channel.SetNextBoot(bladeIndex, BladeBootType.NoOverride, false, true, 0); CmTestLog.Info("!!!!!!!!! Successfully finished execution of SetNextBoot tests."); // end of the test CmTestLog.End(testPassed); return(testPassed); }
/// <summary> /// Basic validation test to set NextBoot test /// </summary> protected Boolean SetNextBootByAllUserTest() { CmTestLog.Start(); bool testPassed = true; bool isServer = false; int bladeIndex = 1; string failureMessage = string.Empty; EmptyLocations = GetEmptyLocations(); JbodLocations = GetJbodLocations(); CmTestLog.Info("!!!!!!!!! Starting execution of SetNextBootTest."); //Make sure blade is reacheable //Loop through servers listing and find first Blad to test while (!isServer && bladeIndex <= CmConstants.Population) { if (!JbodLocations.Contains(bladeIndex) && !EmptyLocations.Contains(bladeIndex)) { isServer = true; } else { bladeIndex++; } } if (bladeIndex > CmConstants.Population) { failureMessage = "!!!Failed to find a server blade to run the test."; CmTestLog.Failure(failureMessage); return(false); } Channel.SetPowerOn(bladeIndex); Thread.Sleep(50000); int index = 1; foreach (WCSSecurityRole roleId in Enum.GetValues(typeof(WCSSecurityRole))) { try { if (!GetSetNextBoots(testPassed, bladeIndex, failureMessage, index, roleId)) { failureMessage = string.Format("Failed to set Persistent boot type by user type: {0}", roleId); CmTestLog.Failure(failureMessage); testPassed = false; break; } } catch (Exception e) { // Check if we got 401 error // Check error is due to permission HTTP 401 unauthorize if (!e.Message.Contains("401")) { // Test failed, http response should contain http 401 error CmTestLog.Failure("We are expecting 401 error, but we received 400 instead."); } } } CmTestLog.Info("!!!!!!!!! Successfully finished execution of SetNextBoot tests."); // end of the test CmTestLog.End(testPassed); return(testPassed); }