Skip to content

Commit

Permalink
Merge pull request #356 from mtconnect/version-2.3-device-type-rest-i…
Browse files Browse the repository at this point in the history
…nterface

Version 2.3 deviceType rest interface parameter
  • Loading branch information
wsobel authored Nov 3, 2023
2 parents 112b841 + 02adeeb commit d8a818c
Show file tree
Hide file tree
Showing 68 changed files with 152,952 additions and 1,071 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ env:
# when to run workflow
on:
# # run on push or pull request events for the master branch
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
push:
tags:
- "v*.*.*"

# allows you to run this workflow manually from the actions tab
workflow_dispatch:
Expand All @@ -35,6 +34,14 @@ jobs:
build:
# the type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
include:
- dockerfile: docker/alpine/Dockerfile
name: agent
- dockerfile: demo/Dockerfile
name: demo

# steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -46,30 +53,34 @@ jobs:
# the QEMU emulator lets us build for arm processors also
# see https://github.com/docker/setup-qemu-action
- name: Set up QEMU emulator
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

# see https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


- name: Remove leading v from the version
run: |
echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_ENV
# see https://github.com/docker/build-push-action
- name: Build image and push to DockerHub
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
file: ${{ matrix.dockerfile }}
platforms: ${{ env.PLATFORMS }}

# docker hub user/repo:tag
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/agent:latest
${{ secrets.DOCKERHUB_USERNAME }}/agent:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ env.VERSION }}
# push to docker hub
push: true
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# The version number.
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 2)
set(AGENT_VERSION_MINOR 3)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 7)
set(AGENT_VERSION_RC "")
set(AGENT_VERSION_BUILD 0)
set(AGENT_VERSION_RC "_RC1")

# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)
Expand Down
173 changes: 99 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,31 @@ Configuration Parameters

*Default*: false

* `JsonVersion` - JSON Printer format. Old format: 1, new format: 2

*Default*: 2

* `SchemaVersion` - Change the schema version to a different version number.

*Default*: 2.0

* `MaxAssets` - The maximum number of assets the agent can hold in its buffer. The
number is the actual count, not an exponent.

*Default*: 1024

* `MonitorConfigFiles` - Monitor agent.cfg and Devices.xml files and restart agent if they change.

*Default*: false

* `MinimumConfigReloadAge` - The minimum age of a config file before an agent reload is triggered (seconds).

*Default*: 15

* `Pretty` - Pretty print the output with indententation

*Default*: false

* `PidFile` - UNIX only. The full path of the file that contains the
process id of the daemon. This is not supported in Windows.

Expand All @@ -609,96 +634,95 @@ Configuration Parameters

*Default*: MTConnect Agent

* `Port` - The port number the agent binds to for requests.

*Default*: 5000

* `ServerIp` - The server IP Address to bind to. Can be used to select the interface in IPV4 or IPV6.

*Default*: 0.0.0.0

* `AllowPut` - Allow HTTP PUT or POST of data item values or assets.
* `SuppressIPAddress` - Suppress the Adapter IP Address and port when creating the Agent Device ids and names. This applies to all adapters.

*Default*: false

* `AllowPutFrom` - Allow HTTP PUT or POST from a specific host or
list of hosts. Lists are comma (,) separated and the host names will
be validated by translating them into IP addresses.
* `WorkerThreads` - The number of operating system threads dedicated to the Agent

*Default*: none
*Default*: 1

#### Adapter General Configuration

* `JsonVersion` - JSON Printer format. Old format: 1, new format: 2
These can be overridden on a per-adapter basis

*Default*: 2
* `ConversionRequired` - Global default for data item units conversion in the agent.
Assumes the adapter has already done unit conversion.

* `LegacyTimeout` - The default length of time an adapter can be silent before it
is disconnected. This is only for legacy adapters that do not support heartbeats.
*Default*: true

* `EnableSourceDeviceModels` - Allow adapters and data sources to supply Device
configuration

*Default*: 600
*Default*: false

* `Heartbeat` – Overrides the heartbeat interval sent back from the adapter in the
`* PONG <hb>`. The heartbeat will always be this value in milliseconds.

* `ReconnectInterval` - The amount of time between adapter reconnection attempts.
This is useful for implementation of high performance adapters where availability
needs to be tracked in near-real-time. Time is specified in milliseconds (ms).

*Default*: 10000

*Default*: _None_

* `IgnoreTimestamps` - Overwrite timestamps with the agent time. This will correct
clock drift but will not give as accurate relative time since it will not take into
consideration network latencies. This can be overridden on a per adapter basis.

*Default*: false

* `LegacyTimeout` - The default length of time an adapter can be silent before it
is disconnected. This is only for legacy adapters that do not support heartbeats.

*Default*: 600

* `PreserveUUID` - Do not overwrite the UUID with the UUID from the adapter, preserve
the UUID in the Devices.xml file. This can be overridden on a per adapter basis.

*Default*: true

* `SchemaVersion` - Change the schema version to a different version number.

*Default*: 2.0

* `ConversionRequired` - Global default for data item units conversion in the agent.
Assumes the adapter has already done unit conversion.
* `ReconnectInterval` - The amount of time between adapter reconnection attempts.
This is useful for implementation of high performance adapters where availability
needs to be tracked in near-real-time. Time is specified in milliseconds (ms).

*Default*: 10000

* `ShdrVersion` - Specifies the SHDR protocol version used by the adapter. When greater than one (1),
allows multiple complex observations, like `Condition` and `Message` on the same line. If it equials one (1),
then any observation requiring more than a key/value pair need to be on separate lines. This is the default for all adapters.

*Default*: true
*Default*: 1
* `UpcaseDataItemValue` - Always converts the value of the data items to upper case.

*Default*: true

* `MaxAssets` - The maximum number of assets the agent can hold in its buffer. The
number is the actual count, not an exponent.
#### REST Service Configuration

*Default*: 1024

* `MonitorConfigFiles` - Monitor agent.cfg and Devices.xml files and restart agent if they change.
* `AllowPut` - Allow HTTP PUT or POST of data item values or assets.

*Default*: false

* `MinimumConfigReloadAge` - The minimum age of a config file before an agent reload is triggered (seconds).

*Default*: 15

* `Pretty` - Pretty print the output with indententation
* `AllowPutFrom` - Allow HTTP PUT or POST from a specific host or
list of hosts. Lists are comma (,) separated and the host names will
be validated by translating them into IP addresses.

*Default*: false
*Default*: none

* `HttpHeaders` - Additional headers to add to the HTTP Response for CORS Security

* `ShdrVersion` - Specifies the SHDR protocol version used by the adapter. When greater than one (1), allows multiple complex observations, like `Condition` and `Message` on the same line. If it equials one (1), then any observation requiring more than a key/value pair need to be on separate lines. This is the default for all adapters.
> Example: ```
> HttpHeaders {
> Access-Control-Allow-Origin = *
> Access-Control-Allow-Methods = GET
> Access-Control-Allow-Headers = Content-Type
> }```
*Default*: 1

* `SuppressIPAddress` - Suppress the Adapter IP Address and port when creating the Agent Device ids and names. This applies to all adapters.
* `Port` - The port number the agent binds to for requests.

*Default*: false
*Default*: 5000

* `ServerIp` - The server IP Address to bind to. Can be used to select the interface in IPV4 or IPV6.

* `WorkerThreads` - The number of operating system threads dedicated to the Agent
*Default*: 0.0.0.0

*Default*: 1

* `EnableSourceDeviceModels` -

*Default*: false

#### Configuration Pameters for TLS (https) Support ####

The following parameters must be present to enable https requests. If there is no password on the certificate, `TlsCertificatePassword` may be omitted.
Expand All @@ -707,31 +731,35 @@ The following parameters must be present to enable https requests. If there is n

*Default*: *NULL*

* `TlsPrivateKey` - The name of the file containing the private key for the certificate
* `TlsCertificatePassword` - The password used when creating the certificate. If none was supplied, do not use.

*Default*: *NULL*

* `TlsDHKey` - The name of the file containing the Diffie–Hellman key
* `TlsClientCAs` - For `TlsVerifyClientCertificate`, specifies a file that contains additional certificate authorities for verification

*Default*: *NULL*

* `TlsCertificatePassword` - The password used when creating the certificate. If none was supplied, do not use.
* `TlsDHKey` - The name of the file containing the Diffie–Hellman key

*Default*: *NULL*

* `TlsOnly` - Only allow secure connections, http requests will be rejected

*Default*: false

* `TlsPrivateKey` - The name of the file containing the private key for the certificate

*Default*: *NULL*

* `TlsVerifyClientCertificate` - Request and verify the client certificate against root authorities

*Default*: false

* `TlsClientCAs` - For `TlsVerifyClientCertificate`, specifies a file that contains additional certificate authorities for verification
### MQTT Configuration

* `MqttCaCert` - CA Certificate for MQTT TLS connection to the MTT Broker

*Default*: *NULL*

### MQTT Configuration

* `MqttHost` - IP Address or name of the MQTT Broker

Expand All @@ -741,10 +769,6 @@ The following parameters must be present to enable https requests. If there is n

*Default*: 1883

* `MqttCaCert` - CA Certificate for MQTT TLS connection to the MTT Broker

*Default*: *NULL*

* `MqttTls` - TLS Certificate for secure connection to the MQTT Broker

*Default*: *NULL*
Expand Down Expand Up @@ -785,25 +809,26 @@ Sinks {
}
```

* `ProbeTopic` - Prefix for the Device Model topic
* `AssetTopic` - Prefix for the Assets

*Default*: `MTConnect/Asset/[device]`

* `CurrentTopic` - Prefix for the Current

*Default*: `MTConnect/Current/[device]`

* `ProbeTopic` or `DeviceTopic` - Prefix for the Device Model topic

> Note: The `[device]` will be replace with the uuid of each device. Other patterns can be created,
> for example: `MTConnect/[device]/Probe` will group by device instead of operation.
> `DeviceTopic` will also work.
*Default*: `MTConnect/Probe/[device]`

* `CurrentTopic` - Prefix for the Current

*Default*: `MTConnect/Current/[device]`

* `SampleTopic` - Prefix for the Sample

*Default*: `MTConnect/Current/[device]`

* `AssetTopic` - Prefix for the Assets

*Default*: `MTConnect/Asset/[device]`

* `MqttCurrentInterval` - The frequency to publish currents. Acts like a keyframe in a video stream.

*Default*: 10000ms
Expand Down
4 changes: 3 additions & 1 deletion agent_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ target_clangtidy_setup(agent_lib)

include(../cmake/document.cmake)
if (AGENT_WITH_DOCS AND DOXYGEN_FOUND)
doxygen_add_docs(docs ../README.md ${AGENT_SOURCES})
file(GLOB _tests ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/*.cpp)
doxygen_add_docs(docs README.md ${AGENT_SOURCES} ${_tests}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.." )
install(DIRECTORY "${PROJECT_BINARY_DIR}/Documentation/" DESTINATION "Documentation")
endif()

Expand Down
1 change: 1 addition & 0 deletions cmake/document.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ if (DOXYGEN_FOUND)
set(DOXYGEN_INCLUDE_PATH "${CONAN_INCLUDE_DIRS}")
set(DOXYGEN_HTML_COLORSTYLE "AUTO_DARK")
set(DOXYGEN_MAX_DOT_GRAPH_DEPTH 3)
set(DOXYGEN_GENERATE_TESTLIST YES)
endif()
25 changes: 25 additions & 0 deletions conan/cmake/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sources:
"3.19.8":
url: https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8.tar.gz
sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369
"3.20.6":
url: https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6.tar.gz
sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72
"3.21.7":
url: https://github.com/Kitware/CMake/releases/download/v3.21.7/cmake-3.21.7.tar.gz
sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a
"3.22.6":
url: https://github.com/Kitware/CMake/releases/download/v3.22.6/cmake-3.22.6.tar.gz
sha256: 73933163670ea4ea95c231549007b0c7243282293506a2cf4443714826ad5ec3
"3.23.5":
url: "https://github.com/Kitware/CMake/releases/download/v3.23.5/cmake-3.23.5.tar.gz"
sha256: "f2944cde7a140b992ba5ccea2009a987a92413762250de22ebbace2319a0f47d"
"3.24.3":
url: "https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3.tar.gz"
sha256: "b53aa10fa82bff84ccdb59065927b72d3bee49f4d86261249fc0984b3b367291"
"3.25.2":
url: "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2.tar.gz"
sha256: "c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c"
"3.26.4":
url: "https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4.tar.gz"
sha256: "313b6880c291bd4fe31c0aa51d6e62659282a521e695f30d5cc0d25abbd5c208"
Loading

0 comments on commit d8a818c

Please sign in to comment.