protected NetworkGateway GetNetworkDefaultGateway() { NetworkGateway result = null; RunStep(() => { result = Client.GetNetworkDefaultGateway(); }, "Get Network Default Gateway"); DoRequestDelay(); return(result); }
public void NetworkGateway_Logging_WithParents() { var networkGateway = new NetworkGateway(_commonNetworkServices, _gatewayIPAddressSubnet); var logLevel = LogLevel.Debug; using (networkGateway.PushLogPropertiesParents(logLevel)) { Logger?.LogDebug("TestDeviceLoggingWithParents {LogLevel}", logLevel); } }
public void GetNetworkDefaultGatewayTest() { RunTest(() => { NetworkGateway gateway = GetNetworkDefaultGateway(); Assert(gateway != null, "The DUT did not return network default gateway configuration", "Check if network default configuration returned"); BeginStep("Validate addresses"); string ipv4addresses = DumpStringArray(gateway.IPv4Address); LogStepEvent(string.Format("IPv4 addresses: {0}", ipv4addresses)); if (gateway.IPv4Address != null) { foreach (string address in gateway.IPv4Address) { // allow empty addresses if (!string.IsNullOrEmpty(address)) { //System.Net.IPAddress.TryParse parses incorrect addresses if (!address.IsValidIPv4Address()) { throw new AssertException(string.Format("Address {0} is incorrect", address)); } } } } string ipv6addresses = DumpStringArray(gateway.IPv6Address); LogStepEvent(string.Format("IPv6 addresses: {0}", ipv6addresses)); if (gateway.IPv6Address != null) { foreach (string address in gateway.IPv6Address) { if (!string.IsNullOrEmpty(address)) { System.Net.IPAddress parsedAddress; if (!System.Net.IPAddress.TryParse(address, out parsedAddress) || (parsedAddress.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)) { throw new AssertException(string.Format("Address {0} is incorrect", address)); } } } } StepPassed(); }); }
public void NetworkGateway_SwitchGateway() { var networkGateway = new NetworkGateway(_commonNetworkServices, _gatewayIPAddressSubnet); var physicalAddress = networkGateway.PhysicalAddress; physicalAddress.Should().NotBeNull(); networkGateway.IPAddressSubnet = new IPAddressSubnet(IPAddress.Parse("10.1.10.33"), IPAddressExtensions.SubnetClassC); var newPhysicalAddress = networkGateway.PhysicalAddress; networkGateway.PhysicalAddress.Should().Be(newPhysicalAddress); }
public override void LoopContent() { ////皮带料流状态 //beltWrapper.MachineName = JsonConvert.SerializeObject(new { ID = Config.WrapperId, status = Const.OpcDatasource.BeltStatus }, Formatting.None); //状态为3位数的数字,从左至右分别为斗轮逆变状态、悬皮状态以及地面皮带状态 beltWrapper.MachineName = JsonConvert.SerializeObject(new { ID = Config.WrapperId, status = Const.OpcDatasource.WheelTurningBackwards * 1000 + Const.OpcDatasource.BeltStatus * 100 + Const.OpcDatasource.GroundBeltStatus * 10 + Const.OpcDatasource.CoalOnBeltPlc }, Formatting.None); //单机姿态 //bool is_gnss_valid = Const.GnssInfo.WalkingPosition != 0 || Const.GnssInfo.PitchAngle != 0 || Const.GnssInfo.YawAngle != 0; Const.Wrapper.Walking = (float)Const.GnssInfo.WalkingPosition; Const.Wrapper.PitchAngle = (float)Const.GnssInfo.PitchAngle; Const.Wrapper.YawAngle = (float)Const.GnssInfo.YawAngle; Const.Wrapper.PostureStatus = Const.GnssInfo.Working; //雷达报警级别 List <int> levels = Const.RadarInfo.RadarList == null ? null : Const.RadarInfo.RadarList.Select(r => r.ThreatLevel).ToList(); Const.WrapperAlarm.ThreatLevels = levels; //开始发送 if (++_counter >= _send_interval) { _counter = 0; NetworkGateway.SendProtobufCmd(SendMode.UDP, beltWrapper.MachineType, beltWrapper.Instance); } try { if (Const.IsGnssValid) { NetworkGateway.SendProtobufCmd(SendMode.UDP, Const.Wrapper.MachineType, Const.Wrapper.Instance); _taskLogsBuffer.Add("已向3维成像服务器发送单机姿态数据"); } //if (Const.WrapperAlarm.ThreatStatus != 0) //{ // NetworkGateway.SendProtobufCmd(Const.WrapperAlarm.MachineType, Const.WrapperAlarm.Instance); // _taskLogsBuffer.Add("已向3维成像服务器发送雷达数据"); //} } catch (Exception) { } }
public override void Init() { //NetworkGateway.Start(Config.DataServerIp, Config.UserName, Config.Password); NetworkGateway.Start(Config.DataServerIp, Config.DataUdpServerIp, Config.UserName, Config.Password); Const.WriteConsoleLog(string.Format("已向服务器{0}发起连接请求...", NetworkGateway.ServerIp)); }
/// <summary> /// Initializes a new instance of the <see cref="Client"/> class. /// </summary> internal Client() { this._networkGateway = new NetworkGateway(this); this.MessageManager = new MessageManager(this); }
public void NetworkGateway_ToString() { var networkGateway = new NetworkGateway(_commonNetworkServices, _gatewayIPAddressSubnet); TestOutputHelper.WriteLine(networkGateway.ToString()); }
public void NetworkGateway_Constructor() { var networkGateway = new NetworkGateway(_commonNetworkServices, TestIPAddressSubnet); networkGateway.Should().NotBeNull(); }