当前位置: 首页>>代码示例>>C#>>正文


C# TestCase.LogPassOrFail方法代码示例

本文整理汇总了C#中TestCase.LogPassOrFail方法的典型用法代码示例。如果您正苦于以下问题:C# TestCase.LogPassOrFail方法的具体用法?C# TestCase.LogPassOrFail怎么用?C# TestCase.LogPassOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestCase的用法示例。


在下文中一共展示了TestCase.LogPassOrFail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SuccessfulSecFwUpdateForUpdatePsuFirmware

        private TestResponse SuccessfulSecFwUpdateForUpdatePsuFirmware()
        {
            // Change test case Id and fwFilePath if testing Les or Non-Les Psus
            int testCaseId = -1;
            string fwFilePath;
            if (lesPsusInChassis == "1") // currently testing LES PSU
            {
                testCaseId = 22745;
                fwFilePath = this.secLesFwFilePath;
            }
            else
            {
                testCaseId = 22746;
                fwFilePath = this.secNonLesFwFilePath;
            }

            TestCase testCase = new TestCase("SuccessfulSecFwUpdateForUpdatePsuFirmware", testCaseId);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Returns Successful Secondary Psu Fw Image Update for Psu. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            // Get random valid Psu Id
            int[] psuIds = null;
            if (!ReturnSingleOrMultipleRandomPsus(1, ref psuIds, ref response))
                return response;
            UpdatePsu psu = new UpdatePsu(psuIds[0], fwFilePath, secondaryImage);

            // Initialize List to contain UpdatePsu elements
            List<UpdatePsu> psuList = new List<UpdatePsu>();
            psuList.Add(psu);

            // Verify Secondary Psu Fw Update
            VerifyPsuFwUpdate(ref psuList, ref response);

            testCase.LogPassOrFail(ref response, currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:39,代码来源:PsuFirmwareCommands.cs

示例2: SuccessfulPriOrSecNotBothFwUpdateForUpdatePsuFirmware


//.........这里部分代码省略.........
            LogMessage.Message = string.Format(
                    "{0}: GetPsuFirmwareStatus for PSU {1} before update - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                    this.currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                    psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            // Verify PSU is available for update
            if (psu.psuFwStatus.completionCode != CompletionCode.Success ||
                psu.psuFwStatus.fwUpdateStatus == "InProgress")
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Update PSU
            psu.psuFwUpdateResponse = this.TestChannelContext.UpdatePSUFirmware(psu.index,
                    psu.psuFwFilePath, psu.primaryImage);
            LogMessage.Message = string.Format(
                    "{0}: Psu {1} returned completion code {2} and status description {3}",
                    this.currentApi, psu.index, psu.psuFwUpdateResponse.completionCode,
                    psu.psuFwUpdateResponse.statusDescription);

            if (psu.psuFwUpdateResponse.completionCode != CompletionCode.Success)
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Sleep for 5 minutes
            LogMessage.Message = "Thread sleeping for 5 minutes...";
            LogMessage.Log(LogMessage.MessageType.Info, ref response);
            Thread.Sleep(TimeSpan.FromMinutes(5));

            // Verify PSU is still updating
            psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);
            LogMessage.Message = string.Format(
                    "{0}: GetPsuFirmwareStatus for PSU {1} after 5 minutes - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                    this.currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                    psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            // Verify PSU is still updating
            if (psu.psuFwStatus.completionCode != CompletionCode.Success ||
                psu.psuFwStatus.fwUpdateStatus != "InProgress")
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Attempt to update PSU with secondary image and verify Failure
            if (lesPsusInChassis == "1")
                psu.psuFwFilePath = this.secLesFwFilePath;
            else
                psu.psuFwFilePath = this.secNonLesFwFilePath;
            psu.psuFwUpdateResponse = this.TestChannelContext.UpdatePSUFirmware(psu.index, psu.psuFwFilePath, secondaryImage);
            LogMessage.Message = string.Format(
                    "{0}: Psu {1} returned completion code {2} and status description {3}",
                    this.currentApi, psu.index, psu.psuFwUpdateResponse.completionCode,
                    psu.psuFwUpdateResponse.statusDescription);

            if (psu.psuFwUpdateResponse.completionCode != CompletionCode.Failure)
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Sleep for 7 more minutes
            LogMessage.Message = "Thread sleeping for 7 minutes...";
            LogMessage.Log(LogMessage.MessageType.Info, ref response);
            Thread.Sleep(TimeSpan.FromMinutes(7));

            // Verify successful Primary PSU Fw Update
            psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);
            LogMessage.Message = string.Format(
                "{0}: GetPsuFWStatus for Psu {1} - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            if (psu.psuFwStatus.completionCode != CompletionCode.Success ||
                    ((psu.psuFwStatus.fwUpdateStatus != "Success")
                    && (psu.psuFwStatus.fwUpdateStage != "Completed")))
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Verify Successful Secondary PSU Fw Update if Primary was successful
            List<UpdatePsu> psuList = new List<UpdatePsu>();
            psuList.Add(psu);
            if (response.Result)
                VerifyPsuFwUpdate(ref psuList, ref response);

            testCase.LogPassOrFail(ref response, this.currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:101,代码来源:PsuFirmwareCommands.cs

示例3: SuccessfulPriSecUpdateForPrimaryImageTrueFalseForUpdatePsuFirmware

        private TestResponse SuccessfulPriSecUpdateForPrimaryImageTrueFalseForUpdatePsuFirmware()
        {
            TestCase testCase = new TestCase("SuccessfulPriSecUpdateForPrimaryImageTrueFalseForUpdatePsuFirmware", 22711);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Updates Primary Image When PrimaryImage True, Secondary Image When False. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            // Get random valid Psu Ids
            int[] psuIds = null;
            if (!ReturnSingleOrMultipleRandomPsus(2, ref psuIds, ref response))
                return response;

            // Initialize multiple UpdatePsu elements and add to psuList
            List<UpdatePsu> psuList = new List<UpdatePsu>();
            if (lesPsusInChassis == "1") // currently testing LES PSU
            {
                psuList.Add(new UpdatePsu(psuIds[0], this.priLesFwFilePath, primaryImage));
                psuList.Add(new UpdatePsu(psuIds[1], this.secLesFwFilePath, secondaryImage));
            }
            else
            {
                psuList.Add(new UpdatePsu(psuIds[0], this.priNonLesFwFilePath, primaryImage));
                psuList.Add(new UpdatePsu(psuIds[1], this.secNonLesFwFilePath, secondaryImage));
            }

            // Verify Psu Update
            VerifyPsuFwUpdate(ref psuList, ref response);

            testCase.LogPassOrFail(ref response, this.currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:33,代码来源:PsuFirmwareCommands.cs

示例4: PsuDoesNotOutputPowerForUpdatePsuFirmware

        private TestResponse PsuDoesNotOutputPowerForUpdatePsuFirmware()
        {
            TestCase testCase = new TestCase("PsuDoesNotOutputPowerForUpdatePsuFirmware", 22840);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Causes Psu To Not Output Power During Fw Update. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            // Get random Psu
            int[] psuIds = null;
            if (!ReturnSingleOrMultipleRandomPsus(1, ref psuIds, ref response))
                return response;
            UpdatePsu psu = new UpdatePsu(psuIds[0], this.priLesFwFilePath, primaryImage);

            // Run test case using WcsCmAdmin
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);
            LogMessage.Message = string.Format(
                    "{0}: GetPsuFirmwareStatus for PSU {1} before update - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                    this.currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                    psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            // Verify PSU is available for update
            if (psu.psuFwStatus.completionCode != CompletionCode.Success ||
                psu.psuFwStatus.fwUpdateStatus == "InProgress")
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Update PSU
            psu.psuFwUpdateResponse = this.TestChannelContext.UpdatePSUFirmware(psu.index,
                    psu.psuFwFilePath, psu.primaryImage);
            LogMessage.Message = string.Format(
                    "{0}: Psu {1} returned completion code {2} and status description {3}",
                    this.currentApi, psu.index, psu.psuFwUpdateResponse.completionCode,
                    psu.psuFwUpdateResponse.statusDescription);

            if (psu.psuFwUpdateResponse.completionCode != CompletionCode.Success)
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Sleep for 1 minute
            LogMessage.Message = "Thread sleeping for 1 minutes...";
            LogMessage.Log(LogMessage.MessageType.Info, ref response);
            Thread.Sleep(TimeSpan.FromMinutes(1));

            // Check Psu Power Output is 0 using GetChassisHealth
            ChassisHealthResponse getChassisHealthResponse = new ChassisHealthResponse();
            getChassisHealthResponse = this.TestChannelContext.GetChassisHealth(false, true, false, false);
            PsuInfo psuHealth = getChassisHealthResponse.psuInfoCollection
                .FirstOrDefault(x => x.id == psu.index);

            LogMessage.Message = string.Format(
                "{0}: GetChassisHealth for Psu {1} - completionCode {2} and powerOut {3}",
                this.currentApi, psuHealth.id, getChassisHealthResponse.completionCode,
                psuHealth.powerOut);

            if (getChassisHealthResponse.completionCode == CompletionCode.Success &&
                psuHealth.powerOut == 0)
                LogMessage.Log(LogMessage.MessageType.Success, ref response);
            else
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);

            testCase.LogPassOrFail(ref response, this.currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:75,代码来源:PsuFirmwareCommands.cs

示例5: InvalidRequestForInvalidPassThroughSetBladeMezzPassThroughMode

        private TestResponse InvalidRequestForInvalidPassThroughSetBladeMezzPassThroughMode(int bladeId)
        {
            TestCase testCase = new TestCase("InvalidRequestForInvalidPassThroughSetBladeMezzPassThroughMode", 24197);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Returns Status Description InvalidRequest for Invalid PassThroughModeEnabled. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            BladeResponse setBladeMezzResponse = new BladeResponse();
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            Dictionary<string, string> InvalidPassThroughModeEnabled = new Dictionary<string, string>();

            InvalidPassThroughModeEnabled.Add("min64", "-9223372036854775808");
            InvalidPassThroughModeEnabled.Add("max64", "9223372036854775807");
            InvalidPassThroughModeEnabled.Add("invalidString", "abc123_!&");
            InvalidPassThroughModeEnabled.Add("emptyString", string.Empty);
            InvalidPassThroughModeEnabled.Add("invalidTrue1", "ttrue");
            InvalidPassThroughModeEnabled.Add("invalidTrue2", "frue");
            InvalidPassThroughModeEnabled.Add("invalidFalse1", "ffalse");
            InvalidPassThroughModeEnabled.Add("invalidFalse2", "fazse");
            InvalidPassThroughModeEnabled.Add("nullString", null);

            // test SetBladeMezzPassThroughMode passThroughModeEnabled parameter for each invalid value
            foreach (string invalidValue in InvalidPassThroughModeEnabled.Values)
            {
                setBladeMezzResponse = this.TestChannelContext.SetBladeMezzPassThroughMode(bladeId, invalidValue);
                LogMessage.Message = string.Format(
                        "{0}: Command returns completion code {1} and status description {2} for invalid passThroughModeEnabled {3} for bladeId {4}",
                        currentApi, setBladeMezzResponse.completionCode, setBladeMezzResponse.statusDescription, invalidValue, bladeId);

                if (setBladeMezzResponse.completionCode == CompletionCode.Failure &&
                    setBladeMezzResponse.statusDescription == "Invalid Request")
                    LogMessage.Log(LogMessage.MessageType.Success, ref response);
                else
                    LogMessage.Log(LogMessage.MessageType.Failure, ref response);
            }

            testCase.LogPassOrFail(ref response, currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:42,代码来源:BladeMezzCommands.cs

示例6: InvalidPsuFwFileUpdateFailForUpdatePsuFirmware


//.........这里部分代码省略.........
            UpdatePsu psu = new UpdatePsu(psuIds[0], fwFilePath, primaryImage);

            // Run test case using WcsCmAdmin
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);
            LogMessage.Message = string.Format(
                    "{0}: GetPsuFirmwareStatus for PSU {1} before update - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                    this.currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                    psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            // Verify PSU is available for update
            if (psu.psuFwStatus.completionCode != CompletionCode.Success ||
                psu.psuFwStatus.fwUpdateStatus == "InProgress")
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Update Psu with secondary fw image and true value for primaryImage
            psu.psuFwUpdateResponse = this.TestChannelContext.UpdatePSUFirmware(psu.index, psu.psuFwFilePath, primaryImage);
            LogMessage.Message = string.Format(
                    "{0}: Psu {1} returned completion code {2} and status description {3}",
                    this.currentApi, psu.index, psu.psuFwUpdateResponse.completionCode,
                    psu.psuFwUpdateResponse.statusDescription);

            if (psu.psuFwUpdateResponse.completionCode != CompletionCode.Success)
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Sleep for 5 minutes
            LogMessage.Message = "Thread sleeping for 5 minutes...";
            LogMessage.Log(LogMessage.MessageType.Info, ref response);
            Thread.Sleep(TimeSpan.FromMinutes(5));

            // Verify Psu Fw Update has failed
            psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);
            LogMessage.Message = string.Format(
                "{0}: GetPsuFirmwareStatus for PSU {1} - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                    this.currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                    psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            if (psu.psuFwStatus.completionCode == CompletionCode.Success &&
                psu.psuFwStatus.fwUpdateStatus == "Failed" &&
                psu.psuFwStatus.fwUpdateStage == "SendModelId")
                LogMessage.Log(LogMessage.MessageType.Success, ref response);
            else
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }

            // Update Psu with invalid psu image and true value for primaryImage
            string invalidFwFilePath = ConfigurationManager.AppSettings["InvalidPsuFwFilePath"].ToString();

            psu.psuFwUpdateResponse = this.TestChannelContext.UpdatePSUFirmware(psu.index, invalidFwFilePath, primaryImage);
            LogMessage.Message = string.Format(
                    "{0}: Psu {1} returned completion code {2} and status description {3}",
                    this.currentApi, psu.index, psu.psuFwUpdateResponse.completionCode,
                    psu.psuFwUpdateResponse.statusDescription);

            if (psu.psuFwUpdateResponse.completionCode != CompletionCode.Success)
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            // Sleep for 5 minutes
            LogMessage.Message = "Thread sleeping for 5 minutes...";
            LogMessage.Log(LogMessage.MessageType.Info, ref response);
            Thread.Sleep(TimeSpan.FromMinutes(5));

            // Verify Psu Fw Update has failed
            psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);
            LogMessage.Message = string.Format(
                "{0}: GetPsuFirmwareStatus for PSU {1} - fwRevision: {2} completionCode: {3} fwUpdateStatus: {4} fwUpdateStage: {5}",
                    this.currentApi, psu.index, psu.psuFwStatus.fwRevision, psu.psuFwStatus.completionCode,
                    psu.psuFwStatus.fwUpdateStatus, psu.psuFwStatus.fwUpdateStage);

            if (psu.psuFwStatus.completionCode == CompletionCode.Success &&
                psu.psuFwStatus.fwUpdateStatus == "Failed" &&
                psu.psuFwStatus.fwUpdateStage == "ExtractModelId")
                LogMessage.Log(LogMessage.MessageType.Success, ref response);
            else
            {
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                return response;
            }

            testCase.LogPassOrFail(ref response, this.currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:101,代码来源:PsuFirmwareCommands.cs

示例7: ParameterOutOfRangePsuIdGetPsuFirmwareStatus

        private TestResponse ParameterOutOfRangePsuIdGetPsuFirmwareStatus()
        {
            TestCase testCase = new TestCase("ParameterOutOfRangePsuIdGetPsuFirmwareStatus", 22804);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Returns ParameterOutOfRange for Invalid PsuId. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            PsuFirmwareStatus getPsuFwResponse = new PsuFirmwareStatus();
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            foreach (int invalidValue in Enum.GetValues(typeof(InvalidPsuId)))
            {
                getPsuFwResponse = this.TestChannelContext.GetPSUFirmwareStatus(invalidValue);
                LogMessage.Message = string.Format(
                        "{0}: Command returns completion code {1} for invalid Psu Id {2}",
                        this.currentApi, getPsuFwResponse.completionCode, invalidValue);

                if (getPsuFwResponse.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;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:28,代码来源:PsuFirmwareCommands.cs

示例8: CommandNotValidJBODGetBladeMezzPassThroughMode

        private TestResponse CommandNotValidJBODGetBladeMezzPassThroughMode(int bladeId)
        {
            TestCase testCase = new TestCase("CommandNotValidJBODGetBladeMezzPassThroughMode", 24167);

            CmTestLog.Info(string.Format("\n !!!!!!Verifying {0} Returns CommandNotValidForBlade for JBOD. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            BladeMezzPassThroughModeResponse getBladeMezzResponse = new BladeMezzPassThroughModeResponse();
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            // Call API and verify CommandNotValidForBlade
            getBladeMezzResponse = this.TestChannelContext.GetBladeMezzPassThroughMode(bladeId);
            LogMessage.Message = string.Format(
                    "{0}: Command for JBOD location returned completion code {1} and blade Id {2}",
                    this.currentApi, getBladeMezzResponse.completionCode, bladeId);

            if (getBladeMezzResponse.completionCode != CompletionCode.CommandNotValidForBlade)
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
            else
                LogMessage.Log(LogMessage.MessageType.Success, ref response);

            testCase.LogPassOrFail(ref response, this.currentApi);

            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:26,代码来源:BladeMezzCommands.cs

示例9: CorrectFruContentForGetBladeMezzAssetInfo

        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;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:18,代码来源:BladeMezzCommands.cs

示例10: VerifySuccessWithCapitalizationOfPassThroughSetBladeMezzPassThroughMode

        private TestResponse VerifySuccessWithCapitalizationOfPassThroughSetBladeMezzPassThroughMode(int bladeId)
        {
            TestCase testCase = new TestCase("VerifySuccessWithCapitalizationOfPassThroughSetBladeMezzPassThroughMode", 24201);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Returns Completion Code Success for PassThroughModeEnabled With Capitalization. WorkItemIds: 24200 and {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            BladeResponse setBladeMezzResponse = new BladeResponse();
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            Dictionary<string, string> CapitalizedPassThroughModeEnabled = new Dictionary<string, string>();

            CapitalizedPassThroughModeEnabled.Add("Value1", "true");
            CapitalizedPassThroughModeEnabled.Add("Value2", "false");
            CapitalizedPassThroughModeEnabled.Add("Value3", "TRUE");
            CapitalizedPassThroughModeEnabled.Add("Value4", "FALSE");
            CapitalizedPassThroughModeEnabled.Add("Value5", "tRue");
            CapitalizedPassThroughModeEnabled.Add("Value6", "faLse");

            foreach (string capitalizedValue in CapitalizedPassThroughModeEnabled.Values)
            {
                setBladeMezzResponse = this.TestChannelContext.SetBladeMezzPassThroughMode(bladeId, capitalizedValue);

                LogMessage.Message = string.Format(
                        "{0}: Command returned Completion Code {1} for PassThroughModeEnabled value {2} for blade Id {3}",
                        this.currentApi, setBladeMezzResponse.completionCode, capitalizedValue, bladeId);

                if (setBladeMezzResponse.completionCode != CompletionCode.Success)
                    LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                else
                    LogMessage.Log(LogMessage.MessageType.Success, ref response);
            }

            testCase.LogPassOrFail(ref response, currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:38,代码来源:BladeMezzCommands.cs

示例11: AllGroupsCanExecuteGetBladeMezzPassThroughMode

        private TestResponse AllGroupsCanExecuteGetBladeMezzPassThroughMode(int bladeId)
        {
            TestCase testCase = new TestCase("AllGroupsCanExecuteGetBladeMezzPassThroughMode", 24166);

            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)))
            {
                BladeMezzPassThroughModeResponse getBladeMezzResponse = new BladeMezzPassThroughModeResponse();

                // Use different user context
                this.TestChannelContext = this.ListTestChannelContexts[(int)roleId];

                // Get Pass Through Mode and verify
                getBladeMezzResponse = this.TestChannelContext.GetBladeMezzPassThroughMode(bladeId);

                LogMessage.Message = string.Format(
                        "{0}: Command returned completion code {1} for user {2} and blade Id {3}",
                        this.currentApi, getBladeMezzResponse.completionCode,
                        Enum.GetName(typeof(WCSSecurityRole), roleId), bladeId);

                if (getBladeMezzResponse.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;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:34,代码来源:BladeMezzCommands.cs

示例12: TrueAfterRestartGetBladeMezzPassThroughMode

        private TestResponse TrueAfterRestartGetBladeMezzPassThroughMode(int bladeId)
        {
            TestCase testCase = new TestCase("TrueAfterRestartGetBladeMezzPassThroughMode", 24181);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Returns Correct Pass-ThroughMode After Restarting Blade. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            BladeResponse setBladeActivePowerCycleResponse = new BladeResponse();
            BladeStateResponse getBladeStateResponse = new BladeStateResponse();
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            // Restart blade
            setBladeActivePowerCycleResponse = this.TestChannelContext.SetBladeActivePowerCycle(bladeId, Convert.ToInt32(CmConstants.OffTimeSec));
            if (setBladeActivePowerCycleResponse.completionCode != CompletionCode.Success)
            {
                LogMessage.Message = string.Format(
                    "{0}: Failed to restart blade {1} with completion code {2}",
                    this.currentApi, bladeId, setBladeActivePowerCycleResponse.completionCode);
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
            }

            // Sleep Thread for 2 minutes 30 seconds
            CmTestLog.Info(string.Format("Thread sleeping for {0} seconds...",
                TimeSpan.FromSeconds(150)));
            Thread.Sleep(TimeSpan.FromSeconds(150));

            // Verify blade soft-powered on
            getBladeStateResponse = this.TestChannelContext.GetBladeState(bladeId);
            if (getBladeStateResponse.completionCode != CompletionCode.Success ||
                getBladeStateResponse.bladeState != PowerState.ON)
            {
                LogMessage.Message = string.Format(
                        "{0}: Blade {1} did not soft-power ON",
                        this.currentApi, bladeId);
                LogMessage.Log(LogMessage.MessageType.Failure, ref response);
            }
            else
            {
                CallAndVerifyGetBladeMezzPassThroughMode(bladeId, ref response, "true");
            }

            testCase.LogPassOrFail(ref response, currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:46,代码来源:BladeMezzCommands.cs

示例13: ParameterOutOfRangeBladeIdSetBladeMezzPassThroughMode

        private TestResponse ParameterOutOfRangeBladeIdSetBladeMezzPassThroughMode()
        {
            TestCase testCase = new TestCase("ParameterOutOfRangeBladeIdSetBladeMezzPassThroughMode", 24178);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Returns ParameterOutOfRange for Invalid BladeId. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            BladeResponse setBladeMezzResponse = new BladeResponse();
            this.TestChannelContext = this.ListTestChannelContexts[(int)WCSSecurityRole.WcsCmAdmin];

            foreach (int invalidValue in Enum.GetValues(typeof(InvalidBladeId)))
            {
                setBladeMezzResponse = this.TestChannelContext.SetBladeMezzPassThroughMode(invalidValue, "true");
                LogMessage.Message = string.Format(
                        "{0}: Command returns completion code {1} for invalid blade Id {2}",
                        this.currentApi, setBladeMezzResponse.completionCode, invalidValue);

                if (setBladeMezzResponse.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;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:28,代码来源:BladeMezzCommands.cs

示例14: OnlyAdminCanExecuteSetBladeMezzPassThroughMode

        private TestResponse OnlyAdminCanExecuteSetBladeMezzPassThroughMode(int bladeId)
        {
            TestCase testCase = new TestCase("OnlyAdminCanExecuteSetBladeMezzPassThroughMode", 24171);

            CmTestLog.Info(string.Format(
                "\n !!!!!!Verifying {0} Can Only Be Executed By WcsCmAdmin Users. WorkItemId: {1}!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            BladeResponse setBladeMezzResponse = new BladeResponse();

            // Loop through different user types
            foreach (WCSSecurityRole roleId in Enum.GetValues(typeof(WCSSecurityRole)))
            {
                this.TestChannelContext = this.ListTestChannelContexts[(int)roleId];

                try
                {
                    setBladeMezzResponse = this.TestChannelContext.SetBladeMezzPassThroughMode(bladeId, "true");
                    LogMessage.Message = string.Format(
                            "{0}: Command returns completion code {1} for user {2} for blade Id {3}",
                            currentApi, setBladeMezzResponse.completionCode, Enum.GetName(typeof(WCSSecurityRole), roleId), bladeId);

                    if (setBladeMezzResponse.completionCode == CompletionCode.Success &&
                        roleId == WCSSecurityRole.WcsCmAdmin)
                        LogMessage.Log(LogMessage.MessageType.Success, ref response);
                    else
                        LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                }
                catch (Exception ex)
                {
                    // Check error is due to permission HTTP 400 unauthorize
                    if (ex.Message.Contains("400"))
                    {
                        // Check if 400 error due to WcsAdmin (fail)
                        LogMessage.Message = string.Format("{0}: Command returned Bad Request for user {1} for bladeId {2}",
                            currentApi, Enum.GetName(typeof(WCSSecurityRole), roleId), bladeId);

                        if (roleId != WCSSecurityRole.WcsCmAdmin)
                            LogMessage.Log(LogMessage.MessageType.Success, ref response);
                        else
                            LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                    }
                    else
                    {
                        ChassisManagerTestHelper.IsTrue(false, "Exception: " + ex.Message);
                        response.Result = false;
                        response.ResultDescription.Append(ex.Message);
                    }
                }
            }

            testCase.LogPassOrFail(ref response, currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:55,代码来源:BladeMezzCommands.cs

示例15: AllGroupsCanExecuteGetPsuFirmwareStatus

        private TestResponse AllGroupsCanExecuteGetPsuFirmwareStatus()
        {
            TestCase testCase = new TestCase("AllGroupsCanExecuteGetPsuFirmwareStatus", 22696);

            CmTestLog.Info(string.Format("\n !!!!!!Verifying {0} Can Be Executed By All Users. WorkItemId: {1}.!!!!!!",
                this.currentApi, testCase.WorkItemId));
            TestResponse response = new TestResponse();

            // Get random Psu
            int[] psuIds = null;
            if (!ReturnSingleOrMultipleRandomPsus(1, ref psuIds, ref response))
                return response;
            UpdatePsu psu = new UpdatePsu(psuIds[0]);

            // Loop through different user types
            foreach (WCSSecurityRole roleId in Enum.GetValues(typeof(WCSSecurityRole)))
            {
                // Use different user context
                this.TestChannelContext = this.ListTestChannelContexts[(int)roleId];

                // Get Pass Through Mode and verify
                psu.psuFwStatus = this.TestChannelContext.GetPSUFirmwareStatus(psu.index);

                LogMessage.Message = string.Format(
                        "{0}: Command returned completion code {1} for user {2} and psu Id {3}",
                        this.currentApi, psu.psuFwStatus.completionCode,
                        Enum.GetName(typeof(WCSSecurityRole), roleId), psu.index);

                if (psu.psuFwStatus.completionCode != CompletionCode.Success)
                    LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                else
                    LogMessage.Log(LogMessage.MessageType.Success, ref response);

                // Verify Correct psuId returned by GetPsuFirmwareStatus
                LogMessage.Message = string.Format(
                    "{0}: Command returned psu Id {0} for expected psu Id {1}",
                    this.currentApi, psu.psuFwStatus.id, psu.index);

                if (psu.psuFwStatus.id != psu.index)
                    LogMessage.Log(LogMessage.MessageType.Failure, ref response);
                else
                    LogMessage.Log(LogMessage.MessageType.Success, ref response);
            }

            testCase.LogPassOrFail(ref response, this.currentApi);
            return response;
        }
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:47,代码来源:PsuFirmwareCommands.cs


注:本文中的TestCase.LogPassOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。