From 237e352241586029061649981f9a520b9cf62c7b Mon Sep 17 00:00:00 2001 From: Anca Antochi Date: Fri, 22 Jun 2018 01:45:11 +0000 Subject: [PATCH] Merged PR 915794: Update DeviceSDk to 1.17.0 and ServiceSDK to 1.16.0 Updated nugget packages Fix breaking change to ConfigurationContent --- ...oft.Azure.Devices.Edge.Agent.IoTHub.csproj | 4 +-- ...crosoft.Azure.Devices.Edge.Hub.Amqp.csproj | 2 +- ...t.Azure.Devices.Edge.Hub.CloudProxy.csproj | 2 +- ...crosoft.Azure.Devices.Edge.Hub.Core.csproj | 2 +- ...crosoft.Azure.Devices.Edge.Hub.Http.csproj | 2 +- .../EdgeHubConnectionTest.cs | 36 ++++++++++++------- .../SimulatedTemperatureSensor.csproj | 2 +- .../TemperatureFilter.csproj | 2 +- ...zure.Devices.Edge.Functions.Binding.csproj | 2 +- .../IotEdgeQuickstart.csproj | 2 +- smoke/IotEdgeQuickstart/details/Details.cs | 20 +++++++++-- 11 files changed, 52 insertions(+), 24 deletions(-) diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/Microsoft.Azure.Devices.Edge.Agent.IoTHub.csproj b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/Microsoft.Azure.Devices.Edge.Agent.IoTHub.csproj index eae4edb9351..0806723c870 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/Microsoft.Azure.Devices.Edge.Agent.IoTHub.csproj +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/Microsoft.Azure.Devices.Edge.Agent.IoTHub.csproj @@ -19,8 +19,8 @@ DEBUG;TRACE - - + + diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Amqp/Microsoft.Azure.Devices.Edge.Hub.Amqp.csproj b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Amqp/Microsoft.Azure.Devices.Edge.Hub.Amqp.csproj index 7124cc23fc2..7ff05ee7b4a 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Amqp/Microsoft.Azure.Devices.Edge.Hub.Amqp.csproj +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Amqp/Microsoft.Azure.Devices.Edge.Hub.Amqp.csproj @@ -18,7 +18,7 @@ - + diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/Microsoft.Azure.Devices.Edge.Hub.CloudProxy.csproj b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/Microsoft.Azure.Devices.Edge.Hub.CloudProxy.csproj index e1cd5dda07d..8fbb4851647 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/Microsoft.Azure.Devices.Edge.Hub.CloudProxy.csproj +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/Microsoft.Azure.Devices.Edge.Hub.CloudProxy.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE - + diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/Microsoft.Azure.Devices.Edge.Hub.Core.csproj b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/Microsoft.Azure.Devices.Edge.Hub.Core.csproj index a812f02134b..f605a7a640a 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/Microsoft.Azure.Devices.Edge.Hub.Core.csproj +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/Microsoft.Azure.Devices.Edge.Hub.Core.csproj @@ -27,7 +27,7 @@ - + diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Http/Microsoft.Azure.Devices.Edge.Hub.Http.csproj b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Http/Microsoft.Azure.Devices.Edge.Hub.Http.csproj index d42880c11a8..34a53f963c8 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Http/Microsoft.Azure.Devices.Edge.Hub.Http.csproj +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Http/Microsoft.Azure.Devices.Edge.Hub.Http.csproj @@ -27,7 +27,7 @@ - + diff --git a/edge-hub/test/Microsoft.Azure.Devices.Edge.Hub.E2E.Test/EdgeHubConnectionTest.cs b/edge-hub/test/Microsoft.Azure.Devices.Edge.Hub.E2E.Test/EdgeHubConnectionTest.cs index 0b799be46ef..f89f33deb05 100644 --- a/edge-hub/test/Microsoft.Azure.Devices.Edge.Hub.E2E.Test/EdgeHubConnectionTest.cs +++ b/edge-hub/test/Microsoft.Azure.Devices.Edge.Hub.E2E.Test/EdgeHubConnectionTest.cs @@ -280,10 +280,6 @@ Task ConfigUpdatedCallback(EdgeHubConfig updatedConfig) async Task SetDesiredProperties(RegistryManager registryManager, string edgeDeviceId) { - var cc = new ConfigurationContent() { ModuleContent = new Dictionary() }; - var twinContent = new TwinContent(); - cc.ModuleContent["$edgeHub"] = twinContent; - var desiredProperties = new { schemaVersion = "1.0", @@ -299,18 +295,24 @@ async Task SetDesiredProperties(RegistryManager registryManager, string edgeDevi timeToLiveSecs = 20 } }; - string patch = JsonConvert.SerializeObject(desiredProperties); - twinContent.TargetContent = new TwinCollection(patch); + var cc = new ConfigurationContent + { + ModulesContent = new Dictionary> + { + ["$edgeAgent"] = new Dictionary + { + ["properties.desired"] = desiredProperties + + } + } + }; + await registryManager.ApplyConfigurationContentOnDeviceAsync(edgeDeviceId, cc); } async Task UpdateDesiredProperties(RegistryManager registryManager, string edgeDeviceId) { - var cc = new ConfigurationContent() { ModuleContent = new Dictionary() }; - var twinContent = new TwinContent(); - cc.ModuleContent["$edgeHub"] = twinContent; - var desiredProperties = new { schemaVersion = "1.0", @@ -327,8 +329,18 @@ async Task UpdateDesiredProperties(RegistryManager registryManager, string edgeD } }; - string patch = JsonConvert.SerializeObject(desiredProperties); - twinContent.TargetContent = new TwinCollection(patch); + var cc = new ConfigurationContent + { + ModulesContent = new Dictionary> + { + ["$edgeAgent"] = new Dictionary + { + ["properties.desired"] = desiredProperties + + } + } + }; + await registryManager.ApplyConfigurationContentOnDeviceAsync(edgeDeviceId, cc); } diff --git a/edge-modules/SimulatedTemperatureSensor/SimulatedTemperatureSensor.csproj b/edge-modules/SimulatedTemperatureSensor/SimulatedTemperatureSensor.csproj index 6900a291374..1997734e66f 100644 --- a/edge-modules/SimulatedTemperatureSensor/SimulatedTemperatureSensor.csproj +++ b/edge-modules/SimulatedTemperatureSensor/SimulatedTemperatureSensor.csproj @@ -25,7 +25,7 @@ - + diff --git a/edge-modules/TemperatureFilter/TemperatureFilter.csproj b/edge-modules/TemperatureFilter/TemperatureFilter.csproj index 0ef9d755aef..c0e4fdd2c5c 100644 --- a/edge-modules/TemperatureFilter/TemperatureFilter.csproj +++ b/edge-modules/TemperatureFilter/TemperatureFilter.csproj @@ -20,7 +20,7 @@ - + diff --git a/edge-modules/functions/binding/src/Microsoft.Azure.Devices.Edge.Functions.Binding/Microsoft.Azure.Devices.Edge.Functions.Binding.csproj b/edge-modules/functions/binding/src/Microsoft.Azure.Devices.Edge.Functions.Binding/Microsoft.Azure.Devices.Edge.Functions.Binding.csproj index 8ed59e5041b..a5c01789a71 100644 --- a/edge-modules/functions/binding/src/Microsoft.Azure.Devices.Edge.Functions.Binding/Microsoft.Azure.Devices.Edge.Functions.Binding.csproj +++ b/edge-modules/functions/binding/src/Microsoft.Azure.Devices.Edge.Functions.Binding/Microsoft.Azure.Devices.Edge.Functions.Binding.csproj @@ -21,7 +21,7 @@ - + diff --git a/smoke/IotEdgeQuickstart/IotEdgeQuickstart.csproj b/smoke/IotEdgeQuickstart/IotEdgeQuickstart.csproj index a601f539f48..cc4e0de7311 100644 --- a/smoke/IotEdgeQuickstart/IotEdgeQuickstart.csproj +++ b/smoke/IotEdgeQuickstart/IotEdgeQuickstart.csproj @@ -22,7 +22,7 @@ - + diff --git a/smoke/IotEdgeQuickstart/details/Details.cs b/smoke/IotEdgeQuickstart/details/Details.cs index 4c278513a9d..a2b503068c8 100644 --- a/smoke/IotEdgeQuickstart/details/Details.cs +++ b/smoke/IotEdgeQuickstart/details/Details.cs @@ -3,6 +3,7 @@ namespace IotEdgeQuickstart.Details { using System; + using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -12,6 +13,7 @@ namespace IotEdgeQuickstart.Details using Microsoft.Azure.Devices.Shared; using Microsoft.Azure.EventHubs; using Newtonsoft.Json; + using Newtonsoft.Json.Linq; public class Details { @@ -224,7 +226,21 @@ protected Task RemoveTempSensorFromEdgeDevice() (string deployJson, string[] _) = this.DeploymentJson(); var config = JsonConvert.DeserializeObject(deployJson); - config.ModuleContent["$edgeAgent"].TargetContent["modules"] = new { }; + JObject desired = JObject.FromObject(config.ModulesContent["$edgeAgent"]["properties.desired"]); + if (desired.TryGetValue("modules", out JToken modules)) + { + IList removeList = new List(); + foreach (JToken module in modules.Children()) + { + removeList.Add(module); + } + + foreach (JToken module in removeList) + { + module.Remove(); + } + } + config.ModulesContent["$edgeAgent"]["properties.desired"] = desired; return this.context.RegistryManager.ApplyConfigurationContentOnDeviceAsync(this.context.Device.Id, config); } @@ -340,7 +356,7 @@ string BuildImageName(string name) const string DeployJson = @" { - ""moduleContent"": { + ""modulesContent"": { ""$edgeAgent"": { ""properties.desired"": { ""schemaVersion"": ""1.0"",