libremesh / lime-packages

LibreMesh packages configuring OpenWrt for wireless mesh networking
https://libremesh.org/
GNU Affero General Public License v3.0
276 stars 95 forks source link

Enable Node Information Exchange #1043

Closed javierbrk closed 10 months ago

javierbrk commented 10 months ago

This pull request adds node information exchange using shared state. This information will be used in the UI an is going to be compared with the reference state to display alerts when a node has changed or gone.

This module has been tested using two tplinks wdr3500 with the following output

root@LiMe-462895:~#echo | shared-state reqsync node_info

{"LiMe-da4eaa":{"bleachTTL":30,"data":{"coordinates":{"long":"-64.19291","lat":"-31.43393"}, "board":"tplink,tl-wdr3500-v1","device":"Router","macs":["14:cc:20:da:4e:af","14:cc:20:da:4e:ac", "14:cc:20:da:4e:ab", "00:00:00:00:00:00", "14:cc:20:da:4e:aa"], "hostname":"LiMe-da4eaa", "ipv4":"10.13.78.170","uptime":37.829999999999998, "ipv6":"fd0d:fe46:8ce8::aa4e:da00","firmware_version":"nodeinfo"}, "author":"LiMe-da4eaa"},"LiMe-462895":{"bleachTTL":30,"data":{"ipv6":"fd0d:fe46:8ce8::9528:4600","board":"tplink,tl-wdr3500-v1","device":"Router","macs":["a0:f3:c1:46:28:96","a0:f3:c1:46:28:97","a0:f3:c1:46:28:9a","00:00:00:00:00:00","a0:f3:c1:46:28:95"],"hostname":"LiMe-462895","firmware_version":"nodeinfo","coordinates":{"long":"FIXME","lat":"FIXME"}, "uptime":38.789999999999999,"ipv4":"10.13.40.149"},"author":"LiMe-462895"}}

root@LiMe-462895:~# ubus -S call shared-state getFromSharedState '{"data_type": "node_info"}' {"LiMe-462895":{"coordinates":{"long":"FIXME","lat":"FIXME"},"board":"tplink,tl-wdr3500-v1","device":"Router","macs":["a0:f3:c1:46:28:96","a0:f3:c1:46:28:97","a0:f3:c1:46:28:9a","00:00:00:00:00:00","a0:f3:c1:46:28:95"],"hostname":"LiMe-462895","ipv4":"10.13.40.149","uptime":38.790000,"ipv6":"fd0d:fe46:8ce8::9528:4600","firmware_version":"nodeinfo"},"LiMe-da4eaa":{"coordinates":{"long":"-64.19291","lat":"-31.43393"},"board":"tplink,tl-wdr3500-v1","device":"Router","uptime":37.830000,"hostname":"LiMe-da4eaa","firmware_version":"nodeinfo","ipv6":"fd0d:fe46:8ce8::aa4e:da00","macs":["14:cc:20:da:4e:af","14:cc:20:da:4e:ac","14:cc:20:da:4e:ab","00:00:00:00:00:00","14:cc:20:da:4e:aa"],"ipv4":"10.13.78.170"}}

codecov-commenter commented 10 months ago

Codecov Report

Merging #1043 (111b848) into master (e64db16) will increase coverage by 0.00%. Report is 2 commits behind head on master. The diff coverage is n/a.

:exclamation: Current head 111b848 differs from pull request most recent head e5c53b5. Consider uploading reports for the commit e5c53b5 to get more accurate results

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@           Coverage Diff           @@
##           master    #1043   +/-   ##
=======================================
  Coverage   79.71%   79.72%           
=======================================
  Files          53       53           
  Lines        4536     4538    +2     
=======================================
+ Hits         3616     3618    +2     
  Misses        920      920           

see 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

ilario commented 10 months ago

Nice! A few comments on the makefile:

$RANDOM will not be available in the upcoming LibreMesh releases. See https://github.com/libremesh/lime-packages/issues/800 and https://github.com/libremesh/lime-packages/pull/991 (this means that the makefile should include a dependency from the replacement package and the uci-default package should include the random-numgen command instead of the $RANDOM)

Consider using libremesh.mk as, for example, here: https://github.com/libremesh/lime-packages/blob/e64db16c4e80f29b4687ad346c0e8d7833f7b62d/packages/babeld-auto-gw-mode/Makefile#L6

Fill the maintainer field

G10h4ck commented 10 months ago

$RANDOM will not be available in the upcoming LibreMesh releases. See #800 and #991 (this means that the makefile should include a dependency from the replacement package and the uci-default package should include the random-numgen command instead of the $RANDOM)

@ilario this new packages are being developed on top of OpenWrt development branch which includes $RANDOM and are not retro-compatible with currently stable stuff anyway. OpenWrt developers are in the process to publish a new release which have $RANDOM just now (they have already published a few RC).

So don't worry about this for this new packages ;)

ilario commented 10 months ago

$RANDOM will not be available in the upcoming LibreMesh releases. See #800 and #991 (this means that the makefile should include a dependency from the replacement package and the uci-default package should include the random-numgen command instead of the $RANDOM)

@ilario this new packages are being developed on top of OpenWrt development branch which includes $RANDOM and are not retro-compatible with currently stable stuff anyway. OpenWrt developers are in the process to publish a new release which have $RANDOM just now (they have already published a few RC).

Ok, just be aware that this package will not work until when we will make a release based on OpenWrt 23, which is not going to be soon (seems).