Exemple #1
0
        /// <summary>
        /// 查找eSight主机信息,并且打开.
        /// </summary>
        /// <param name="hostIP">主机IP</param>
        /// <returns>返回查找到的eSight,没有找到返回为null</returns>
        public IESSession FindAndOpenESSession(string hostIP)
        {
            try
            {
                IESSession iESSession = FindESSession(hostIP);
                //Find eSightHost...
                HWESightHost hwESightHost = HWESightHostDal.Instance.FindByIP(hostIP);

                if (iESSession != null)
                {
                    if (IsSameESightHost(hwESightHost, iESSession.HWESightHost))
                    {
                        iESSession.Open();
                    }
                    else
                    {
                        iESSession.InitESight(hwESightHost, ConstMgr.HWESightHost.DEFAULT_TIMEOUT_SEC);
                        iESSession.Open();
                    }
                }
                return(iESSession);
            }
            catch (Exception se)
            {
                LogUtil.HWLogger.API.Error(se);
                throw;
            }
        }
 private static void ConnectESSession(IESSession esSession)
 {
     if (string.IsNullOrEmpty(esSession.OpenID))
     {
         esSession.Open();
     }
 }
        public void QueryTemplatePageTest()
        {
            _esSession.Open();
            WebOneESightParam <Object> webQueryParam = new WebOneESightParam <Object>();

            webQueryParam.ESightIP = "127.0.0.1";
            webQueryParam.Param    = null;
            LogUtil.HWLogger.API.Info("QueryTemplatePageToJsonTest Param:" + JsonUtil.SerializeObject(webQueryParam));


            QueryLGListResult <DeployTemplate> templatePage = _esSession.DeployWorker.QueryTemplatePage(1, 20, "OS");

            LogUtil.HWLogger.API.Info("template list:" + JsonUtil.SerializeObject(templatePage));
            Assert.IsNotNull(templatePage);
        }
 /// <summary>
 /// 查找eSight主机信息,并且打开.
 /// </summary>
 /// <param name="hostIP">主机IP</param>
 /// <returns>返回查找到的eSight,没有找到返回为null</returns>
 public IESSession FindAndOpenESSession(string hostIP)
 {
     try
     {
         IESSession iESSession = FindESSession(hostIP);
         if (iESSession != null)
         {
             iESSession.Open();
             iESSession.SaveToDB();//保存状态。
         }
         return(iESSession);
     }
     catch (Exception se)
     {
         LogUtil.HWLogger.API.Error(se);
         throw;
     }
 }