-
Notifications
You must be signed in to change notification settings - Fork 49
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
Sequence doc generator #428
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
92d1049
Automatic sequence doc generator
grafnu 92faed7
Docs cleanup
grafnu 16070c1
Capturing test errors
grafnu ca7f6fd
FIxing up checkThat
grafnu 10cf717
Cleanup imports
grafnu 5469d63
Adding missing file reference checker
grafnu 01f3df5
Cleaning up comment
grafnu 687253c
Updating link path
grafnu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash -e | ||
|
||
ROOT_DIR=$(realpath $(dirname $0)/..) | ||
cd $ROOT_DIR | ||
|
||
SEQUENCE_MD=docs/specs/sequences/generated.md | ||
|
||
# Create doc of generated sequence steps | ||
prefix=sites/udmi_site_model/out/devices/AHU-1/tests | ||
if [[ -d $prefix ]]; then | ||
echo Updating $SEQUENCE_MD from $prefix: | ||
|
||
# Clear out existing generated sequences | ||
sed -i '/<!-- START GENERATED,/q' $SEQUENCE_MD | ||
|
||
sequences=$(cd $prefix; find . -name sequence.md | sort) | ||
|
||
# Generate table of contents | ||
for sequence in $sequences; do | ||
directory=${sequence%/sequence.md} | ||
name=${directory##.*/} | ||
header=$(fgrep \#\# $prefix/$sequence) || true | ||
if [[ -z $header ]]; then | ||
echo " $name: Invalid or missing header." | ||
continue | ||
fi | ||
description=": $(sed -n -n '/^1\./q;p' $prefix/$sequence | fgrep -v \#\# | xargs echo)" | ||
echo "* [${name}](#${name})${description%: }" >> $SEQUENCE_MD | ||
done | ||
|
||
# Add in specific test sequences | ||
for sequence in $sequences; do | ||
directory=${sequence%/sequence.md} | ||
name=${directory##.*/} | ||
header=$(fgrep \#\# $prefix/$sequence) || true | ||
if [[ -z $header ]]; then | ||
continue | ||
fi | ||
echo " $name" | ||
cat $prefix/$sequence >> $SEQUENCE_MD | ||
done | ||
else | ||
echo $prefix not found, skipping sequence generation. | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
[**UDMI**](../../../) / [**Docs**](../../) / [**Specs**](../) / [**Sequences**](./) / [Generated](#) | ||
|
||
# Generated sequences | ||
|
||
These are the exact sequences being checked by the sequence tool. They are programaticaly generated | ||
so maybe a bit cryptic, but they accurately represent the specific steps required for each test. | ||
|
||
<!-- To regenerate the contents of this file below, use bin/test_sequencer and bin/gencode_seq --> | ||
|
||
<!-- START GENERATED, do not edit anything after this line! --> | ||
* [broken_config](#broken_config): Check that the device correctly handles a broken (non-json) config message. | ||
* [device_config_acked](#device_config_acked): Check that the device MQTT-acknowledges a sent config. | ||
* [extra_config](#extra_config): Check that the device correctly handles an extra out-of-schema field | ||
* [periodic_scan](#periodic_scan) | ||
* [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. | ||
* [system_min_loglevel](#system_min_loglevel): Check that the min log-level config is honored by the device. | ||
* [valid_serial_no](#valid_serial_no) | ||
* [writeback_states](#writeback_states) | ||
|
||
## broken_config | ||
|
||
Check that the device correctly handles a broken (non-json) config message. | ||
|
||
1. Update config: | ||
* Set `system.min_loglevel` = `100` | ||
1. Wait for no interesting status | ||
1. Wait for clean config/state synced | ||
1. Wait for state synchronized | ||
1. Check that initial stable_config matches last_config | ||
1. Wait for log category `system.config.receive` level `DEBUG` | ||
1. Wait for has interesting status | ||
1. Wait for log category `system.config.parse` level `ERROR` | ||
1. Check has not logged category `system.config.apply` level `NOTICE` (**incomplete!**) | ||
1. Force reset config | ||
1. Wait for log category `system.config.receive` level `DEBUG` | ||
1. Wait for no interesting status | ||
1. Wait for last_config updated | ||
1. Wait for log category `system.config.apply` level `NOTICE` | ||
1. Wait for log category `system.config.parse` level `DEBUG` | ||
|
||
## device_config_acked | ||
|
||
Check that the device MQTT-acknowledges a sent config. | ||
|
||
1. Wait for config acked | ||
|
||
## extra_config | ||
|
||
Check that the device correctly handles an extra out-of-schema field | ||
|
||
1. Update config: | ||
* Set `system.min_loglevel` = `100` | ||
1. Wait for last_config not null | ||
1. Wait for system operational | ||
1. Wait for no interesting status | ||
1. Wait for log category `system.config.receive` level `DEBUG` | ||
1. Wait for last_config updated | ||
1. Wait for system operational | ||
1. Wait for no interesting status | ||
1. Wait for log category `system.config.parse` level `DEBUG` | ||
1. Wait for log category `system.config.apply` level `NOTICE` | ||
1. Wait for log category `system.config.receive` level `DEBUG` | ||
1. Wait for last_config updated again | ||
1. Wait for system operational | ||
1. Wait for no interesting status | ||
1. Wait for log category `system.config.parse` level `DEBUG` | ||
1. Wait for log category `system.config.apply` level `NOTICE` | ||
|
||
## periodic_scan | ||
|
||
1. Update config: | ||
* Add `discovery` = { "families": { } } | ||
1. Wait for all scans not active | ||
1. Wait for scan iterations | ||
|
||
## self_enumeration | ||
|
||
1. Wait for enumeration not active | ||
1. Update config to discovery generation: | ||
* Add `discovery` = { "enumeration": { "generation": _generation start time_ } } | ||
1. Wait for enumeration generation | ||
1. Wait for enumeration still not active | ||
|
||
## single_scan | ||
|
||
1. Update config: | ||
* Add `discovery` = { "families": { } } | ||
1. Wait for all scans not active | ||
1. Wait for scheduled scan start | ||
1. Wait for scan activation | ||
1. Wait for scan completed | ||
|
||
## system_last_update | ||
|
||
Check that last_update state is correctly set in response to a config update. | ||
|
||
1. Wait for state last_config matches config timestamp | ||
|
||
## system_min_loglevel | ||
|
||
Check that the min log-level config is honored by the device. | ||
|
||
1. Check has not logged category `system.config.apply` level `NOTICE` (**incomplete!**) | ||
1. Update config: | ||
* Set `system.min_loglevel` = `400` | ||
1. Update config: | ||
* Set `system.min_loglevel` = `200` | ||
1. Wait for log category `system.config.apply` level `NOTICE` | ||
|
||
## valid_serial_no | ||
|
||
1. Check that received serial no matches | ||
|
||
## writeback_states | ||
|
||
1. Test failed: Missing 'invalid' target specification |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[**UDMI**](../../) / [**Docs**](../) / [**Tools**](./) / [Registrar](#) | ||
|
||
Various notes and tips and tricks for working with GCP. These are more or less hints as to what can be done, but don't expect | ||
them to work out-of-the-box without a deeper understanding of what's going on! | ||
|
||
# Viewing subscription | ||
|
||
`bin/pull_message:gcloud --format=json --project=$project_id pubsub subscriptions pull $subscription --auto-ack` | ||
|
||
# View cloud function logs | ||
|
||
`gcloud --project=$project_id functions logs read udmi_config --sort-by=time_utc --limit=1000` | ||
|
||
# Update a device's GCP IoT Core configuration | ||
|
||
`bin/reset_config` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registrar
->Gcloud