public IntegrationTestFixture() { this.Configuration = TestConfiguration.GetConfiguration(); TestLogger.Log($"[INFO] {nameof(this.Configuration.IoTHubAssertLevel)}: {this.Configuration.IoTHubAssertLevel}"); TestLogger.Log($"[INFO] {nameof(this.Configuration.NetworkServerModuleLogAssertLevel)}: {this.Configuration.NetworkServerModuleLogAssertLevel}"); AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException; SetupTestDevices(); // Fix device ID if a prefix was defined (DO NOT MOVE THIS LINE ABOVE DEVICE CREATION) if (!string.IsNullOrEmpty(Configuration.DevicePrefix)) { foreach (var d in GetAllDevices()) { d.DeviceID = string.Concat(Configuration.DevicePrefix, d.DeviceID.Substring(Configuration.DevicePrefix.Length, d.DeviceID.Length - Configuration.DevicePrefix.Length)); if (!string.IsNullOrEmpty(d.AppEUI)) { d.AppEUI = string.Concat(Configuration.DevicePrefix, d.AppEUI.Substring(Configuration.DevicePrefix.Length, d.AppEUI.Length - Configuration.DevicePrefix.Length)); } if (!string.IsNullOrEmpty(d.AppKey)) { d.AppKey = string.Concat(Configuration.DevicePrefix, d.AppKey.Substring(Configuration.DevicePrefix.Length, d.AppKey.Length - Configuration.DevicePrefix.Length)); } if (!string.IsNullOrEmpty(d.AppSKey)) { d.AppSKey = string.Concat(Configuration.DevicePrefix, d.AppSKey.Substring(Configuration.DevicePrefix.Length, d.AppSKey.Length - Configuration.DevicePrefix.Length)); } if (!string.IsNullOrEmpty(d.NwkSKey)) { d.NwkSKey = string.Concat(Configuration.DevicePrefix, d.NwkSKey.Substring(Configuration.DevicePrefix.Length, d.NwkSKey.Length - Configuration.DevicePrefix.Length)); } if (!string.IsNullOrEmpty(d.DevAddr)) { d.DevAddr = string.Concat(Configuration.DevicePrefix, d.DevAddr.Substring(Configuration.DevicePrefix.Length, d.DevAddr.Length - Configuration.DevicePrefix.Length)); } } } }
public IntegrationTestFixture() { this.Configuration = TestConfiguration.GetConfiguration(); if (!string.IsNullOrEmpty(Configuration.IoTHubEventHubConnectionString) && this.Configuration.NetworkServerModuleLogAssertLevel != NetworkServerModuleLogAssertLevel.Ignore) { this.NetworkServerLogEvents = new EventHubDataCollector(Configuration.IoTHubEventHubConnectionString, Configuration.IoTHubEventHubConsumerGroup); var startTask = this.NetworkServerLogEvents.Start(); startTask.ConfigureAwait(false).GetAwaiter().GetResult(); } var gatewayID = Environment.GetEnvironmentVariable("IOTEDGE_DEVICEID") ?? this.Configuration.LeafDeviceGatewayID; // Device1_OTAA: used for join test only this.Device1_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000001", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, RealDevice = true }; // Device2_OTAA: used for failed join (wrong devEUI) this.Device2_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000002", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = false, }; // Device3_OTAA: used for failed join (wrong appKey) this.Device3_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000003", AppEUI = "BE7A00000000FFE3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = true, }; // Device4_OTAA: used for OTAA confirmed & unconfirmed messaging this.Device4_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000004", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = true, }; // Device5_ABP: used for ABP confirmed & unconfirmed messaging this.Device5_ABP = new TestDeviceInfo() { DeviceID = "0000000000000005", AppEUI = "0000000000000005", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = true, AppSKey = "2B7E151628AED2A6ABF7158809CF4F3C", NwkSKey = "3B7E151628AED2A6ABF7158809CF4F3C", DevAddr = "0028B1B0" }; // Device6_ABP: used for ABP wrong devaddr this.Device6_ABP = new TestDeviceInfo() { DeviceID = "0000000000000006", AppEUI = "0000000000000006", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = false, AppSKey = "2B7E151628AED2A6ABF7158809CF4F3C", NwkSKey = "3B7E151628AED2A6ABF7158809CF4F3C", DevAddr = "0028B1B1", }; // Device7_ABP: used for ABP wrong nwkskey this.Device7_ABP = new TestDeviceInfo() { DeviceID = "0000000000000007", AppEUI = "0000000000000007", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = true, AppSKey = "2B7E151628AED2A6ABF7158809CF4F3C", NwkSKey = "3B7E151628AED2A6ABF7158809CF4F3C", DevAddr = "0028B1B2" }; // Device8_ABP: used for ABP invalid nwkskey (mic fails) this.Device8_ABP = new TestDeviceInfo() { DeviceID = "0000000000000008", AppEUI = "0000000000000008", GatewayID = gatewayID, SensorDecoder = "DecoderValueSensor", RealDevice = true, AppSKey = "2B7E151628AED2A6ABF7158809CF4F3C", NwkSKey = "3B7E151628AED2A6ABF7158809CF4F3C", DevAddr = "0028B1B3" }; // Device9_OTAA: used for confirmed message & C2D this.Device9_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000009", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, RealDevice = true }; // Device10_OTAA: used for unconfirmed message & C2D this.Device10_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000010", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, RealDevice = true }; // Device11_OTAA: used for http decoder this.Device11_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000011", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, RealDevice = true, SensorDecoder = "http://sensordecodermodule/api/DecoderValueSensor", }; // Device12_OTAA: used for reflection based decoder this.Device12_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000012", AppEUI = "BE7A0000000014E3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, RealDevice = true, SensorDecoder = "DecoderValueSensor", }; // Device13_OTAA: used for Join with wrong AppEUI this.Device13_OTAA = new TestDeviceInfo() { DeviceID = "0000000000000013", AppEUI = "BE7A00000000FEE3", AppKey = "8AFE71A145B253E49C3031AD068277A3", GatewayID = gatewayID, RealDevice = true, SensorDecoder = "DecoderValueSensor", }; }