Граф коммитов

33 Коммитов

Автор SHA1 Сообщение Дата
Devis Lucato 44a612c5d2 New (admin) endpoint to delete all devices (#310) 2018-11-08 14:59:18 -08:00
Avani Patel 5a7875e7c6 Fix for incorrect active device count calculation. (#305) 2018-10-30 15:57:38 -07:00
Hugh Xiong bb62b8f017 Changes to create default simulations (#298) 2018-10-30 00:10:37 -07:00
Avani Patel 20f8059093 Add ActiveDevices counter to statistics and other updates (#304) 2018-10-29 16:36:27 -07:00
Avani Patel 55bff1c184 Statistics for simulations spanning multiple nodes (#287)
*
2018-10-26 15:49:22 -07:00
Hugh Xiong a5c896f40e Reset simulation deletion state on toggle(enable/disable) (#291)
* Reset simulation deletion states.
2018-10-23 17:28:38 -07:00
Peter Felts e2854f6782 Integrate SimulationManager (#270)
* Switching to SimulationManager from SimulationRunner
2018-10-17 17:16:05 -07:00
Hugh Xiong e4f1c79e69 Support for bulk deletion of devices (#275) 2018-10-12 16:49:29 -07:00
Devis Lucato d1a986f1dd bugfix: use correct Device IDs (#274) 2018-10-09 17:59:19 -07:00
Devis Lucato a7c0b021bf Create devices bulk import job (#255) 2018-10-01 10:08:31 -07:00
Harleen Thind 746054d018
Fix for creating Default Simulation (#264) 2018-09-26 12:29:40 -07:00
Hugh Xiong 2abcd73c33 When upserting a simulation, keep the original/internal/readonly prop… (#261) 2018-09-21 14:56:13 -07:00
Harleen Thind 939333e700
Bug fixes (#247) 2018-09-21 10:23:51 -07:00
Peter Felts a2e01dbacb Changes to start consuming new storage library by simulation and some configs (#243) 2018-09-18 22:22:47 -07:00
Devis Lucato df5d3023e7 Add partitions management (#254)
* Add partitions management, so that multiple VMs can work on a different set of devices.
2018-09-17 22:16:21 -07:00
Devis Lucato a8971a68ee Maintenance and clean up some build warnings (#252)
* Maintenance and clean up build warnings
2018-09-13 10:25:29 -07:00
sasathy 27ddbbeb67 Webinsights - Sending Diagnostics Data from Microservice to Diagnostics Backend (#236)
* Adding customer insights for different simulation events (start, stop, error)
2018-09-11 15:40:24 -07:00
Harleen Thind a5da099a01
Multiple simulation support and adding stats to simulation definition (#234)
* Support for configuring multiple simulations but running only 1 at a time
* Support for saving Simulation statistics
2018-08-31 20:34:27 -07:00
Avani Patel 4462cd41d7 APIs to Add and Delete devices (#225)
* Support for Add and Delete API for Devices
2018-08-27 11:38:58 -07:00
Devis Lucato c17ce82172
New logger & dependencies upgrade (#232)
* New logger, faster and easier to use
* Upgrade dependencies, just some maintenance and no breaking changes
* Code style cleanup
2018-08-12 15:36:40 -07:00
Devis Lucato 6f0d073713
Performance improvements (#223)
* Refactor code writing twin tags for better performance
* Refactor device properties code for better performance
* Refactor simulation runner for better performance
* Improve connections performance
* Reduce time to start simulation, by creating devices using the same conn string and fetching device from registry only if the authentication fails.
* Limit the number of pending threads attempting to deliver telemetry
* Change all stock device models to use AMQP
* Move SDK timeout setting and other hard coded magic numbers to config file
* Use default timeout value from SDK instead of hardcoding it
* Improve documentation in the configuration file
* Upgrade IoT SDK
* Improve logging in device client
* Reduce noise in the "Info" log level
* When building, remove "deleted files" left over from previous builds
* Improve error detection when creating devices with batch operations
* Recreate device client when the internal AMQP client is disposed (lib bug workaround)
* VS code config update
* Remove simulation version, not used anywhere
* Catch and log when a device model doesn't exist
* Log missing config settings
* Make sure the simulation object is not lost in case of errors while checking for simulation changes
* Limit async tests duration
* Remove IoT hub registry workaround
* Fix boolean conf values parsing
* Remove "en-us" from links in the comments
* Fix invalid parsing of environment variables
2018-07-17 16:37:58 -07:00
Hugh Xiong 59347ead63 Custom device model management (#199)
* New endpoint to CRUD custom device models, stored via storage adapter
* Note: stock models are read-only
* Some changes to internal classes used for device models, e.g. use Enum instead of Strings
* Fix incorrect exception used in the Simulations service class: when the ETag doesn't match use ResourceOutOfDateException, not ConflictingResourceException (no API change, same HTTP status code)
2018-05-22 17:24:57 -07:00
Jill Bender b211cb7805 Merge azure-iot-pcs-simulation into master (#197)
* Rewrite to use fewer threads and increase throughput
* Expose simulation metrics in the status endpoint
* When available, return a URL to the Azure Portal metrics of the pre-provisioned IoT Hub
* Allow to run a simulation against a custom IoT Hub, passing the connection string
* Allow to schedule a simulation, defining start and end time
* Improve security by running the service as a non-root user
* Support multiple behavior scripts in a device model
* Support custom device with custom sensors, behavior and frequency
* Allow to override the initial device state when creating a simulation
* When a simulation starts, create all the devices in batches
* When a simulation is deleted, delete also the devices
* Refactor timers to start sending telemetry as soon as possible
* Refactor and improve how simulation scripts access state and properties
* Change stock models to use AMQP (#189)
* Overall improvements to exceptions handling
* Disable SDK retry, and change timeout from default (4 minutes) to 10 seconds
* Do not retry sending telemetry on failure, skip message
* Use IoT Hub S2 SKU limits by default
* Upgrade to .NET Core 2.0.3
* Upgrade Azure IoT SDK: Devices 1.4.1 to 1.6.0, Devices Client 1.5.2 to 1.7.0
* Run simulation engine in the same process used for the web service
* Move docs, move wiki, new API specs, fix scripts for Windows Bash
* Fix the spelling of “ETag” and allow ETag=*
* Add internal scripts for increasing/decreasing/random telemetry
* Add env vars documentation ENVIRONMENT_VARIABLES.md
* Add more optional logging by device and by actor
* Use logging level and other logging settings from configuration
* Adjust unit test precision to mitigate flaky test
* Add system properties to telemetry messages
* Removing the squash flag from Docker scripts
* Use env vars in launchSettings.json
2018-04-12 17:42:46 -07:00
Devis Lucato 0d37f32671 Limit registry and twin operations as per configuration (#78)
* New configuration settings for rate limiting
* Rate connections and messaging frequency
* Don’t read the twin on creation
*  reate GitHub issues tracking the TODO notes
* Change the timer to run only once and support scenarios where it is being disposed
* Pass the cancellation through where it can be used by IoT SDK
* Fix web service returning the wrong ETag when editing a simulation
* Remove all the timeouts incompatible with throttling (i.e. throttling will slow down operations and a timeout wouldn’t make sense)
* Improve the Actor stop logic to be resilient to errors and make all the required steps regardless of exceptions
* Use async/await where possible to avoid the use of .Wait() and .Result
* Log throughput in debug mode
2017-10-18 22:21:01 -07:00
Devis Lucato 13e6ebf863 Code style 2017-09-22 18:43:21 -07:00
Tim Laverty 3ff4ffae0a Add capability to change simulation at runtime. (#54)
* reboot & firmware update support for other device models

* Add capability to change simulation.

* actor not existing cleanly

* typo

* update version

* Refactoring and nits per PR review.

* PR nits
2017-09-18 18:33:50 -07:00
Tim Laverty c33241a5cd Methods and docs (#40)
This PR provides method support for chillers in the default simulation: reboot, firmware update, increase pressure, and decrease pressure.  It also keeps reported properties in sync with desired properties (by polling for value changes).

* DeviceMethod implmentation class

* First round of methods, added: 1) infra for registering methods for devices, 2) walking avail. methods for each device.  Main functionality missing is allowing specifation and then running the method script.

* remove todo from actor

* nits to code style

* Move methods ownership from devicebootstrap to deviceclient.

* error handling and todos.

* retry method registration, minor fixes.

* nits, logging, removed exception handling for registering methods (it's handled by the parent method)

* bumped version

* code style nits

* Methods use scripts.

Desired properties are polled in UpdateDeviceState and delta is copied into Reported property values.

Telemetry is not sent if the device is marked other than online == "True"

* code style/cleanup changes.

change get query for simulations to linq query rather than iterating the list.

* update version

* Exception handling for updatedevicestate

nit for rename method execution endpoint to include Async suffix.

* nit fix comment code style

* Inject scriptinterpreter. refactoring.

* nits

* state update bug

* no need for scriptengine null check

* Bootstrap individual methods, implement decreasepressure aka EMergencyValveRelease

* remove connection string :(

* fixed threading problem w/ methods, implemented & tested first four methods

* Implement switch to turn random telemetry off; e.g. when increasepressure is called, wait until decreasepressure is called to turn it back on.

* remove clearing of DeviceMethodStatus

* Code style changes + fix some jslint errors

* Fix js methods files

* DeviceMethods code style changes

* Devices.cs code style

* JavascriptInterpreter.cs code style

* script changes for messages, docs

* Cleanup up Javascript functions, create Issue to track implementing functions not yet done.

* Halve the amount of telemetry sent

* Address PR comments.

* issue for script interpreter todo

* todos, nits, pr feedback
2017-09-07 15:08:26 -07:00
Devis Lucato fd79551bc0 Allow to delete simulations and change count of devices in the default template (#34)
* Allow to delete simulations and change the count of devices in the template
* Bump version number
2017-08-21 17:47:50 -07:00
Devis Lucato 570645bf2e Simulation seed data (#33)
* Complete seed data, complete all the device models as per specs
* Rename “device type” to “device model”
* Clean JS syntax, check with JS Lint
* Generate device IDs from device model ID, instead of device model Name
* Complete health check endpoint
2017-08-16 12:37:56 -07:00
Devis Lucato f2c8d6e92d Save simulations in the storage (#32)
* Store simulations using the storage adapter
* Implement device bootstrap scenario: when a new device is created, mark it as a simulated device and report some properties like device type, messages schema, and initial location.
* Remove dependency on IoT Hub manager and access IoT Hub directly
* Refactor state machine to reduce complexity and reuse code
* Add launch settings for Visual Studio
* Remove env var used for the web service TCP port
* Improve logging of exceptions to avoid log flooding
* Fix messages format, to always use the “_unit” convention
* Add JSON config checks
2017-08-15 10:39:11 -07:00
Devis Lucato 892a55e7e4 Generate telemetry using external scripts (#22)
Use external Javascript functions to generate the telemetry for simulated devices. The path of folder that contain the Javascript files can be configured, so it's possible to mount JS files from anywhere. Files are loaded at runtime. The name of the files is specified in the Device Type JSON files, which are managed in the same way, with a configurable path and loaded at runtime.
Javascript files are interpreted using Jint https://github.com/sebastienros/jint .
Documentation here: https://github.com/Azure/device-simulation-dotnet/wiki/Device-Types
2017-07-11 10:28:55 -07:00
Devis Lucato 360ec08524 Remove Akka and update to new template (#21)
Remove Akka and use .NET Thread Pool to manage multiple threads sending telemetry. The lack of Akka means some extra work that we'll need in order to distribute the simulation over multiple servers. For the time being, we assume that the simulation runs in one instance only. If Akka's move to .NET Core is ready we can move back to Akka, otherwise we need some partitioning logic to distribute the load over multiple machines.

Upgrade the project to the latest template, e.g. scripts and documentations. Minor fixes for cross-platform development (VS2017 and Rider).

Complete the /status endpoint to check if IoT Hub Manager is available. In order to run the simulation, IoT Hub Manager is required. Without this check, it was too difficult to debug whether the service could connect to IoT Hub Manager or not, particularly when using Docker Compose.

Added Docker Compose file, to bootstrap this service and IoT Hub Manager containers. Add script to publish to Docker Hub. Move Docker image version/tag to a version file, so that the version is not hard coded in multiple places.

Fix an issue with the logger using too much memory when serializing exceptions.

Improve handling of exceptions caused by unreachable external dependencies when using the HTTP client.
2017-07-07 13:49:03 -07:00
Devis Lucato 1e2ef4051c Add device types and simulations endpoints
* Add new endpoint to list all the supported device types. Device types are configured via JSON files external to the assembly, so that users can add custom types without rebuilding the service. The files include a README describing the format of these files.
* Add simulations storage and endpoint with input validation and error handling. Supports creating a default simulation.
* Improve performance by using singletons
* Add missing property in the Status endpoint
* Make sure the temporary storage is usable when working in an IDE
2017-05-30 20:05:48 -07:00