예제 #1
0
 /// <summary>
 /// 更新子刀片
 /// </summary>
 /// <param name="model">The model.</param>
 public void UpdateChildBladeServer(HWDeviceDetail model)
 {
     try
     {
         var server = new ChildBlade(this.ESightIp);
         server.MakeChildBladeDetail(model);
         BladeConnector.Instance.UpdateChildBlade(server);
     }
     catch (Exception ex)
     {
         this.OnNotifyError($"UpdateChildBladeServer Error.eSight:{this.ESightIp} Dn:{model.DN}. ", ex);
     }
 }
 /// <summary>
 /// 更新子刀片
 /// 子刀片DN 上报的告警 刷新该子刀片及管理板(包括交换板)
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="alarmSn">The alarm sn.</param>
 private void UpdateChildBladeServer(HWDeviceDetail model, int alarmSn)
 {
     try
     {
         logger.NotifyProcess.Info($"Start Update ChildBladeServer:{model.DN}.[alarmSn:{alarmSn}]");
         //更新子刀片
         var server = new ChildBlade(this.ESightIp);
         server.MakeChildBladeDetail(model);
         BladeConnector.Instance.UpdateChildBlade(server, false);
     }
     catch (Exception ex)
     {
         logger.NotifyProcess.Error(ex, $"UpdateChildBladeServer Error. Dn:{model.DN} .[alarmSn:{alarmSn}]. ");
     }
 }
        /// <summary>
        /// The reload.
        /// </summary>
        public void Reload()
        {
            var bladeMain       = this.GetMain("bladeList.js");
            var highdensityMain = this.GetMain("highdensityList.js");

            var bladeChildDetial = this.GetDetails("bladeChildDetial.js");
            var bladeDetial      = this.GetDetails("bladeDetial.js");

            var highdensityChildDetial = this.GetDetails("highdensityChildDetial.js");
            var highdensityDetial      = this.GetDetails("highdensityDetial.js");

            // var rackMain = this.GetMain("rackList.js");
            var rackDetail = this.GetDetails("rackDetail.js");

            // var kunLunMain = this.GetMain("kunlunList.js");
            var kunLunDetail = this.GetDetails("kunlunDetail.js");

            this.BladeTest = new BladeServer(bladeMain);
            bladeMain.ChildBlades.ForEach(
                m =>
            {
                var childBlade = new ChildBlade(m);
                childBlade.MakeChildBladeDetail(bladeChildDetial);
                this.BladeTest.ChildBlades.Add(childBlade);
            });
            this.BladeTest.MakeDetail(bladeDetial);

            this.HighTest = new HighdensityServer(highdensityMain);
            highdensityMain.ChildBlades.ForEach(
                m =>
            {
                var childHighdensity = new ChildHighdensity(m);
                childHighdensity.MakeChildBladeDetail(highdensityChildDetial);
                this.HighTest.ChildHighdensitys.Add(childHighdensity);
            });
            this.HighTest.MakeDetail(highdensityDetial);

            this.RackTest = new RackServer();
            this.RackTest.MakeDetail(rackDetail);

            this.KunLunTest = new KunLunServer();
            this.KunLunTest.MakeDetail(kunLunDetail);

            #region MyRegion
            var path = Application.StartupPath + "//..//..//..//..//..//..//..//..//mockNew//alarmData//alarmData.js";
            var data = File.ReadAllText(path).Replace("module.exports =", string.Empty);

            this.BladeEventData      = new EventData(JsonUtil.DeserializeObject <AlarmData>(data.Replace("rack", "blade")));
            this.ChildBladeEventData = new EventData(JsonUtil.DeserializeObject <AlarmData>(data.Replace("rack", "childeblade")));
            this.HighEventData       = new EventData(JsonUtil.DeserializeObject <AlarmData>(data.Replace("rack", "high")));
            this.ChildHighEventData  = new EventData(JsonUtil.DeserializeObject <AlarmData>(data.Replace("rack", "childhigh")));
            this.KunLunEventData     = new EventData(JsonUtil.DeserializeObject <AlarmData>(data.Replace("rack", "kunlun")));
            this.RackEventData       = new EventData(JsonUtil.DeserializeObject <AlarmData>(data.Replace("rack", "rack")));

            path = Application.StartupPath + "//..//..//..//..//..//..//..//..//mockNew//alarmData//deviceChangeData.js";
            data = File.ReadAllText(path).Replace("module.exports =", string.Empty);
            var daTemp = JsonUtil.DeserializeObject <NedeviceData>(data);
            this.DeviceChangeEventData = new DeviceChangeEventData(daTemp);

            #endregion
        }