diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs
index 80231d2ef..f5a7118d0 100644
--- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs
+++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceModelMapperTests.cs
@@ -86,7 +86,6 @@ public void CreateDeviceModelStateUnderTestExpectedBehavior(bool isBuiltin, bool
entity[nameof(LoRaDeviceModel.SupportLoRaFeatures)] = supportLora;
entity[nameof(LoRaDeviceModel.Name)] = "FAKE DEVICE";
entity[nameof(LoRaDeviceModel.Description)] = "FAKE DESCRIPTION";
- entity[nameof(LoRaDeviceModel.AppEUI)] = "FAKE APP EUI";
entity[nameof(LoRaDeviceModel.SensorDecoder)] = "FAKE SENSORDECODERURL";
// Act
@@ -98,7 +97,6 @@ public void CreateDeviceModelStateUnderTestExpectedBehavior(bool isBuiltin, bool
Assert.AreEqual(entity.RowKey, result.ModelId);
Assert.AreEqual(entity[nameof(LoRaDeviceModel.Name)], result.Name);
Assert.AreEqual(entity[nameof(LoRaDeviceModel.Description)], result.Description);
- Assert.AreEqual(entity[nameof(LoRaDeviceModel.AppEUI)], result.AppEUI);
Assert.AreEqual(entity[nameof(LoRaDeviceModel.SensorDecoder)], result.SensorDecoder);
Assert.AreEqual(entity[nameof(LoRaDeviceModel.SupportLoRaFeatures)], supportLora);
Assert.AreEqual(entity[nameof(LoRaDeviceModel.IsBuiltin)], isBuiltin);
@@ -118,7 +116,6 @@ public void UpdateTableEntityStateUnderTestExpectedBehavior(bool isBuiltin, bool
{
ModelId = entity.RowKey,
Name = Guid.NewGuid().ToString(),
- AppEUI = Guid.NewGuid().ToString(),
Description = Guid.NewGuid().ToString(),
ImageUrl = new Uri("http://fake.local"),
SensorDecoder = Guid.NewGuid().ToString(),
@@ -138,7 +135,6 @@ public void UpdateTableEntityStateUnderTestExpectedBehavior(bool isBuiltin, bool
Assert.AreEqual(model.Description, entity[nameof(LoRaDeviceModel.Description)]);
Assert.AreEqual(supportLora, entity[nameof(LoRaDeviceModel.SupportLoRaFeatures)]);
Assert.AreEqual(isBuiltin, entity[nameof(LoRaDeviceModel.IsBuiltin)]);
- Assert.AreEqual(model.AppEUI, entity[nameof(LoRaDeviceModel.AppEUI)]);
Assert.AreEqual(model.SensorDecoder, entity[nameof(LoRaDeviceModel.SensorDecoder)]);
this.mockRepository.VerifyAll();
}
diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs
index ae7d9215f..90f9456bb 100644
--- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs
+++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Mappers/LoRaDeviceTwinMapperTests.cs
@@ -226,6 +226,7 @@ public void UpdateTwinStateUnderTestExpectedBehavior()
Assert.AreEqual(item.Tags[tagName], DeviceHelper.RetrieveTagValue(twin, tagName));
}
+ Assert.AreEqual(item.AppEUI, twin.Properties.Desired[nameof(LoRaDeviceDetails.AppEUI)].ToString());
Assert.AreEqual(item.AppKey, twin.Properties.Desired[nameof(LoRaDeviceDetails.AppKey)].ToString());
this.mockRepository.VerifyAll();
diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs
index cda335e76..903a2c1fa 100644
--- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs
+++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Pages/DevicesModels/CreateDeviceModelPageTests.cs
@@ -279,7 +279,6 @@ public void ClickOnSaveShouldPostLoRaDeviceModelData()
cut.WaitForElement($"#{nameof(DeviceModel.Name)}").Change(modelName);
cut.WaitForElement($"#{nameof(DeviceModel.Description)}").Change(description);
- (cut.Instance.Model as LoRaDeviceModel).AppEUI = "AppEUI";
saveButton.Click();
diff --git a/src/AzureIoTHub.Portal.Server.Tests.Unit/Validators/LoRaDeviceModelValidatorTests.cs b/src/AzureIoTHub.Portal.Server.Tests.Unit/Validators/LoRaDeviceModelValidatorTests.cs
index bde7aa74c..3ea6505d6 100644
--- a/src/AzureIoTHub.Portal.Server.Tests.Unit/Validators/LoRaDeviceModelValidatorTests.cs
+++ b/src/AzureIoTHub.Portal.Server.Tests.Unit/Validators/LoRaDeviceModelValidatorTests.cs
@@ -3,7 +3,6 @@
namespace AzureIoTHub.Portal.Server.Tests.Unit.Validators
{
- using System;
using AzureIoTHub.Portal.Client.Validators;
using AzureIoTHub.Portal.Models.v10.LoRaWAN;
using NUnit.Framework;
@@ -19,7 +18,7 @@ public void ValidateValidOTAAModel()
var loraModel = new LoRaDeviceModel()
{
UseOTAA = true,
- AppEUI = Guid.NewGuid().ToString(),
+ //AppEUI = Guid.NewGuid().ToString(),
};
// Act
@@ -30,26 +29,26 @@ public void ValidateValidOTAAModel()
Assert.AreEqual(0, loraModelValidation.Errors.Count);
}
- [Test]
- public void ValidateMissingAppEUIFieldShouldReturnError()
- {
+ //[Test]
+ //public void ValidateMissingAppEUIFieldShouldReturnError()
+ //{
- // Arrange
- var loraModelValidator = new LoRaDeviceModelValidator();
- var loraModel = new LoRaDeviceModel()
- {
- UseOTAA = true,
- AppEUI = "",
- };
+ // // Arrange
+ // var loraModelValidator = new LoRaDeviceModelValidator();
+ // var loraModel = new LoRaDeviceModel()
+ // {
+ // UseOTAA = true,
+ // //AppEUI = "",
+ // };
- // Act
- var loraModelValidation = loraModelValidator.Validate(loraModel);
+ // // Act
+ // var loraModelValidation = loraModelValidator.Validate(loraModel);
- // Assert
- Assert.IsFalse(loraModelValidation.IsValid);
- Assert.AreEqual(1, loraModelValidation.Errors.Count);
- Assert.AreEqual(loraModelValidation.Errors[0].ErrorMessage, "AppEUI is required.");
+ // // Assert
+ // Assert.IsFalse(loraModelValidation.IsValid);
+ // Assert.AreEqual(1, loraModelValidation.Errors.Count);
+ // Assert.AreEqual(loraModelValidation.Errors[0].ErrorMessage, "AppEUI is required.");
- }
+ //}
}
}
diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor
index 6c7ba6948..859e06170 100644
--- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor
+++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/CreateDeviceModelPage.razor
@@ -300,11 +300,6 @@
{
var loraDeviceModel = Model as LoRaDeviceModel;
- if (!loraDeviceModel.UseOTAA)
- {
- loraDeviceModel.AppEUI = null;
- }
-
loraDeviceModel.SupportLoRaFeatures = true;
await LoRaWanDeviceModelsClientService.CreateDeviceModel(loraDeviceModel);
diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor
index 4f0305c56..d370136fd 100644
--- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor
+++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/CreateLoraDeviceModel.razor
@@ -13,13 +13,12 @@
@(LoRaDeviceModel.UseOTAA ? "OTAA setting" : "ABP setting") is used
- @if (!LoRaDeviceModel.UseOTAA)
- {
+ @if (!LoRaDeviceModel.UseOTAA)
+ {
+ }
-
- }
- @if (LoRaDeviceModel.UseOTAA)
- {
-
-
-
- }
diff --git a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor
index ce6eff7bd..166e4853a 100644
--- a/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor
+++ b/src/AzureIoTHub.Portal/Client/Pages/DeviceModels/LoRaWAN/EditLoraDeviceModel.razor
@@ -13,12 +13,12 @@
@(LoRaDeviceModel.UseOTAA ? "OTAA setting" : "ABP setting") is used
- @if (!LoRaDeviceModel.UseOTAA)
- {
+ @if (!LoRaDeviceModel.UseOTAA)
+ {
+ }
- }
- @if (LoRaDeviceModel.UseOTAA)
- {
-
-
-
- }
diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor
index e56d065a5..f29e1f5df 100644
--- a/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor
+++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor
@@ -405,7 +405,6 @@
var loRaDeviceModelResult = await LoRaWanDeviceModelsClientService.GetDeviceModel(model.ModelId);
- device.AppEUI = loRaDeviceModelResult.AppEUI;
device.SensorDecoder = loRaDeviceModelResult.SensorDecoder;
device.UseOTAA = loRaDeviceModelResult.UseOTAA;
loRaDeviceModel = loRaDeviceModelResult;
diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor
index 5109f2a95..a62eda861 100644
--- a/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor
+++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/LoRaWAN/CreateLoraDevice.razor
@@ -16,9 +16,7 @@
Label="OTAA AppEUI"
Variant="Variant.Outlined"
For="@(()=> LoRaDevice.AppEUI)"
- ReadOnly="true"
- Required="true"
- HelperText="OTAA AppEUI is automatically set from the selected model" />
+ Required="true" />
-
+
diff --git a/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs b/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs
index 2b7ce28e0..9799b88d4 100644
--- a/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs
+++ b/src/AzureIoTHub.Portal/Client/Validators/LoRaDeviceModelValidator.cs
@@ -8,13 +8,5 @@ namespace AzureIoTHub.Portal.Client.Validators
public class LoRaDeviceModelValidator : AbstractValidator
{
- public LoRaDeviceModelValidator()
- {
- _ = RuleFor(x => x.AppEUI)
- .NotEmpty()
- //.Length(1, 100)
- .When(x => x.UseOTAA)
- .WithMessage("AppEUI is required.");
- }
}
}
diff --git a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs
index 608d33775..e198d91ac 100644
--- a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs
+++ b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceMapper.cs
@@ -108,6 +108,7 @@ public void UpdateTwin(Twin twin, LoRaDeviceDetails item)
Helpers.DeviceHelper.SetTagValue(twin, nameof(item.ModelId), item.ModelId);
// Update OTAA settings
+ Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.AppEUI), item.AppEUI);
Helpers.DeviceHelper.SetDesiredProperty(twin, nameof(item.AppKey), item.AppKey);
// Update ABP settings
diff --git a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs
index ebc8f04a1..07641c821 100644
--- a/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs
+++ b/src/AzureIoTHub.Portal/Server/Mappers/LoRaDeviceModelMapper.cs
@@ -47,7 +47,6 @@ public LoRaDeviceModel CreateDeviceModel(TableEntity entity)
ImageUrl = this.deviceModelImageManager.ComputeImageUri(entity.RowKey),
Name = entity[nameof(LoRaDeviceModel.Name)]?.ToString(),
Description = entity[nameof(LoRaDeviceModel.Description)]?.ToString(),
- AppEUI = entity[nameof(LoRaDeviceModel.AppEUI)]?.ToString(),
SensorDecoder = entity[nameof(LoRaDeviceModel.SensorDecoder)]?.ToString(),
SupportLoRaFeatures = true,
UseOTAA = bool.Parse(entity[nameof(LoRaDeviceModel.UseOTAA)]?.ToString() ?? "true"),
@@ -79,11 +78,6 @@ public Dictionary UpdateTableEntity(TableEntity entity, LoRaDevi
var desiredProperties = new Dictionary();
- if (model.UseOTAA)
- {
- AddOptionnalProperties(entity, nameof(LoRaDeviceModel.AppEUI), model.AppEUI, desiredProperties);
- }
-
AddOptionnalProperties(entity, nameof(LoRaDeviceModel.SensorDecoder), model.SensorDecoder, desiredProperties);
AddOptionnalProperties(entity, nameof(LoRaDeviceBase.Supports32BitFCnt), model.Supports32BitFCnt, desiredProperties);
AddOptionnalProperties(entity, nameof(LoRaDeviceBase.ABPRelaxMode), model.ABPRelaxMode, desiredProperties);
diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs
index 7c1640cec..967fe1a37 100644
--- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs
+++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceBase.cs
@@ -35,12 +35,6 @@ public class LoRaDeviceBase : DeviceDetails
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public bool UseOTAA { get; set; }
- ///
- /// The device OTAA Application eui.
- ///
- // [Required(ErrorMessage = "The OTAA App EUI is required.")]
- public string AppEUI { get; set; }
-
///
/// The sensor decoder API Url.
///
diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceDetails.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceDetails.cs
index ace9fc887..0e8376135 100644
--- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceDetails.cs
+++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceDetails.cs
@@ -14,6 +14,12 @@ public class LoRaDeviceDetails : LoRaDeviceBase
// [Required(ErrorMessage = "The LoRa Device OTAA App Key is required.")]
public string AppKey { get; set; }
+ ///
+ /// The device OTAA Application EUI.
+ ///
+ // [Required(ErrorMessage = "The OTAA App EUI is required.")]
+ public string AppEUI { get; set; }
+
///
/// The ABP AppSKey.
///
diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs
index a099b35fb..c665bff73 100644
--- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs
+++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/LoRaWAN/LoRaDeviceModelBase.cs
@@ -28,12 +28,6 @@ public class LoRaDeviceModelBase : DeviceModel
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public bool UseOTAA { get; set; }
- ///
- /// The device OTAA Application eui.
- ///
- // [Required(ErrorMessage = "The OTAA App EUI is required.")]
- public string AppEUI { get; set; }
-
///
/// The sensor decoder API Url.
///