Skip to content

Commit a4b8bb6

Browse files
authored
Endpoint Configuration Schema Update (#423)
1 parent ad5bbd7 commit a4b8bb6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+647
-254
lines changed

.gencode_hash.txt

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
bf79c2371745ef800d3434c9dd4155a9a4f10a3c5dd1b07246cbb0c641fd06bb gencode/docs/config.html
1+
026b146c355ab6d2a6767e25d8a5c382f49c22f05289abd5eb6b6ca941e1ac47 gencode/docs/config.html
22
90679d3d866579501e7aa00b515af05d42fc9fe399eafacaacf297d1e4a22884 gencode/docs/envelope.html
3-
9362682fa830ce9d98b3c074cab05ba44fae96a82de316a3520df3956e9325dc gencode/docs/event_discovery.html
3+
80bbcb648a4ebe8f1b5dbb363e1654dd6db0cec2d67ac2c642f2bddc69d5a6ff gencode/docs/event_discovery.html
44
8133e380e40f27c56accbffc665b2eeb56ec84a4da3b52ba7aa5e439c9c40572 gencode/docs/event_pointset.html
5-
06a8831025ad3cba59ed1831842db537525c26a713de92f6dd6c48656e3d772d gencode/docs/event_system.html
6-
a471b2ded89ceb93dd4c70e9702db179fdd517fd45bfd2b43a95f8b9f287b50b gencode/docs/event_validation.html
5+
cd7622cc8f952aa5aa8b243ef266f1a7d6a311886913f884ffd80cfbcd97daa7 gencode/docs/event_system.html
6+
77f401d6ad8958cd299072b42d3714f3b71512680e4f948d197795da9c2baa44 gencode/docs/event_validation.html
77
f48026471ae3cd7867bce416dc21c2fb728f48d8476a8d6e95f6acaf1d8b6cf3 gencode/docs/index.html
88
6d5081d04c86f8bd444efb41cd788826aa66802d37e8f98e93b6b75425542d5e gencode/docs/metadata.html
99
741b880216be3743f6747800a042f2dbd89f3b0344c6b0a965f4bc010f03a930 gencode/docs/schema_doc.css
1010
878ea88206c974f40643c3cc430875f9c4e8c5e3fd6bcd6358bd3eb6d48699a9 gencode/docs/schema_doc.min.js
1111
7ed934930aee763e0beebc349725ba3909115e8d346bb762f28bcbe745bb163a gencode/docs/schema_extras.js
12-
ffe0596792d14a35c395f84d5ee1ec76032fd29e0dd9c440984db8f8a5f1be1d gencode/docs/state.html
12+
46a606b867b60c1c7249612283be534ea31c95c11b04532f880bf600668124c6 gencode/docs/state.html
1313
d39d7fe37a41c74a40080af7b0a429d201ab1fdff7444428c4b98eb7b38c332b gencode/java/udmi/schema/Asset.java
1414
0825a5cec83003bb0a6488c4ed7010a04ae0d3848ef36fe01bb4e6718ba7b96d gencode/java/udmi/schema/Aux.java
15-
d326a550d75ab7f558f165f1a5e8c24eee2b0b52290a7472f529bb1e15d79fb2 gencode/java/udmi/schema/BlobBlobsetConfig.java
16-
2c03651cb2ecda072b1418222eebb5560185669f8ffdd03021ad5ad8ff7ba3b0 gencode/java/udmi/schema/BlobBlobsetState.java
15+
902704240cee3e70c0549aed1608ba8f3c2626f719483ac06631c3811d1e0330 gencode/java/udmi/schema/BlobBlobsetConfig.java
16+
a7c57d119adcd0cf6363cc5301ce562004222522242e8ffd1d0cd7010f235ae1 gencode/java/udmi/schema/BlobBlobsetState.java
1717
b9f903444ab08907e41eb123286434ff3207b1edd01397af3ddefb8475bbdadc gencode/java/udmi/schema/BlobsetConfig.java
1818
fcbed49f1af8b791d8c52bcbe18f65521a79d9ac3eb33ec3afd9b342ab2bfc56 gencode/java/udmi/schema/BlobsetState.java
19-
0c908ea34ee54aa66f9ce472ad23ecaec3c091f2afbba7b509e1515b5557f82c gencode/java/udmi/schema/Category.java
19+
2f7cf83f8f46080c011eb4bebcb3b4a2125303f52d91def194a6818cdb944198 gencode/java/udmi/schema/Category.java
2020
d6875f63ce67d1b945a0b75a4a660bd083cc52492371a7350c4109f6bf54968b gencode/java/udmi/schema/CloudIotConfig.java
2121
a2eeff86f4302272736d84602e2ca36a64d27c8ef6761cc05ffb8ad17b030d4d gencode/java/udmi/schema/CloudModel.java
2222
ff79de9390aa25bb45fb3e2ebb682c865ccab764f56d9644377d9d28c0ab10e4 gencode/java/udmi/schema/Config.java
@@ -26,7 +26,7 @@ d8a80ab3180d33bfa17564c969018e1d4350a47dbc70c4ae8a5abbfb25cfedc9 gencode/java/u
2626
4793b2370b1f3b8fd89941586b779dffdde83d321a2621907f67d4d297d19b17 gencode/java/udmi/schema/DiscoveryEvent.java
2727
04112dd47b0f761131c276c67d3cd8b789d25e6716b5732be9fef14fc6831f1d gencode/java/udmi/schema/DiscoveryModel.java
2828
9962b0eb7d5adf52af6160e9f3131f8eeb52ae9e518954dbb6aead1bcad0245e gencode/java/udmi/schema/DiscoveryState.java
29-
4e64cf10484266a297fb418b165dd84a9f4b8c2e53520b33915cc96365151fc2 gencode/java/udmi/schema/EndpointConfiguration.java
29+
f9faaa8622aa289c878cf2b9bcc05ac0c90ec5b40b39a607f5b7981fac0086fc gencode/java/udmi/schema/EndpointConfiguration.java
3030
885859ea9de29217186c34f3a90b112411d1beddaf58a88b85e7934cd3c92b6f gencode/java/udmi/schema/Entry.java
3131
cd362f94454eba8fd5ce3fce5d5e2b5f046d0dd9c35b01de69ef4d2e38413cc5 gencode/java/udmi/schema/Envelope.java
3232
e9f5c77be81486b6b8c6d88f70f2d50583d8c3fafa2ac09ead80f44b8d5e751e gencode/java/udmi/schema/Event.java
@@ -75,12 +75,12 @@ d3968b92497e83a63f18cc0e74484a9807f1bb92db0c92d556ec2caaa143d645 gencode/java/u
7575
8a7dd590b84944de25392b1437184608edd2f8305a183eced8b1b40eae27c6d2 gencode/java/udmi/schema/TestingSystemConfig.java
7676
347da3d586ff6e5dcf3ce8ec0c800ec0efd5fed4e0c80eef35de65ad92ae48bf gencode/java/udmi/schema/ValidationEvent.java
7777
e007ddd1ceeae3603c85110c33e1bb4a418ff9c7a791ca0df25b7ea3caeafd36 gencode/java/udmi/schema/ValidationSummary.java
78-
7b1c07e966ca1b74f6465f9313e64391fe64a2935337c7293e901e2d6e5863b4 gencode/python/udmi/schema/__init__.py
78+
1da7c14bbcbb4bd957259de271ed9585af915b3cebc4d3cf84b52a8f1b55d2a7 gencode/python/udmi/schema/__init__.py
7979
4b25dd95f863059b761269f93adcae7049507924a1c6e74d6856849203c179db gencode/python/udmi/schema/ancillary_properties.py
80-
70f9b662321b8acded5943749539fb9376f1247e986918ea2cfac65e3d307953 gencode/python/udmi/schema/category.py
80+
30962f693f0065565f8f6610db934aa8ade58b7c9c978b6e0921d86336e3e1f2 gencode/python/udmi/schema/category.py
8181
a61b1c5732f01b7efda41a773d5786fad755f371193ce4478b458387ca2a8fe8 gencode/python/udmi/schema/cloud_iot_config.py
8282
6578d68f65b87b781086e72566de910db4bef365599fe3188862d4d8a81e84fb gencode/python/udmi/schema/command_discovery.py
83-
2082a9f3ff4d37bb13a647932fcacb99499f71569cd9dc12d5e63dead34fee63 gencode/python/udmi/schema/common.py
83+
c5a62f92328e2ede167fc1f53bece6e48696a0ab0e37e3a41f65cd98494ba0d7 gencode/python/udmi/schema/common.py
8484
b975892df78076dabc797b4c0be87f20b33eacda11f9d1ac1c09be33d4937a87 gencode/python/udmi/schema/config.py
8585
79eb0299b3751d93c01a5de65eacc717283e99caf0996f3db48a15247f69c8eb gencode/python/udmi/schema/config_blobset.py
8686
95125e3459cec6e12f4e0d3912f9c519b1aec41cf1df9720b54481e69632d7f4 gencode/python/udmi/schema/config_blobset_blob.py
@@ -92,6 +92,8 @@ b461bdc24310ef972faf579b5be577b5af67fb0977d6afb4c42955211b26e3d5 gencode/python
9292
607c5047df878a1333df3ce88dcce34668959b0b315f6954bf1a4963dcf7839e gencode/python/udmi/schema/config_pointset_point.py
9393
2a016b8d45868db8a146a6b84badc13c0668b94d55ab2647630645e71c4e4419 gencode/python/udmi/schema/config_system.py
9494
97c2e5fadc6da0d84660f3296de885ab59f4b04154179b6717f77ec366f1544b gencode/python/udmi/schema/config_system_testing.py
95+
5781474ae451777f65dbb13eb0a4707845551da9cfde8bf214f192e7849cd2ed gencode/python/udmi/schema/configuration_endpoint.py
96+
3814c88403934dbd3fce77d92a8ad45c68dc7e07c319ba9b4e8f1b1ac7518c07 gencode/python/udmi/schema/configuration_pubber.py
9597
998ce105f88686f27b85f3630a396ed04b106f830c133a684ea5c505ca95b1c3 gencode/python/udmi/schema/envelope.py
9698
1eb9019b9d0b4ff7de2df8beb625a4f89292d636ece0c02f160495c537bd6c2c gencode/python/udmi/schema/event.py
9799
82182e3f569ad80dc0751027959c7db9135d10072fbe79f896d63a4cd2f4771f gencode/python/udmi/schema/event_discovery.py
@@ -115,14 +117,13 @@ abe431dc7702c80992b2c9736ab924d80d1033493036976f0cefa8c2108227be gencode/python
115117
3e34bfb5279c51a0a048d723ed0d91ebf82a614c22873c6425e058d55ac58df3 gencode/python/udmi/schema/model_system.py
116118
aafe6e70c281152db958adf77a024e3e9fab8293927106297c5ec48c11f54e27 gencode/python/udmi/schema/model_testing.py
117119
5c50847e136a033ea511209238bb570499b43fbee6189dae06603132dcb9f01f gencode/python/udmi/schema/model_testing_target.py
120+
a10a7e593d8747ea46c56da2c24c7b0501c10b190c5b66119cab8e71d2bdc0e6 gencode/python/udmi/schema/options_pubber.py
118121
a58f8c98e837a5b56126ca0f410e02f1e9cfcd80a8cb429e0ef522defab1f690 gencode/python/udmi/schema/properties.py
119-
1b2dba2ff079366560c7106aecc5289db19312816fa34a86459e429c94972761 gencode/python/udmi/schema/pubber_configuration.py
120-
0c895896f4bad5b50a9332706adb0f751618c37a125dbe6780ff92bd729923d7 gencode/python/udmi/schema/pubber_options.py
121122
1f521678016ad267ad1c817896c7900ba30a85fc694669577b71148193db32c1 gencode/python/udmi/schema/reflect_config.py
122123
1a4eef286957d77418777eb7f4cd1ee13aa24c2d916ec71a7ff4e56de76e303e gencode/python/udmi/schema/reflect_state.py
123124
32bc70a30e37e89cfae14b44add18d546a6f9e00a3ec3519ede9c7486114d39c gencode/python/udmi/schema/state.py
124125
4a908cee3fb8afb559bcbfa594e57dbc515a35e4468e02600751b2fcce05a238 gencode/python/udmi/schema/state_blobset.py
125-
16a3541464d48b0cda007668cbc9c00911b94d044fe69a23773df2648359723f gencode/python/udmi/schema/state_blobset_blob.py
126+
9af10658979ec986fa002df129324b2f8bdcda1957b8bacdb8d5ec1cf773bd66 gencode/python/udmi/schema/state_blobset_blob.py
126127
26443a1f6d0be3469ff93aa7fdb4e6682e0439a3b29a8e237998dcebec5f6901 gencode/python/udmi/schema/state_discovery.py
127128
187400078dfc89912062ca1ad92f61e32d28126ae56119d83e6767d58cda1117 gencode/python/udmi/schema/state_discovery_family.py
128129
05e82aa15c64842e206ae8ce3d5810d115bb890d009ea5d657822fad0e0d2165 gencode/python/udmi/schema/state_gateway.py

bin/gencode_java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cp -n $ROOT_DIR/etc/*.java $OUTDIR/udmi/schema/
3838

3939
echo Cleaning up __ classes...
4040
find $OUTDIR -name \*__\*.java | xargs rm
41+
fgrep -l __ -r $OUTDIR | xargs -n 1 sed -E -i s/__[0-9]+//
4142

4243
cd $ROOT_DIR
4344
find gencode/java -type f | sort

bin/pubber

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ else
4242
done
4343
options_json="{${options_json%,}}"
4444

45+
registry_id=`jq -r .registry_id $site_path/cloud_iot_config.json`
4546
cloud_region=`jq -r .cloud_region $site_path/cloud_iot_config.json`
4647

4748
cat <<EOF > /tmp/pubber_config.json
4849
{
4950
"endpoint": {
50-
"projectId": "$project_id",
51-
"cloudRegion": "$cloud_region"
51+
"protocol": "mqtt",
52+
"client_id": "projects/$project_id/locations/$cloud_region/registries/$registry_id/devices/$device_id",
53+
"hostname": "mqtt.googleapis.com"
5254
},
5355
"sitePath": "$site_path",
5456
"deviceId": "$device_id",

bin/test_redirect

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ sleep 20
4747

4848
cat <<EOF > out/endpoint.json
4949
{
50-
"projectId": "$project_id",
51-
"registryId": "reconfigure",
52-
"cloudRegion": "$cloud_region"
50+
"protocol": "mqtt",
51+
"client_id": "projects/$project_id/locations/$cloud_region/registries/reconfigure/devices/$device_id",
52+
"hostname": "mqtt.googleapis.com"
5353
}
5454
EOF
5555

common/src/main/java/com/google/udmi/util/SiteModel.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.databind.SerializationFeature;
88
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
99
import com.google.common.base.Preconditions;
10+
import daq.pubber.MqttPublisher;
1011
import java.io.File;
1112
import java.util.Arrays;
1213
import java.util.Map;
@@ -27,6 +28,7 @@ public class SiteModel {
2728
.enable(SerializationFeature.INDENT_OUTPUT)
2829
.setDateFormat(new ISO8601DateFormat())
2930
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
31+
private static final String DEFAULT_ENDPOINT_HOSTNAME = "mqtt.googleapis.com";
3032

3133
final String sitePath;
3234
private Map<String, Metadata> allMetadata;
@@ -36,10 +38,12 @@ public SiteModel(String sitePath) {
3638
this.sitePath = sitePath;
3739
}
3840

39-
public static EndpointConfiguration extractEndpointConfig(CloudIotConfig cloudIotConfig) {
41+
public static EndpointConfiguration extractEndpointConfig(String projectId,
42+
CloudIotConfig cloudIotConfig, String deviceId) {
4043
EndpointConfiguration endpoint = new EndpointConfiguration();
41-
endpoint.registryId = cloudIotConfig.registry_id;
42-
endpoint.cloudRegion = cloudIotConfig.cloud_region;
44+
endpoint.client_id = MqttPublisher.getClientId(projectId,
45+
cloudIotConfig.cloud_region, cloudIotConfig.registry_id, deviceId);
46+
endpoint.hostname = DEFAULT_ENDPOINT_HOSTNAME;
4347
return endpoint;
4448
}
4549

@@ -54,7 +58,7 @@ private static CloudIotConfig makeCloudIotConfig(Envelope attributes) {
5458

5559
public static EndpointConfiguration makeEndpointConfig(Envelope attributes) {
5660
CloudIotConfig cloudIotConfig = makeCloudIotConfig(attributes);
57-
return extractEndpointConfig(cloudIotConfig);
61+
return extractEndpointConfig(attributes.projectId, cloudIotConfig, attributes.deviceId);
5862
}
5963

6064
private Set<String> getAllDevices() {
@@ -89,14 +93,13 @@ public void forEachDevice(BiConsumer<String, Metadata> consumer) {
8993
allMetadata.forEach(consumer);
9094
}
9195

92-
private void loadEndpointConfig(String projectId) {
96+
private void loadEndpointConfig(String projectId, String deviceId) {
9397
Preconditions.checkState(sitePath != null,
9498
"sitePath not defined in configuration");
9599
File cloudConfig = new File(new File(sitePath), "cloud_iot_config.json");
96100
try {
97-
endpointConfig = extractEndpointConfig(
98-
OBJECT_MAPPER.readValue(cloudConfig, CloudIotConfig.class));
99-
endpointConfig.projectId = projectId;
101+
endpointConfig = extractEndpointConfig(projectId,
102+
OBJECT_MAPPER.readValue(cloudConfig, CloudIotConfig.class), deviceId);
100103
} catch (Exception e) {
101104
throw new RuntimeException("While reading config file " + cloudConfig.getAbsolutePath(), e);
102105
}
@@ -106,8 +109,8 @@ public EndpointConfiguration getEndpointConfig() {
106109
return endpointConfig;
107110
}
108111

109-
public void initialize(String projectId) {
110-
loadEndpointConfig(projectId);
112+
public void initialize(String projectId, String deviceId) {
113+
loadEndpointConfig(projectId, deviceId);
111114
loadAllDeviceMetadata();
112115
}
113116

docs/specs/categories.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ implicit expected `level` values, indicated by '(**LEVEL**)' in the hierarchy be
1919
* _parse_: (**DEBUG**) Parsing a received message
2020
* _apply_: (**NOTICE**) Application of a parsed config message
2121
* _network_: Network (IP) message handling
22-
* _connect_: (**NOTICE**) Connected to the network
22+
* _connection_: (**NOTICE**) Connected to the network
2323
* _disconnect_: (**NOTICE**) Disconnected from a network
2424
* _auth_: Authentication to local application (e.g. web server, SSH)
2525
* _login_: (**NOTICE**) Successful login. The entry message should include the username and application
@@ -41,6 +41,6 @@ implicit expected `level` values, indicated by '(**LEVEL**)' in the hierarchy be
4141
* _describe_: (**INFO**) Relating to describing a particular point
4242
* _blobset_: Handling update of device data blobs
4343
* _blob_: Conditions specific to an individual blob
44-
* _received_: (**DEBUG**) Request for an update has been received
45-
* _fetched_: (**DEBUG**) Update blob has been successfully fetched
46-
* _applied_: (**NOTICE**) Update has been successfully applied
44+
* _receive_: (**DEBUG**) About receiving a blob update
45+
* _fetch_: (**DEBUG**) Fetching a blob update
46+
* _apply_: (**NOTICE**) Applying a blob update

gencode/docs/config.html

Lines changed: 9 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)