public void TestOpenId() { ESightEngine.Instance.SaveNewESSession(_hwESightHost.HostIP, _hwESightHost.HostPort, _hwESightHost.LoginAccount, _hwESightHost.LoginPwd); IESSession iSession = ESightEngine.Instance.FindAndOpenESSession(_hwESightHost.HostIP); DeviceParam queryDeviceParam = new DeviceParam(); queryDeviceParam.ServerType = ConstMgr.HWDevice.SERVER_TYPE_BLADE; queryDeviceParam.StartPage = 1; queryDeviceParam.PageSize = 100; queryDeviceParam.PageOrder = "ipAddress"; queryDeviceParam.OrderDesc = true; QueryPageResult <HWDevice> hwDevicePageResult = iSession.QueryHWPage(queryDeviceParam); LogUtil.HWLogger.DEFAULT.Info(hwDevicePageResult); Assert.IsTrue(!string.IsNullOrEmpty(iSession.OpenID)); }
/// <summary> /// 加载服务器列表, 用于服务器列表UI、添加升级任务UI、添加模板任务UI /// </summary> public static QueryPageResult <HWDevice> GetServerList(object eventData) { var ret = new QueryPageResult <HWDevice>() { Code = CoreUtil.GetObjTranNull <int>(ConstMgr.ErrorCode.SYS_UNKNOWN_ERR) }; try { //1. 解析js传过来的参数 var jsData = JsonUtil.SerializeObject(eventData); var webOneESightParam = JsonUtil.DeserializeObject <WebOneESightParam <DeviceParam> >(jsData); LogUtil.HWLogger.UI.InfoFormat("Querying server list, the param is [{0}]", jsData); //2. 根据HostIP获取IESSession IESSession esSession = ESSessionHelper.GetESSession(webOneESightParam.ESightIP); //3. 获取服务器列表数据 var hwDevicePageResult = esSession.QueryHWPage(webOneESightParam.Param); //4. 返回数据 ret = hwDevicePageResult; LogUtil.HWLogger.UI.InfoFormat("Querying server list successful, the ret is [{0}]", JsonUtil.SerializeObject(ret)); } catch (BaseException ex) { ret.Code = CoreUtil.GetObjTranNull <int>(ex.Code); ret.ErrorModel = ex.ErrorModel; ret.Description = ex.Message; ret.Data = null; ret.TotalSize = 0; ret.TotalPage = 0; LogUtil.HWLogger.UI.Error("Querying server list failed: ", ex); } catch (Exception ex) { ret.Code = CoreUtil.GetObjTranNull <int>(ConstMgr.ErrorCode.SYS_UNKNOWN_ERR); ret.Description = ex.InnerException.Message ?? ex.Message; ret.Data = null; ret.TotalSize = 0; ret.TotalPage = 0; LogUtil.HWLogger.UI.Error("Querying server list failed: ", ex); } return(ret); }