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

[shell] Add 'server' command to shell app. #13377

Merged
merged 7 commits into from
Jan 7, 2022

Conversation

turon
Copy link
Contributor

@turon turon commented Jan 7, 2022

Synopsis

This PR is resubmitting reverted PR #13060, but with fixes for the shutdown handling issue discovered by CI post-merge.

Problem

The shell app has limited functionality. It doesn't provide access to core device functionality such as pairing or IM/ZCL command handling.

Change overview

Adds the server command to provide the ability to server start or server stop the equivalent of the all-clusters-app peripheral. Once the server is started, one can pair the device with chip-tool and send commands to it.

One can examine what sessions are active with the server sessions command. The ZCL structure can be inspected with the server endpoints and server clusters commands.

This work is an incremental step towards instrumenting early multi-device topology testing, such as using a chip-tool or chip-repl controller to manage two server nodes where each server is on a different port. This model could provide a flexible basis for scripted functional tests where each node is a chip-shell running in a process to serve as a simulated server node, and a collection of such nodes can form a topology for more advanced N-node tests.

The work is also a step toward making the chip-shell capable of being either a client or a server (or potentially both with enough rework of the core).

Testing

Local testing on linux and darwin.
CI for other embedded builds.

turon and others added 4 commits January 7, 2022 08:17
- Add 'server port' and 'server udcport' commands.
- Add 'server sessions' command.
- Add 'server endpoints' and 'server clusters' commands.

- Add docs for the new 'server' command subcommands (README_SERVER.md).
- Add 'server' command to build of linux and mac platforms only initially.

- Improve clean exit paths for 'server' command.
- Update 'ForEachSessionHandle' to use new Loop construct.
- Fix build failure in ota-provider (warning when logs disabled).
examples/shell/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/shell/shell_common/cmd_server.cpp Outdated Show resolved Hide resolved
examples/shell/shell_common/cmd_server.cpp Outdated Show resolved Hide resolved
src/app/server/Server.h Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Jan 7, 2022

PR #13377: Size comparison from 36a759d to 7aa2b61

Increases (5 builds for k32w, qpg, telink)
platform target config section 36a759d 7aa2b61 change % change
k32w light k32w061+release (read/write) 655772 655812 40 0.0
.bss 76864 76872 8 0.0
.text 571260 571292 32 0.0
lock k32w061+release (read/write) 660032 660076 44 0.0
.bss 77160 77168 8 0.0
.text 575204 575240 36 0.0
qpg lighting-app qpg6105+debug (read only) 533268 533296 28 0.0
.bss 86688 86696 8 0.0
.text 527948 527976 28 0.0
lock-app qpg6105+debug (read only) 505044 505072 28 0.0
.bss 85824 85832 8 0.0
.text 499724 499752 28 0.0
telink lighting-app tlsr9518adk80d (read/write) 834102 834906 804 0.1
bss 86864 87020 156 0.2
text 582240 582868 628 0.1
Full report (6 builds for k32w, qpg, telink)
platform target config section 36a759d 7aa2b61 change % change
k32w light k32w061+release (read/write) 655772 655812 40 0.0
.bss 76864 76872 8 0.0
.data 1848 1848 0 0.0
.text 571260 571292 32 0.0
lock k32w061+release (read/write) 660032 660076 44 0.0
.bss 77160 77168 8 0.0
.data 1868 1868 0 0.0
.text 575204 575240 36 0.0
qpg lighting-app qpg6105+debug (read only) 533268 533296 28 0.0
(read/write) 146936 146936 0 0.0
.bss 86688 86696 8 0.0
.data 1004 1004 0 0.0
.text 527948 527976 28 0.0
lock-app qpg6105+debug (read only) 505044 505072 28 0.0
(read/write) 146940 146940 0 0.0
.bss 85824 85832 8 0.0
.data 952 952 0 0.0
.text 499724 499752 28 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 834102 834906 804 0.1
bss 86864 87020 156 0.2
noinit 37160 37160 0 0.0
text 582240 582868 628 0.1

turon and others added 2 commits January 7, 2022 10:26
- Revert erroneous shutdown protection in Server.cpp
- Add app-level shutdown protection in cmd_server.cpp
@github-actions
Copy link

github-actions bot commented Jan 7, 2022

PR #13377: Size comparison from 6e14b75 to 555848d

Increases (10 builds for esp32, k32w, mbed, nrfconnect, qpg, telink)
platform target config section 6e14b75 555848d change % change
esp32 all-clusters-app m5stack (read only) 951735 951855 120 0.0
.flash.text 946351 946471 120 0.0
k32w lock k32w061+release (read/write) 660064 660068 4 0.0
.text 575236 575240 4 0.0
mbed lighting-app CY8CPROTO_062_4343W+release (read/write) 2330976 2330984 8 0.0
.text 1293576 1293584 8 0.0
shell CY8CPROTO_062_4343W+release (read/write) 2053888 2054200 312 0.0
.text 1016488 1016800 312 0.0
nrfconnect lock-app nrf5340dk_nrf5340_cpuapp (read/write) 821078 821082 4 0.0
rodata 96832 96836 4 0.0
shell nrf52840dk_nrf52840 (read/write) 797035 797735 700 0.1
bss 109536 109680 144 0.1
text 532852 533368 516 0.1
nrf5340dk_nrf5340_cpuapp (read/write) 709862 710554 692 0.1
bss 107424 107568 144 0.1
text 450528 451048 520 0.1
qpg lighting-app qpg6105+debug (read only) 533292 533296 4 0.0
.text 527972 527976 4 0.0
lock-app qpg6105+debug (read only) 505068 505072 4 0.0
.text 499748 499752 4 0.0
telink lighting-app tlsr9518adk80d (read/write) 834126 834906 780 0.1
bss 86864 87012 148 0.2
text 582262 582864 602 0.1
Decreases (1 build for esp32)
platform target config section 6e14b75 555848d change % change
esp32 all-clusters-app m5stack (read/write) 445872 445848 -24 -0.0
.flash.rodata 206752 206728 -24 -0.0
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 6e14b75 555848d change % change
efr32 lighting-app BRD4161A (read only) 832000 832000 0 0.0
(read/write) 127088 127088 0 0.0
.bss 125208 125208 0 0.0
.data 1876 1876 0 0.0
.text 831992 831992 0 0.0
BRD4161A+rpc (read only) 819180 819180 0 0.0
(read/write) 143744 143744 0 0.0
.bss 141768 141768 0 0.0
.data 1976 1976 0 0.0
.text 819172 819172 0 0.0
window-app BRD4161A (read only) 805448 805448 0 0.0
(read/write) 126024 126024 0 0.0
.bss 124192 124192 0 0.0
.data 1832 1832 0 0.0
.text 805440 805440 0 0.0
esp32 all-clusters-app c3devkit (read only) 891978 891978 0 0.0
(read/write) 1314290 1314290 0 0.0
.dram0.bss 69552 69552 0 0.0
.dram0.data 14236 14236 0 0.0
.flash.rodata 177448 177448 0 0.0
.flash.text 891978 891978 0 0.0
.iram0.text 62254 62254 0 0.0
m5stack (read only) 951735 951855 120 0.0
(read/write) 445872 445848 -24 -0.0
.dram0.bss 74048 74048 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 206752 206728 -24 -0.0
.flash.text 946351 946471 120 0.0
.iram0.text 122671 122671 0 0.0
k32w light k32w061+release (read/write) 655804 655804 0 0.0
.bss 76864 76864 0 0.0
.data 1848 1848 0 0.0
.text 571292 571292 0 0.0
lock k32w061+release (read/write) 660064 660068 4 0.0
.bss 77160 77160 0 0.0
.data 1868 1868 0 0.0
.text 575236 575240 4 0.0
linux chip-tool-ipv6only arm64 (read only) 7034172 7034172 0 0.0
(read/write) 325073 325073 0 0.0
.bss 54241 54241 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 209064 209064 0 0.0
.dynamic 560 560 0 0.0
.got 56992 56992 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 384292 384292 0 0.0
.text 5957108 5957108 0 0.0
thermostat-no-ble arm64 (read only) 2031180 2031180 0 0.0
(read/write) 144193 144193 0 0.0
.bss 64033 64033 0 0.0
.data 880 880 0 0.0
.data.rel.ro 72392 72392 0 0.0
.dynamic 560 560 0 0.0
.got 3952 3952 0 0.0
.init 24 24 0 0.0
.init_array 296 296 0 0.0
.rodata 128844 128844 0 0.0
.text 1689424 1689424 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2349088 2349088 0 0.0
.bss 188812 188812 0 0.0
.data 5312 5312 0 0.0
.text 1311664 1311664 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2330976 2330984 8 0.0
.bss 180632 180632 0 0.0
.data 5552 5552 0 0.0
.text 1293576 1293584 8 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2304136 2304136 0 0.0
.bss 179680 179680 0 0.0
.data 5544 5544 0 0.0
.text 1266736 1266736 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2053888 2054200 312 0.0
.bss 156972 156972 0 0.0
.data 4864 4864 0 0.0
.text 1016488 1016800 312 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 937763 937763 0 0.0
bss 118200 118200 0 0.0
rodata 108336 108336 0 0.0
text 633660 633660 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 923223 923223 0 0.0
bss 115244 115244 0 0.0
rodata 100780 100780 0 0.0
text 629012 629012 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 848710 848710 0 0.0
bss 116092 116092 0 0.0
rodata 101512 101512 0 0.0
text 550600 550600 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 909907 909907 0 0.0
bss 117388 117388 0 0.0
rodata 103608 103608 0 0.0
text 611532 611532 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 821078 821082 4 0.0
bss 115308 115308 0 0.0
rodata 96832 96836 4 0.0
text 528508 528508 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 911155 911155 0 0.0
bss 117148 117148 0 0.0
rodata 103824 103824 0 0.0
text 612744 612744 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 907987 907987 0 0.0
bss 117176 117176 0 0.0
rodata 103080 103080 0 0.0
text 610280 610280 0 0.0
shell nrf52840dk_nrf52840 (read/write) 797035 797735 700 0.1
bss 109536 109680 144 0.1
rodata 78188 78188 0 0.0
text 532852 533368 516 0.1
nrf5340dk_nrf5340_cpuapp (read/write) 709862 710554 692 0.1
bss 107424 107568 144 0.1
rodata 72492 72492 0 0.0
text 450528 451048 520 0.1
p6 all-clusters-app default (read/write) 2404904 2404904 0 0.0
.bss 117020 117020 0 0.0
.data 2592 2592 0 0.0
.text 1363168 1363168 0 0.0
light-app default (read/write) 2326864 2326864 0 0.0
.bss 105888 105888 0 0.0
.data 2384 2384 0 0.0
.text 1285128 1285128 0 0.0
lock-app default (read/write) 2299064 2299064 0 0.0
.bss 104768 104768 0 0.0
.data 2336 2336 0 0.0
.text 1257328 1257328 0 0.0
qpg lighting-app qpg6105+debug (read only) 533292 533296 4 0.0
(read/write) 146936 146936 0 0.0
.bss 86688 86688 0 0.0
.data 1004 1004 0 0.0
.text 527972 527976 4 0.0
lock-app qpg6105+debug (read only) 505068 505072 4 0.0
(read/write) 146940 146940 0 0.0
.bss 85824 85824 0 0.0
.data 952 952 0 0.0
.text 499748 499752 4 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 834126 834906 780 0.1
bss 86864 87012 148 0.2
noinit 37160 37160 0 0.0
text 582262 582864 602 0.1

@turon turon merged commit 585cdcb into project-chip:master Jan 7, 2022
msandstedt added a commit to msandstedt/connectedhomeip that referenced this pull request Jan 7, 2022
The pull requests project-chip#13330 and project-chip#13377 were merged around the same time,
and have caused a small build breakage.  This fixes it.
andy31415 pushed a commit that referenced this pull request Jan 7, 2022
The pull requests #13330 and #13377 were merged around the same time,
and have caused a small build breakage.  This fixes it.
step0035 pushed a commit to hank820/connectedhomeip that referenced this pull request Feb 8, 2022
* [shell] Add command to start/stop zcl app server.

- Add 'server port' and 'server udcport' commands.
- Add 'server sessions' command.
- Add 'server endpoints' and 'server clusters' commands.

- Add docs for the new 'server' command subcommands (README_SERVER.md).
- Add 'server' command to build of linux and mac platforms only initially.

- Improve clean exit paths for 'server' command.
- Update 'ForEachSessionHandle' to use new Loop construct.
- Fix build failure in ota-provider (warning when logs disabled).

* [shell] Correct order of atexit and shutdown handling.

* [shell] Add OTA stubs.

* Apply suggestions from code review

Co-authored-by: Łukasz Duda <[email protected]>

* [session] Update ForEachSessionHandle to new API.

- Revert erroneous shutdown protection in Server.cpp
- Add app-level shutdown protection in cmd_server.cpp

* Bugfix: Add chip shell engine initializing for esp32 platform (project-chip#13364)

* [shell] Code review fixes.

Co-authored-by: Łukasz Duda <[email protected]>
Co-authored-by: Wang Qixiang <[email protected]>
step0035 pushed a commit to hank820/connectedhomeip that referenced this pull request Feb 8, 2022
…ject-chip#13382)

The pull requests project-chip#13330 and project-chip#13377 were merged around the same time,
and have caused a small build breakage.  This fixes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants