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

Make order of SX1301 config generated from multiple frequency plans deterministic #6614

Closed
4 tasks done
KrishnaIyer opened this issue Oct 4, 2023 · 0 comments · Fixed by #6708
Closed
4 tasks done
Assignees
Labels
bug Something isn't working c/gateway server This is related to the Gateway Server in progress We're working on it
Milestone

Comments

@KrishnaIyer
Copy link
Member

Summary

When multiple frequency plans are set for a gateway, the order in which those plans are used to generated the SX1301 configuration for is in theory important since that is the order in which the gateway concentrators are configured.

However, since we

Ref: #6580 (comment)

Steps to Reproduce

  1. Set multiple frequency plans on a gateway.
$ tti-lw-cli gtw set test-gateway --frequency-plan-ids US_902_928_FSB_1,US_902_928_FSB_2
{
  "ids": {
    "gateway_id": "test-gateway"
  },
  "created_at": "2023-10-04T04:00:18.781144Z",
  "updated_at": "2023-10-04T04:02:28.318986Z",
  "frequency_plan_ids": [
    "US_902_928_FSB_1",
    "US_902_928_FSB_2"
  ]
}
  1. Connect the gateway and check the config sent to it.
  2. Reconnect multiple times.

Current Result

There are two possibilites of router_config sent to the gateway.

{"msgtype":"router_config","NetID":null,"JoinEui":null,"region":"US902","hwspec":"sx1301/2","freq_range":[923000000,928000000],"DRs":[[10,125,0],[9,125,0],[8,125,0],[7,125,0],[8,500,0],[0,0,0],[0,0,0],[0,0,0],[12,500,0],[11,500,0],[10,500,0],[9,500,0],[8,500,0],[7,500,0],[0,0,0],[0,0,0]],"sx1301_conf":[{"radio_0":{"enable":true,"freq":904300000},"radio_1":{"enable":true,"freq":905000000},"chan_multiSF_0":{"enable":true,"radio":0,"if":-400000},"chan_multiSF_1":{"enable":true,"radio":0,"if":-200000},"chan_multiSF_2":{"enable":true,"radio":0,"if":0},"chan_multiSF_3":{"enable":true,"radio":0,"if":200000},"chan_multiSF_4":{"enable":true,"radio":1,"if":-300000},"chan_multiSF_5":{"enable":true,"radio":1,"if":-100000},"chan_multiSF_6":{"enable":true,"radio":1,"if":100000},"chan_multiSF_7":{"enable":true,"radio":1,"if":300000},"chan_Lora_std":{"enable":true,"radio":0,"if":300000,"bandwidth":500000,"spread_factor":8},"chan_FSK":{"enable":false}},{"radio_0":{"enable":true,"freq":902700000},"radio_1":{"enable":true,"freq":903400000},"chan_multiSF_0":{"enable":true,"radio":0,"if":-400000},"chan_multiSF_1":{"enable":true,"radio":0,"if":-200000},"chan_multiSF_2":{"enable":true,"radio":0,"if":0},"chan_multiSF_3":{"enable":true,"radio":0,"if":200000},"chan_multiSF_4":{"enable":true,"radio":1,"if":-300000},"chan_multiSF_5":{"enable":true,"radio":1,"if":-100000},"chan_multiSF_6":{"enable":true,"radio":1,"if":100000},"chan_multiSF_7":{"enable":true,"radio":1,"if":300000},"chan_Lora_std":{"enable":true,"radio":0,"if":300000,"bandwidth":500000,"spread_factor":8},"chan_FSK":{"enable":false}}],"nocca":true,"nodc":true,"nodwell":true,"MuxTime":1696392361.454208,"bcning":{"DR":8,"layout":[5,11,23],"freqs":[923300000,923900000,924500000,925100000,925700000,926300000,926900000,927500000]}}

OR

{"msgtype":"router_config","NetID":null,"JoinEui":null,"region":"US902","hwspec":"sx1301/2","freq_range":[923000000,928000000],"DRs":[[10,125,0],[9,125,0],[8,125,0],[7,125,0],[8,500,0],[0,0,0],[0,0,0],[0,0,0],[12,500,0],[11,500,0],[10,500,0],[9,500,0],[8,500,0],[7,500,0],[0,0,0],[0,0,0]],"sx1301_conf":[{"radio_0":{"enable":true,"freq":902700000},"radio_1":{"enable":true,"freq":903400000},"chan_multiSF_0":{"enable":true,"radio":0,"if":-400000},"chan_multiSF_1":{"enable":true,"radio":0,"if":-200000},"chan_multiSF_2":{"enable":true,"radio":0,"if":0},"chan_multiSF_3":{"enable":true,"radio":0,"if":200000},"chan_multiSF_4":{"enable":true,"radio":1,"if":-300000},"chan_multiSF_5":{"enable":true,"radio":1,"if":-100000},"chan_multiSF_6":{"enable":true,"radio":1,"if":100000},"chan_multiSF_7":{"enable":true,"radio":1,"if":300000},"chan_Lora_std":{"enable":true,"radio":0,"if":300000,"bandwidth":500000,"spread_factor":8},"chan_FSK":{"enable":false}},{"radio_0":{"enable":true,"freq":904300000},"radio_1":{"enable":true,"freq":905000000},"chan_multiSF_0":{"enable":true,"radio":0,"if":-400000},"chan_multiSF_1":{"enable":true,"radio":0,"if":-200000},"chan_multiSF_2":{"enable":true,"radio":0,"if":0},"chan_multiSF_3":{"enable":true,"radio":0,"if":200000},"chan_multiSF_4":{"enable":true,"radio":1,"if":-300000},"chan_multiSF_5":{"enable":true,"radio":1,"if":-100000},"chan_multiSF_6":{"enable":true,"radio":1,"if":100000},"chan_multiSF_7":{"enable":true,"radio":1,"if":300000},"chan_Lora_std":{"enable":true,"radio":0,"if":300000,"bandwidth":500000,"spread_factor":8},"chan_FSK":{"enable":false}}],"nocca":true,"nodc":true,"nodwell":true,"MuxTime":1696392333.711199,"bcning":{"DR":8,"layout":[5,11,23],"freqs":[923300000,923900000,924500000,925100000,925700000,926300000,926900000,927500000]}}

(You can compare the frequency set on radio_0 or radio_1 for the first item of the sx1301_conf array as reference)

One of these two is randomly sent to the gateway. This means that the FP:Concentrator mapping is not deterministic.

Expected Result

The order of the sx1301_conf should be the same and should match the order in which the --frequency-plan-ids field of the gateway was set.

Relevant Logs

No response

URL

No response

Deployment

The Things Stack Enterprise (self-hosted)

The Things Stack Version

3.27.2

Client Name and Version

All

Other Information

NA

Proposed Fix

The fix is pretty straightforward.
Change the gatewayFPs field in the connection from a map to an slice and update occurrences and tests.

Contributing

  • I can help by doing more research.
  • I can help by implementing a fix after the proposal above is approved.
  • I can help by testing the fix before it's released.

Code of Conduct

@KrishnaIyer KrishnaIyer added bug Something isn't working c/gateway server This is related to the Gateway Server labels Oct 4, 2023
@KrishnaIyer KrishnaIyer added this to the 2023 Q4 milestone Oct 4, 2023
@KrishnaIyer KrishnaIyer self-assigned this Oct 4, 2023
@github-actions github-actions bot added the needs/triage We still need to triage this label Oct 4, 2023
@KrishnaIyer KrishnaIyer removed the needs/triage We still need to triage this label Oct 4, 2023
@adriansmares adriansmares modified the milestones: 2023 Q4, v3.28.1 Nov 1, 2023
@cvetkovski98 cvetkovski98 linked a pull request Nov 15, 2023 that will close this issue
6 tasks
@cvetkovski98 cvetkovski98 added the in progress We're working on it label Nov 15, 2023
@KrishnaIyer KrishnaIyer modified the milestones: v3.28.1, v3.28.2 Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c/gateway server This is related to the Gateway Server in progress We're working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants