Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint topic prefix configuration #502

Merged
merged 30 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
59ae04a
Simple topic prefix refactoring
grafnu Nov 11, 2022
1524631
Add topic prefix configuration
grafnu Nov 11, 2022
48af803
Adding javadoc
grafnu Nov 11, 2022
b063c56
Initial MqttDevice refactoring
grafnu Nov 11, 2022
e8c8597
Tweaking
grafnu Nov 11, 2022
aff3989
Adding obvious exception
grafnu Nov 11, 2022
a495909
Linty
grafnu Nov 12, 2022
06108c7
Fix some running things
grafnu Nov 12, 2022
2d9ec28
Use message format
grafnu Nov 12, 2022
9ae75cf
Basic mqtt refactoring
grafnu Nov 12, 2022
448d7d1
Add restart count debugging
grafnu Nov 12, 2022
69d08d1
Merge branch 'master' into endpoint
grafnu Nov 12, 2022
c961c53
Adding debug labels
grafnu Nov 12, 2022
e06b963
Merge branch 'master' into endpoint
grafnu Nov 12, 2022
3030098
Fix log output for failure
grafnu Nov 12, 2022
3c79b3a
Merge branch 'master' into endpoint
grafnu Nov 12, 2022
8106805
Fix topic registering
grafnu Nov 12, 2022
b698f08
Fix gateway attach topic
grafnu Nov 12, 2022
34e405f
Reverting changes
grafnu Nov 12, 2022
d55d6d3
Merge branch 'master' into endpoint
grafnu Nov 12, 2022
43ac94a
Fixing generated tests
grafnu Nov 12, 2022
87508e0
Add missing generated
grafnu Nov 12, 2022
aca741b
Add dynamic topic setting
grafnu Nov 12, 2022
c882cb3
Make classes package-private
grafnu Nov 12, 2022
dc7f930
Add actual check of topic in unit test
grafnu Nov 17, 2022
55afcfa
Cleanup test name
grafnu Nov 17, 2022
7bb4d6e
Merge remote-tracking branch 'faucet/master' into endpoint
grafnu Nov 18, 2022
4dfc278
Adding MqttPublisherTest
grafnu Nov 19, 2022
372c23e
Add published message test
grafnu Nov 19, 2022
628cadc
Deps cleanup
grafnu Nov 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gencode_hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ b35646a2f3d7c30fd34e3ea6ab6a1070b39c469fd1de49cab1093ff32faaf06d gencode/docs/c
e1f62882576d0f4332360f2aedb79b37a43973fb31d862c829af924f8f310ec1 gencode/docs/command_mapping.html
692ea694fbd8c88ebc1d7fed26363bd3e6b4e52061431a4d8c76bf0eddfaf2ff gencode/docs/config.html
30c7f39e50e290b0a36a3414cf1c90277ebd249f126f85f0a307bc7b74164e08 gencode/docs/config_mapping.html
51633513052c10d16fdc1bada9860c75fc0d1d5a9b8d6f9457e2845cfe4e750e gencode/docs/configuration_endpoint.html
e6b9cc7798e71237416b092801356f51c5178f3aac35811a8cee8a0045ad96d8 gencode/docs/configuration_endpoint.html
b7ca70e3176f997f254c32bd8d53dff1462ac8a71c0e166aaa85193d67bff60b gencode/docs/configuration_execution.html
7b7d42d19e15aa64f5e57dd3c8867e72279365c7f39405c512aa572f7e97f527 gencode/docs/configuration_pubber.html
d7fa593d3ec205465b220b72a6358a870bd52d6e61bd1426c9e5fb54cbbbdd56 gencode/docs/configuration_pubber.html
0f0355e343cb8197dfbae1481c0eca3a0566d73181bc968e33fd469a1c94d1e6 gencode/docs/envelope.html
f1fde870638541bea6de16acd64365c89a7d56ee3270d6fd1bcdbb5bdb141887 gencode/docs/event.html
a8800ab8384de3b846af0d72cf310acf01644842b557e42eec20b69a0bfa1868 gencode/docs/event_discovery.html
Expand All @@ -13,7 +13,7 @@ a8800ab8384de3b846af0d72cf310acf01644842b557e42eec20b69a0bfa1868 gencode/docs/e
35238ac2be3b2860bf74d291342897ef53a537a86aeb37d0eab55e3c8f8baecb gencode/docs/event_system.html
43025f61381de050eae9680c3193a1d878a397d0b5515dd1063a1a993b0c41ea gencode/docs/event_validation.html
9ae793a641f2e053c5af734bf813cd2637a675330acb8d9e903ef03b4286e007 gencode/docs/metadata.html
035be07b11b35920280a88c370ab34f600775216af10981aa212dfc3c9d3ddc5 gencode/docs/persistent_device.html
5856ee0b42512f6a1031f1799af2d9a436ed57a5d2f9265b95082b78cb1473fd gencode/docs/persistent_device.html
5d039d607af9ec75ee552dfe36b16c702687ea16f5663f41fc49b4533b86e00d gencode/docs/properties.html
392f272c1c8cd047eb6906f2f11ffacc7083c32f639da2437d6a9ca861062ecc gencode/docs/readme.md
690d56e96c4e180e49e0abcba358ab1842ea06dd3f693918852a9de370c994d5 gencode/docs/reflect_config.html
Expand Down Expand Up @@ -45,7 +45,7 @@ d8a80ab3180d33bfa17564c969018e1d4350a47dbc70c4ae8a5abbfb25cfedc9 gencode/java/u
4793b2370b1f3b8fd89941586b779dffdde83d321a2621907f67d4d297d19b17 gencode/java/udmi/schema/DiscoveryEvent.java
04112dd47b0f761131c276c67d3cd8b789d25e6716b5732be9fef14fc6831f1d gencode/java/udmi/schema/DiscoveryModel.java
9962b0eb7d5adf52af6160e9f3131f8eeb52ae9e518954dbb6aead1bcad0245e gencode/java/udmi/schema/DiscoveryState.java
c5ab32c7412c0cb3a8e48b4adb0a924c238dea655fddd581979c553c32f908d8 gencode/java/udmi/schema/EndpointConfiguration.java
caa0d61cb96d33ce4436af152f7189181b549d237ead953a805fdb078e5776dc gencode/java/udmi/schema/EndpointConfiguration.java
6fea7710d4eb64bfc568820f7063a89ce7808853ef7a56763fa90f323e09362f gencode/java/udmi/schema/Entry.java
017f8e237efa959b81d72f3dd2e78b915856198ceef02c041c657b30df93b7c2 gencode/java/udmi/schema/Envelope.java
e9f5c77be81486b6b8c6d88f70f2d50583d8c3fafa2ac09ead80f44b8d5e751e gencode/java/udmi/schema/Event.java
Expand Down Expand Up @@ -122,7 +122,7 @@ ac3facbd96f7cb2f7e387e7497d6a36af379a2687329571f250c5670f9933244 gencode/python
33ce7ee99051d56dd3c4d69edf92583d0bb7fd751417948b71292ac2285d3c19 gencode/python/udmi/schema/config_pointset_point.py
ba37d2d54df565aba42ef055a0ec961175d180c2e8092a914e62029bc5388857 gencode/python/udmi/schema/config_system.py
97c2e5fadc6da0d84660f3296de885ab59f4b04154179b6717f77ec366f1544b gencode/python/udmi/schema/config_system_testing.py
82297b35fe77ab67c3ef87baf23fdf934e06b566be9eb9737125cef4276be8bf gencode/python/udmi/schema/configuration_endpoint.py
a1f527558554393623eb7f14a0ff6b3ce67e23578e2e716c206c6aa9a29ccee3 gencode/python/udmi/schema/configuration_endpoint.py
e8a1574074554b6144b178d2adedc76a1c7be5ae911b253deff4460d8d82c6ee gencode/python/udmi/schema/configuration_execution.py
7f4f8c1a6ead34bf72b9134b97a39001752eb0f9647fafaac82ced4bb2f46b88 gencode/python/udmi/schema/configuration_pubber.py
998ce105f88686f27b85f3630a396ed04b106f830c133a684ea5c505ca95b1c3 gencode/python/udmi/schema/envelope.py
Expand Down
12 changes: 10 additions & 2 deletions bin/test_mosquitto
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ systemctl status mosquitto
killall mosquitto_sub || true

echo Subscribing to mqtt/test in the background...
mosquitto_sub -t \# -u ${USERNAME} -P ${PASSWORD} | tee out/mosquitto.sub &
mosquitto_sub -F "%t %p" -t \# -u ${USERNAME} -P ${PASSWORD} | tee out/mosquitto.sub &

sleep 1

Expand All @@ -50,6 +50,7 @@ cat <<EOF > /tmp/pubber_config.json
"transport": "tcp",
"client_id": "$registry_id/$device_id",
"hostname": "127.0.0.1",
"topic_prefix": "/$serial_no/$device_id",
"config_sync_sec": -1,
"port": 1883,
"auth_provider": {
Expand All @@ -71,7 +72,14 @@ $ROOT_DIR/pubber/bin/build

timeout 10s $ROOT_DIR/pubber/bin/run /tmp/pubber_config.json || true

received_no=$(fgrep operational out/mosquitto.sub | jq -r .system.serial_no)
received_no=$(fgrep operational out/mosquitto.sub | sed -E 's/^[^{]+//' | jq -r .system.serial_no)
received_topic=$(fgrep operational out/mosquitto.sub | awk '{ print $1 }')

expected_topic=/$serial_no/$device_id/state
if [[ $received_topic != $expected_topic ]]; then
echo Unexpected received topic $received_topic != $expected_topic
false
fi

if [[ $received_no != $serial_no ]]; then
echo Mismatched/missing serial no: $received_no != $serial_no
Expand Down
1 change: 1 addition & 0 deletions bin/test_redirect
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ cat <<EOF > out/endpoint.json
{
"protocol": "mqtt",
"client_id": "projects/$project_id/locations/$cloud_region/registries/reconfigure/devices/$device_id",
"topic_prefix": "/devices/$device_id",
"hostname": "mqtt.googleapis.com",
"auth_provider": {
"jwt": {
Expand Down
34 changes: 34 additions & 0 deletions gencode/docs/configuration_endpoint.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions gencode/docs/configuration_pubber.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions gencode/docs/persistent_device.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion gencode/java/udmi/schema/EndpointConfiguration.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions gencode/python/udmi/schema/configuration_endpoint.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pubber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildscript {

plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.adarshr.test-logger' version '3.2.0'
id 'java'
id 'checkstyle'
}
Expand All @@ -28,6 +29,11 @@ sourceSets {
srcDirs '../common/src/main/java'
}
}
test {
java {
srcDirs '../common/src/test/java'
}
}
}

checkstyle {
Expand Down
Loading