xref: /aosp_15_r20/tools/netsim/rust/cli/netsim-cli.md (revision cf78ab8cffb8fc9207af348f23af247fb04370a6)
1# Command Line Interface for Netsim (netsim)
2
3Usage:
4* `netsim [Options] <COMMAND>`
5
6Options:
7* `-v, --verbose`: Set verbose mode
8* `-p, --port <PORT>`: Set custom grpc port
9* `    --vsock <VSOCK>`: Set vsock cid:port pair
10* `-h, --help`: Print help information
11
12## Commands:
13* ### `version`:    Print Netsim version information
14    * Usage: `netsim version`
15* ### `radio`:      Control the radio state of a device
16    * Usage: `netsim radio <RADIO_TYPE> <STATUS> <NAME>`
17    * Arguments:
18        * \<RADIO_TYPE\>:   Radio type [possible values: ble, classic, wifi, uwb]
19        * \<STATUS\>:       Radio status [possible values: up, down]
20        * \<NAME\>:         Device name
21* ### `move`:       Set the device location
22    * Usage: `netsim move <NAME> <X> <Y> [Z]`
23    * Arguments:
24        * \<NAME\>:         Device name
25        * \<X\>:            x position of device
26        * \<Y\>:            y position of device
27        * [Z]:              Optional z position of device
28* ### `devices`:    Display device(s) information
29    * Usage: `netsim devices [OPTIONS]`
30    * Options:
31        * `-c, --continuous`:    Continuously print device(s) information every second
32* ### `beacon`: A chip that sends advertisements at a set interval
33    * Usage: `netsim beacon <COMMAND>`
34    * #### Commands:
35        * `create`: Create a beacon
36            * Usage: `netsim beacon create <COMMAND>`
37                * ##### Commands:
38                    * `ble`: Create a Bluetooth low-energy beacon
39                        * Usage: `netsim beacon create ble [DEVICE_NAME | DEVICE_NAME CHIP_NAME] [OPTIONS]`
40                        * Arguments:
41                            * \[DEVICE_NAME\]: Optional name of the device to create. A default name will be generated if not supplied
42                            * \[CHIP_NAME\]: Optional name of the beacon to create within the new device. May only be specified if DEVICE_NAME is specified. A default name will be generated if not supplied
43                        * Advertisement Options:
44                            * `--advertise-mode <MODE>`: Set the advertise mode which controls the duration between advertisements
45                                * Possible values:
46                                    * `low-power`
47                                    * `balanced`
48                                    * `low-latency`
49                                    * A number measuring duration in milliseconds
50                            * `--tx-power-level <LEVEL>`: Set the beacon's transmission power level
51                                * Possible values:
52                                    * `ultra-low`
53                                    * `low`
54                                    * `medium`
55                                    * `high`
56                                    * A number measuring transmission power in dBm
57                            * `--scannable`: Set whether the beacon will respond to scan requests
58                            * `--timeout <MS>`: Limit advertising to an amount of time given in milliseconds
59                        * Advertise Packet Options:
60                            * `--include-device-name`: Set whether the device name should be included in the advertise packet
61                            * `--include-tx-power-level`: Set whether the transmit power level should be included in the advertise packet
62                            * `--manufacturer-data <DATA>`: Add manufacturer specific data to the advertise packet
63        * `patch`: Modify a beacon
64            * Usage: `netsim beacon patch <COMMAND>`
65                * ##### Commands:
66                    * `ble`: Modify a Bluetooth low-energy beacon
67                        * Usage: `netsim beacon patch ble <DEVICE_NAME> <CHIP_NAME> <OPTIONS>`
68                        * Arguments:
69                            * \<DEVICE_NAME\>: Name of the device that contains the beacon
70                            * \<CHIP_NAME\>: Name of the beacon to modify
71                        * Advertisement Options:
72                            * `--advertise-mode <MODE>`: Change the advertise mode which controls the duration between advertisements
73                                * Possible values:
74                                    * `low-power`
75                                    * `balanced`
76                                    * `low-latency`
77                                    * A number measuring duration in milliseconds
78                            * `--tx-power-level <LEVEL>`: Change the beacon's transmission power level
79                                * Possible values:
80                                    * `ultra-low`
81                                    * `low`
82                                    * `medium`
83                                    * `high`
84                                    * A number measuring transmission power in dBm
85                            * `--scannable`: Change whether the beacon will respond to scan requests
86                            * `--timeout <MS>`: Limit advertising to an amount of time given in milliseconds
87                        * Advertise Packet Options:
88                            * `--include-device-name`: Change whether the device name should be included in the advertise packet
89                            * `--include-tx-power-level`: Change whether the transmit power level should be included in the advertise packet
90                            * `--manufacturer-data <DATA>`: Change manufacturer specific data within the advertise packet
91        * `remove`: Remove a beacon
92            * Usage: `netsim beacon remove <DEVICE_NAME> [CHIP_NAME]`
93            * Arguments:
94                * \<DEVICE_NAME\>: Name of the device to remove
95                * \[CHIP_NAME\]: Optional name of the beacon to remove
96* ### `reset`:      Reset Netsim device scene
97    * Usage: `netsim reset`
98* ### `capture`:       Control the packet capture functionalities with commands: list, patch, get [aliases: pcap]
99    * Usage: `netsim capture <COMMAND>`
100    * #### Commands
101        * `list`:   List currently available Captures (packet captures)
102            * Usage: `netsim capture list [PATTERNS]...`
103            * Arguments:
104                * [PATTERNS]...:    Optional strings of pattern for captures to list. Possible filter fields
105                                    include ID, Device Name, and Chip Kind
106            * Options:
107                * `-c, --continuous`:    Continuously print Capture information every second
108        * `patch`:  Patch a Capture source to turn packet capture on/off
109            * Usage: `netsim capture patch <STATE> [PATTERNS]...`
110            * Arguments:
111                * \<STATE\>:        Packet capture state [possible values: on, off]
112                * [PATTERNS]...:  Optional strings of pattern for captures to patch. Possible filter fields
113                                    include ID, Device Name, and Chip Kind
114        * `get`:    Download the packet capture content
115            * Usage: `netsim capture get [OPTIONS] [PATTERNS]...`
116            * Arguments:
117                * [PATTERNS]...:    Optional strings of pattern for captures to get. Possible filter fields
118                                    include ID, Device Name, and Chip Kind
119            * Options:
120                * `-o, --location`: Directory to store downloaded capture file(s)
121* ### `gui`:        Opens netsim Web UI
122* ### `artifact`:   Opens netsim artifacts directory (log, pcaps)
123* ### `help`:       Print this message or the help of the given subcommand(s)
124