Remove netsim cli capture command
Bug: 274636301
Test: ninja -C objs netsim
Change-Id: If9d12957d74eabf3a295f6e0c296d9487c3369ad
diff --git a/rust/netsim-cli/netsim-cli.md b/rust/netsim-cli/netsim-cli.md
index 43aa394..d7c0729 100644
--- a/rust/netsim-cli/netsim-cli.md
+++ b/rust/netsim-cli/netsim-cli.md
@@ -27,11 +27,6 @@
* Usage: `netsim devices [OPTIONS]`
* Options:
* `-c, --continuous`: Continuously print device(s) information every second
-* ### `capture`: Control the bluetooth packet capture for one or all devices
- * Usage: `netsim capture <STATE> <NAME>`
- * Arguments:
- * \<STATE\>: Capture state [possible values: on, off]
- * \<NAME\>: Device name
* ### `reset`: Reset Netsim device scene
* Usage: `netsim reset`
* ### `pcap`: Control the packet capture functionalities with commands: list, patch, get
diff --git a/rust/netsim-cli/src/args.rs b/rust/netsim-cli/src/args.rs
index 10cdd15..270b4e1 100644
--- a/rust/netsim-cli/src/args.rs
+++ b/rust/netsim-cli/src/args.rs
@@ -43,8 +43,6 @@
Move(Move),
/// Display device(s) information
Devices(Devices),
- /// Control the bluetooth packet capture for one or all devices
- Capture(Capture),
/// Reset Netsim device scene
Reset,
/// Open netsim Web UI
@@ -108,24 +106,6 @@
result.write_to_bytes().unwrap()
}
Command::Devices(_) => Vec::new(),
- Command::Capture(cmd) => {
- let mut bt_chip = model::Chip {
- kind: ChipKind::BLUETOOTH,
- chip: Some(model::Chip_oneof_chip::bt(Chip_Bluetooth { ..Default::default() })),
- ..Default::default()
- };
- let capture_state = match cmd.state {
- OnOffState::On => State::ON,
- OnOffState::Off => State::OFF,
- };
- bt_chip.set_capture(capture_state);
- let mut result = frontend::PatchDeviceRequest::new();
- let mutable_device = result.mut_device();
- mutable_device.set_name(cmd.name.to_owned());
- let mutable_chips = mutable_device.mut_chips();
- mutable_chips.push(bt_chip);
- result.write_to_bytes().unwrap()
- }
Command::Reset => Vec::new(),
Command::Gui => {
unimplemented!("get_request_bytes is not implemented for Gui Command.");
@@ -268,15 +248,6 @@
pub continuous: bool,
}
-#[derive(Debug, Args)]
-pub struct Capture {
- /// Capture state
- #[arg(value_enum, ignore_case = true)]
- pub state: OnOffState,
- /// Device name
- pub name: String,
-}
-
#[derive(Copy, Clone, Debug, PartialEq, Eq, ValueEnum)]
pub enum OnOffState {
On,
diff --git a/rust/netsim-cli/src/requests.rs b/rust/netsim-cli/src/requests.rs
index 7906a49..36dc0e8 100644
--- a/rust/netsim-cli/src/requests.rs
+++ b/rust/netsim-cli/src/requests.rs
@@ -23,7 +23,6 @@
Command::Radio(_) => GrpcMethod::PatchDevice,
Command::Move(_) => GrpcMethod::PatchDevice,
Command::Devices(_) => GrpcMethod::GetDevices,
- Command::Capture(_) => GrpcMethod::PatchDevice,
Command::Reset => GrpcMethod::Reset,
Command::Pcap(cmd) => match cmd {
args::Pcap::List(_) => GrpcMethod::ListPcap,
@@ -233,67 +232,6 @@
test_command("netsim-cli devices", GrpcMethod::GetDevices, Vec::new())
}
- fn get_expected_capture(name: &str, state: OnOffState) -> BinaryProtobuf {
- let mut bt_chip = model::Chip {
- kind: ChipKind::BLUETOOTH,
- chip: Some(model::Chip_oneof_chip::bt(Chip_Bluetooth { ..Default::default() })),
- ..Default::default()
- };
- let capture_state = match state {
- OnOffState::On => State::ON,
- OnOffState::Off => State::OFF,
- };
- bt_chip.set_capture(capture_state);
- let mut result = frontend::PatchDeviceRequest::new();
- let mutable_device = result.mut_device();
- mutable_device.set_name(name.to_owned());
- let mutable_chips = mutable_device.mut_chips();
- mutable_chips.push(bt_chip);
- result.write_to_bytes().unwrap()
- }
-
- #[test]
- fn test_capture_lowercase() {
- test_command(
- "netsim-cli capture on test_device",
- GrpcMethod::PatchDevice,
- get_expected_capture("test_device", OnOffState::On),
- );
- test_command(
- "netsim-cli capture off 1000",
- GrpcMethod::PatchDevice,
- get_expected_capture("1000", OnOffState::Off),
- )
- }
-
- #[test]
- fn test_capture_mixed_case() {
- test_command(
- "netsim-cli capture On 10",
- GrpcMethod::PatchDevice,
- get_expected_capture("10", OnOffState::On),
- );
- test_command(
- "netsim-cli capture Off 1000",
- GrpcMethod::PatchDevice,
- get_expected_capture("1000", OnOffState::Off),
- )
- }
-
- #[test]
- fn test_capture_uppercase() {
- test_command(
- "netsim-cli capture ON 1000",
- GrpcMethod::PatchDevice,
- get_expected_capture("1000", OnOffState::On),
- );
- test_command(
- "netsim-cli capture OFF 1000",
- GrpcMethod::PatchDevice,
- get_expected_capture("1000", OnOffState::Off),
- )
- }
-
#[test]
fn test_reset() {
test_command("netsim-cli reset", GrpcMethod::Reset, Vec::new())
diff --git a/rust/netsim-cli/src/response.rs b/rust/netsim-cli/src/response.rs
index 6978b55..f098308 100644
--- a/rust/netsim-cli/src/response.rs
+++ b/rust/netsim-cli/src/response.rs
@@ -56,15 +56,6 @@
verbose,
);
}
- Command::Capture(cmd) => {
- if verbose {
- println!(
- "Turned {} packet capture for {}",
- Self::on_off_state_to_string(cmd.state),
- cmd.name.to_owned()
- );
- }
- }
Command::Reset => {
if verbose {
println!("All devices have been reset.");