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

Add transmission settings set flags generation #6640

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

adriansmares
Copy link
Contributor

@adriansmares adriansmares commented Oct 19, 2023

Summary

This PR adds set flags generation to a number of API messages, in order to allow the simulate application-uplink to work.

Historically our TxSettings message was not nullable, so it was not possible for the required validation to fail, and also we did not validate the frequency (now we do). This allowed the simulate application-uplink to work in a very simple manner by skipping the transmission settings completely.

After the gogoproto removal and the new validation changes, the command is not really usable because it is not possible to set the transmission settings. This PR fixes that.

Changes

  • Generate set flags for TxSettings, DataRate and NetworkIdentifiers messages.

Testing

Tested locally with the following command:

ttn-lw-cli simulate application-uplink adrian-test-lab eui-0004a310001ab188 --settings.frequency 12345678 --settings.data-rate.modulation.lora.spreading-factor 7 --settings.data-rate.modulation.lora.bandwidth 125000 --settings.data-rate.modulation.lora.coding-rate 4/5 --frm-payload ffff --f-port 123

It generates the following simulated uplink:

image

Manual testing should repeat the same procedure (with your own application and end device ID). It should be possible to use the CLI against older stack versions too.

Help flags before and after. Before:

Flags:
      --app-s-key.encrypted-key bytesHex      
      --app-s-key.kek-label string            
      --app-s-key.key 16-bytes                
      --application-id string                 
      --confirmed                             
      --consumed-airtime duration             
      --decoded-payload-warnings strings      
      --dev-eui string                        (hex)
      --device-id string                      
      --f-cnt uint32                          
      --f-port uint32                         
      --frm-payload bytesBase64               
  -h, --help                                  help for application-uplink
      --join-eui string                       (hex)
      --last-a-f-cnt-down uint32              
      --normalized-payload-warnings strings   
      --received-at timestamp                 
      --session-key-id bytesBase64            
      --version-ids.band-id string            
      --version-ids.brand-id string           
      --version-ids.firmware-version string   
      --version-ids.hardware-version string   
      --version-ids.model-id string

After:

Flags:
      --app-s-key.encrypted-key bytesHex                                      
      --app-s-key.kek-label string                                            
      --app-s-key.key 16-bytes                                                
      --application-id string                                                 
      --confirmed                                                             
      --consumed-airtime duration                                             
      --decoded-payload-warnings strings                                      
      --dev-eui string                                                        (hex)
      --device-id string                                                      
      --f-cnt uint32                                                          
      --f-port uint32                                                         
      --frm-payload bytesBase64                                               
  -h, --help                                                                  help for application-uplink
      --join-eui string                                                       (hex)
      --last-a-f-cnt-down uint32                                              
      --network-ids.cluster-address string                                    
      --network-ids.cluster-id string                                         
      --network-ids.net-id 3-bytes                                            
      --network-ids.ns-id 8-bytes                                             
      --network-ids.tenant-address string                                     
      --network-ids.tenant-id string                                          
      --normalized-payload-warnings strings                                   
      --received-at timestamp                                                 
      --session-key-id bytesBase64                                            
      --settings.concentrator-timestamp int                                   
      --settings.data-rate.modulation.fsk.bit-rate uint32                     
      --settings.data-rate.modulation.lora.bandwidth uint32                   
      --settings.data-rate.modulation.lora.coding-rate string                 
      --settings.data-rate.modulation.lora.spreading-factor uint32            
      --settings.data-rate.modulation.lrfhss.coding-rate string               
      --settings.data-rate.modulation.lrfhss.modulation-type uint32           
      --settings.data-rate.modulation.lrfhss.operating-channel-width uint32   
      --settings.downlink.antenna-index uint32                                
      --settings.downlink.invert-polarization                                 
      --settings.downlink.tx-power float32                                    
      --settings.enable-crc                                                   
      --settings.frequency uint                                               
      --settings.time timestamp                                               
      --settings.timestamp uint32                                             
      --version-ids.band-id string                                            
      --version-ids.brand-id string                                           
      --version-ids.firmware-version string                                   
      --version-ids.hardware-version string                                   
      --version-ids.model-id string
Regressions

By looking at the _flags.pb.go files, recursively only the ApplicationUplink.SetFromFlags is affected, and we use that setter only for the simulate application-uplink command, so things should be fine.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • The steps/process to test this feature are clearly explained including testing for regressions.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@adriansmares adriansmares added the bug Something isn't working label Oct 19, 2023
@adriansmares adriansmares added this to the v3.28.0 milestone Oct 19, 2023
@adriansmares adriansmares self-assigned this Oct 19, 2023
@adriansmares adriansmares marked this pull request as ready for review October 19, 2023 08:44
@adriansmares adriansmares merged commit 6054f3c into v3.28 Oct 20, 2023
@adriansmares adriansmares deleted the fix/uplink-simulation branch October 20, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants