Esempio n. 1
0
        public _IEXResult MountGroup()
        {
            PlatformContext  gatewayContext = GetGatewayContext();
            _Platform        GW             = gatewayContext.Platform;
            List <_Platform> Clients        = GetClientsList();

            _IEXResult res = null;

            if (DebugMode)
            {
                foreach (_Platform client in Clients)
                {
                    string temp;
                    client.IEX.IR.SendIR("MENU", out temp, 10000);
                }
                return(null);
            }

            int  Retries    = 0;
            bool HasFailure = false;

            do
            {
                HasFailure = false;
                lock (GatewayLocker)
                {
                    if (!gatewayContext.isMount && GW != null)
                    {
                        res = GW.EA.MountGw(_mountFlag);
                        if (!res.CommandSucceeded)
                        {
                            GW.IEX.LogComment("Failed to Mount Gateway: " + res.FailureReason, isBold: true, size: "12", colour: "Red");
                            return(res);
                        }
                    }
                    gatewayContext.isMount = true;
                }

                try
                {
                    Parallel.ForEach(Clients, CL =>
                    {
                        res = CL.EA.MountClient(_mountFlag, 1);
                        if (!res.CommandSucceeded && HasFailure == false)
                        {
                            CL.IEX.LogComment("Failed to Mount Client: " + res.FailureReason, isBold: true, size: "12", colour: "Red");
                            HasFailure = true;
                        }
                    });
                }
                catch (Exception)
                {
                    HasFailure = true;
                }

                Retries++;
            } while (HasFailure && Retries < 3);

            return(res);
        }
Esempio n. 2
0
        private void SaveGatewayContextData(short iexNum, bool clientIsGateway, string testName, int testIdentifier, string Server)
        {
            TestData testData;

            if (!clientIsGateway)
            {
                testData = new TestData(testName, PlatformType.GW, testIdentifier);
            }
            else
            {
                testData = new TestData(testName, PlatformType.CL, testIdentifier);
                testData.GatewayIsClient = true;
            }

            int index = PlatformAlreadyExists(iexNum);

            if (index >= 0) //platform exists already
            {
                _currentGroup.pContextList[index].Tests.Add(testData);
                _currentGroup.pContextList[index].TestsCounter++;
                //   _currentGroup.pContextList[index].IexServer = Server + ":" + iexNum.ToString();
            }
            else
            {
                PlatformContext pNew = new PlatformContext();
                pNew.iexNumber = iexNum;
                pNew.iexServer = Server + ":" + iexNum.ToString();
                pNew.TestsCounter++;
                pNew.Tests.Add(testData);
                _currentGroup.pContextList.Add(pNew);
            }
        }
Esempio n. 3
0
        public _IEXResult MountSingle()
        {
            PlatformContext gatewayContext = GetGatewayIsClientContext();
            _Platform       GW             = gatewayContext.Platform;
            _IEXResult      res            = null;

            if (DebugMode)
            {
                string temp;
                GW.IEX.IR.SendIR("MENU", out temp, 10000);
                return(null);
            }

            lock (GatewayLocker)
            {
                if (!gatewayContext.isMount && GW != null)
                {
                    res = GW.EA.MountGw(_mountFlag);
                    if (!res.CommandSucceeded)
                    {
                        GW.IEX.LogComment("Failed to Mount Gateway: " + res.FailureReason, isBold: true, size: "12", colour: "Red");
                        return(res);
                    }
                }
                gatewayContext.isMount = true;
            }
            return(res);
        }
Esempio n. 4
0
        private void SaveClientContextData(short iexNum, string Server, string testName, int testIdentifier)
        {
            TestData testData = new TestData(testName, PlatformType.CL, testIdentifier);

            int index = PlatformAlreadyExists(iexNum);

            if (index >= 0) //platform exists already
            {
                _currentGroup.pContextList[index].TestsCounter++;
                //  _currentGroup.pContextList[index].IexServer = Server + ":" + iexNum.ToString();
                _currentGroup.pContextList[index].Tests.Add(testData);
            }
            else
            {
                var pNew = new PlatformContext();
                pNew.iexNumber = iexNum;
                pNew.iexServer = Server + ":" + iexNum.ToString();
                pNew.TestsCounter++;
                pNew.Tests.Add(testData);
                _currentGroup.pContextList.Add(pNew);
            }
        }