Skip to content

Commit

Permalink
sample rate test
Browse files Browse the repository at this point in the history
  • Loading branch information
noursaidi committed Dec 1, 2022
1 parent 021d95c commit 6df978b
Show file tree
Hide file tree
Showing 59 changed files with 2,779 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .gencode_hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ b6e43c6d82e0a0e526001b87baf1ad8f1a90305a6abcc385dc52de8b4d3cba84 gencode/docs/c
519e6d677fe96768864b3f1f4542a976f5dae48db49b3adb453e296f926aa555 gencode/docs/config_mapping.html
e6b9cc7798e71237416b092801356f51c5178f3aac35811a8cee8a0045ad96d8 gencode/docs/configuration_endpoint.html
b7ca70e3176f997f254c32bd8d53dff1462ac8a71c0e166aaa85193d67bff60b gencode/docs/configuration_execution.html
d7fa593d3ec205465b220b72a6358a870bd52d6e61bd1426c9e5fb54cbbbdd56 gencode/docs/configuration_pubber.html
e7b3b43300f850218c1bfefd3497c0e65fab1355075e1155d2d48de072042723 gencode/docs/configuration_pubber.html
0f0355e343cb8197dfbae1481c0eca3a0566d73181bc968e33fd469a1c94d1e6 gencode/docs/envelope.html
1609fa7bac810500cfad0989ef525578327818a3602b42c9048219cbdf79841a gencode/docs/event.html
317b5dede5d98c78ee020722b493e23390d71c3d0d44695893f28e6d26ad2745 gencode/docs/event_discovery.html
Expand Down Expand Up @@ -83,7 +83,7 @@ fc3a9415c04d8a06954dbdbfdff5d68ab113cce3948532c19df555778ffb04fa gencode/java/u
ca2e7566106818ca7e5190c8041eb86f0c9b3251b0bda8c3ea7ce11a0c891a0a gencode/java/udmi/schema/Position.java
3df66bb1a37a9e0b2b6cf392f8c64d404a73c83e5e13c02bb4844f09b9a04b70 gencode/java/udmi/schema/Properties.java
783320700f7e96cf8e421461f14999afca10cd540ca6aadf184add39f0ac048c gencode/java/udmi/schema/PubberConfiguration.java
997acde04cef70d3f6d009a21f3ce4f3d06e6c3093736c03fdc82d78ffea1aa8 gencode/java/udmi/schema/PubberOptions.java
839d78a89be33e25e10c40380d73bf2c23ce2ba3ab82d72b0031a509de35cf90 gencode/java/udmi/schema/PubberOptions.java
7bc53cb9a61df8f804a75aa4860403d19281f7c665cbddd5364a2aa746a1f651 gencode/java/udmi/schema/ReflectorConfig.java
abe99dd74122c186403baa6982300a9d5968f8bbb7a67b1689104111b98f32fb gencode/java/udmi/schema/ReflectorState.java
5a44075bc03f2b9b2cc090f007fd1692832871f0981dcb02579d8dda96a96206 gencode/java/udmi/schema/SetupReflectorConfig.java
Expand Down Expand Up @@ -149,7 +149,7 @@ ee9c02c35438fb7d9aacb15a21ec7b35b533c1000d0bde044ec3923b1fdccca4 gencode/python
15b349141ebae651c6c3c5c313b197d49c8b2b44e8ff1b0639848ad42e5c4e63 gencode/python/udmi/schema/model_system_hardware.py
aafe6e70c281152db958adf77a024e3e9fab8293927106297c5ec48c11f54e27 gencode/python/udmi/schema/model_testing.py
5c50847e136a033ea511209238bb570499b43fbee6189dae06603132dcb9f01f gencode/python/udmi/schema/model_testing_target.py
e8e694e260bb70998d228e14516b2fedb7e9d82e68f5586a7e78d0573bd2de8b gencode/python/udmi/schema/options_pubber.py
15f421a67f0d985225aa5e0565851bcf0ae58bed02fc7342b04aba7242920ff6 gencode/python/udmi/schema/options_pubber.py
6c5f3dd1c5ca9d821e3c48298af118fc7eafd97af9265dfd34b2ed8642efca77 gencode/python/udmi/schema/persistent_device.py
a58f8c98e837a5b56126ca0f410e02f1e9cfcd80a8cb429e0ef522defab1f690 gencode/python/udmi/schema/properties.py
1f521678016ad267ad1c817896c7900ba30a85fc694669577b71148193db32c1 gencode/python/udmi/schema/reflect_config.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
name: Integration Tests
runs-on: ubuntu-latest
needs: redirect # Access to UDMI-REFLECTOR is mutually exclusive
timeout-minutes: 30
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
Expand Down
9 changes: 7 additions & 2 deletions bin/test_itemized
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ GOLDEN_FILE=etc/test_itemized.out
rm -f $RESULTS_OUT $SEQUENCER_OUT $PUBBER_OUT
touch $RESULTS_OUT $SEQUENCER_OUT $PUBBER_OUT

#pubber/bin/build
#validator/bin/build

bin/reset_config $SITE_PATH $PROJECT_ID $DEVICE_ID

while read -u 7 action test_name remainder; do
if [[ $action != TEST ]]; then
continue;
Expand All @@ -25,7 +30,7 @@ while read -u 7 action test_name remainder; do

serial_no=sequencer-$RANDOM
bin/pubber $SITE_PATH $PROJECT_ID $DEVICE_ID $serial_no $pubber_opts > $PUBBER_OUT 2>&1 &
WAITING=60
WAITING=20
for i in `seq 1 $WAITING`; do
if [[ -n $(fgrep "Connection complete" $PUBBER_OUT) ]]; then
break
Expand All @@ -39,7 +44,7 @@ while read -u 7 action test_name remainder; do
false
fi

bin/sequencer $SITE_PATH $PROJECT_ID $DEVICE_ID $serial_no $test_name 2>&1 | tee $SEQUENCER_OUT
bin/sequencer -v $SITE_PATH $PROJECT_ID $DEVICE_ID $serial_no $test_name 2>&1 | tee $SEQUENCER_OUT

kill $(ps ax | fgrep pubber | fgrep java | awk '{print $1}')

Expand Down
28 changes: 28 additions & 0 deletions docs/specs/sequences/generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Some caveats:
* [endpoint_config_connection_success_reconnect](#endpoint_config_connection_success_reconnect): Push endpoint config message to device that results in successful reconnect to the same endpoint.
* [extra_config](#extra_config): Check that the device correctly handles an extra out-of-schema field
* [periodic_scan](#periodic_scan)
* [pointset_publish_interval](#pointset_publish_interval): test sample rate and sample limit sec
* [pointset_sample_rate](#pointset_sample_rate): device publishes pointset events at a rate of no more than config sample_rate_sec
* [self_enumeration](#self_enumeration)
* [single_scan](#single_scan)
* [system_last_update](#system_last_update): Check that last_update state is correctly set in response to a config update.
Expand Down Expand Up @@ -119,6 +121,32 @@ Check that the device correctly handles an extra out-of-schema field
* Add `discovery.families.virtual` = { "generation": _family generation_, "scan_interval_sec": `10`, "enumerate": `true` }
1. Wait for scan iterations

## pointset_publish_interval

test sample rate and sample limit sec

1. Update config before receive at least 3 pointset events:
* Add `pointset.sample_rate_sec` = `8`
* Add `pointset.sample_limit_sec` = `5`
1. Wait for receive at least 3 pointset events
1. Check that time period between successive pointset events is between 5 and 8 seconds
1. Update config before receive at least 3 pointset events:
* Set `pointset.sample_rate_sec` = `15`
* Set `pointset.sample_limit_sec` = `12`
1. Wait for receive at least 3 pointset events
1. Check that time period between successive pointset events is between 12 and 15 seconds

## pointset_sample_rate

device publishes pointset events at a rate of no more than config sample_rate_sec

1. Wait for measure initial sample rate
1. Update config before receive at least 5 pointset events:
* Add `pointset.sample_rate_sec` = `5`
* Add `pointset.sample_limit_sec` = `1`
1. Wait for receive at least 5 pointset events
1. Check that time period between successive pointset events is between 1 and 5 seconds

## self_enumeration

1. Wait for enumeration not active
Expand Down
2 changes: 2 additions & 0 deletions etc/sequencer.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ RESULT pass endpoint_config_connection_error Sequence complete
RESULT pass endpoint_config_connection_success_reconnect Sequence complete
RESULT pass extra_config Sequence complete
RESULT pass periodic_scan Sequence complete
RESULT pass pointset_publish_interval Sequence complete
RESULT pass pointset_sample_rate Sequence complete
RESULT pass self_enumeration Sequence complete
RESULT pass single_scan Sequence complete
RESULT pass system_last_update Sequence complete
Expand Down
1 change: 1 addition & 0 deletions etc/test_itemized.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TEST writeback_success_state noWriteback RESULT fail writeback_success_state timeout waiting for point filter_differential_pressure_setpoint to have value_state applied
TEST writeback_success_apply noPointState RESULT pass writeback_success_apply Sequence complete
TEST pointset_sample_rate fixedSampleRate=10 RESULT fail pointset_sample_rate Failed check that time period between successive pointset events is between 1 and 5 seconds
40 changes: 40 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.

6 changes: 5 additions & 1 deletion gencode/java/udmi/schema/PubberOptions.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/options_pubber.py

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

12 changes: 7 additions & 5 deletions pubber/src/main/java/daq/pubber/Pubber.java
Original file line number Diff line number Diff line change
Expand Up @@ -863,16 +863,16 @@ private void processConfigUpdate(Config config) {
deviceConfig = config;
info(String.format("%s received config %s", getTimestamp(), isoConvert(config.timestamp)));
deviceState.system.last_config = config.timestamp;
actualInterval = updateSystemConfig(config.pointset);
updatePointsetConfig(config.pointset);
actualInterval = updatePointsetConfig(config.pointset);
updatePointsetPointsConfig(config.pointset);
updateDiscoveryConfig(config.discovery);
extractEndpointBlobConfig();
} else {
info(getTimestamp() + " defaulting empty config");
actualInterval = DEFAULT_REPORT_SEC * 1000;
}
if (configuration.options.fixedSampleRate != null) {
actualInterval = configuration.options.fixedSampleRate;
actualInterval = configuration.options.fixedSampleRate * 1000;
}
maybeRestartExecutor(actualInterval);
}
Expand Down Expand Up @@ -1269,7 +1269,7 @@ private String isoConvert(Date timestamp) {
}
}

private void updatePointsetConfig(PointsetConfig pointsetConfig) {
private void updatePointsetPointsConfig(PointsetConfig pointsetConfig) {
PointsetConfig useConfig = pointsetConfig != null ? pointsetConfig : new PointsetConfig();
Map<String, PointPointsetConfig> points =
useConfig.points != null ? useConfig.points : new HashMap<>();
Expand All @@ -1286,9 +1286,11 @@ private void updatePointConfig(AbstractPoint point, PointPointsetConfig pointCon
updateState(point);
}

private int updateSystemConfig(PointsetConfig pointsetConfig) {
private int updatePointsetConfig(PointsetConfig pointsetConfig) {
final int actualInterval;
boolean hasSampleRate = pointsetConfig != null && pointsetConfig.sample_rate_sec != null;
boolean hasSampleLimit = pointsetConfig != null && pointsetConfig.sample_limit_sec != null;
//if(hasSampleRate && hasSampleLimit && pointsetConfig.sample_rate_sec < )
int reportInterval = hasSampleRate ? pointsetConfig.sample_rate_sec : DEFAULT_REPORT_SEC;
actualInterval = Integer.max(MIN_REPORT_MS, reportInterval * 1000);
return actualInterval;
Expand Down
10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_pointset.attr

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

17 changes: 17 additions & 0 deletions validator/sequences/pointset_publish_interval/config_pointset.json

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

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_system.attr

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

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_system.json

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

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_update.attr

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

27 changes: 27 additions & 0 deletions validator/sequences/pointset_publish_interval/config_update.json

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

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/event_pointset.attr

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

15 changes: 15 additions & 0 deletions validator/sequences/pointset_publish_interval/event_pointset.json

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

Loading

0 comments on commit 6df978b

Please sign in to comment.