diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-16 00:24:21 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-16 00:24:21 +0000 |
commit | 0baca1212c7cc470860ac630cfeb202016c2fed4 (patch) | |
tree | 10211b7a5f8bcd7dc8c5409a97cd22f35114faba | |
parent | dd6fee924969dfa7b239224a9d5dc96b853c8dad (diff) | |
parent | a56b58dd7c9d1d274e002d9a0356d24655279e82 (diff) | |
download | acloud-0baca1212c7cc470860ac630cfeb202016c2fed4.tar.gz |
Snap for 11104212 from a56b58dd7c9d1d274e002d9a0356d24655279e82 to 24Q1-release
Change-Id: I3478b0fd83860416f90deec81752cd3793282b85
35 files changed, 124 insertions, 341 deletions
diff --git a/create/avd_spec.py b/create/avd_spec.py index 7f53ec8f..899a86d4 100644 --- a/create/avd_spec.py +++ b/create/avd_spec.py @@ -104,7 +104,6 @@ class AVDSpec(): # Let's define the private class vars here and then process the user # args afterwards. self._client_adb_port = args.adb_port - self._client_fastboot_port = args.fastboot_port self._autoconnect = None self._cvd_host_package = None self._instance_name_to_reuse = None @@ -875,15 +874,7 @@ class AVDSpec(): def connect_adb(self): """Auto-connect to adb. - Return: Boolean, whether adb autoconnect is enabled. - """ - return self._autoconnect is not False - - @property - def connect_fastboot(self): - """Auto-connect to fastboot. - - Return: Boolean, whether fastboot autoconnect is enabled. + Return: Boolean, whether autoconnect is enabled. """ return self._autoconnect is not False @@ -1030,11 +1021,6 @@ class AVDSpec(): return self._client_adb_port @property - def client_fastboot_port(self): - """Return the client fastboot port.""" - return self._client_fastboot_port - - @property def stable_host_image_name(self): """Return the Cuttlefish host image name.""" return self._stable_host_image_name diff --git a/create/avd_spec_test.py b/create/avd_spec_test.py index 1b3e34c2..7fe45cca 100644 --- a/create/avd_spec_test.py +++ b/create/avd_spec_test.py @@ -46,7 +46,6 @@ class AvdSpecTest(driver_test_lib.BaseDriverTest): self.args.config_file = "" self.args.build_target = "fake_build_target" self.args.adb_port = None - self.args.fastboot_port = None self.args.launch_args = None self.Patch(list_instances, "ChooseOneRemoteInstance", return_value=mock.MagicMock()) self.Patch(list_instances, "GetInstancesFromInstanceNames", return_value=mock.MagicMock()) @@ -513,7 +512,6 @@ class AvdSpecTest(driver_test_lib.BaseDriverTest): self.AvdSpec._ProcessMiscArgs(self.args) self.assertEqual(self.AvdSpec.autoconnect, False) self.assertEqual(self.AvdSpec.connect_adb, False) - self.assertEqual(self.AvdSpec.connect_fastboot, False) self.assertEqual(self.AvdSpec.connect_vnc, False) self.assertEqual(self.AvdSpec.connect_webrtc, False) @@ -521,7 +519,6 @@ class AvdSpecTest(driver_test_lib.BaseDriverTest): self.AvdSpec._ProcessMiscArgs(self.args) self.assertEqual(self.AvdSpec.autoconnect, True) self.assertEqual(self.AvdSpec.connect_adb, True) - self.assertEqual(self.AvdSpec.connect_fastboot, True) self.assertEqual(self.AvdSpec.connect_vnc, True) self.assertEqual(self.AvdSpec.connect_webrtc, False) @@ -529,15 +526,6 @@ class AvdSpecTest(driver_test_lib.BaseDriverTest): self.AvdSpec._ProcessMiscArgs(self.args) self.assertEqual(self.AvdSpec.autoconnect, True) self.assertEqual(self.AvdSpec.connect_adb, True) - self.assertEqual(self.AvdSpec.connect_fastboot, True) - self.assertEqual(self.AvdSpec.connect_vnc, False) - self.assertEqual(self.AvdSpec.connect_webrtc, False) - - self.args.autoconnect = constants.INS_KEY_FASTBOOT - self.AvdSpec._ProcessMiscArgs(self.args) - self.assertEqual(self.AvdSpec.autoconnect, True) - self.assertEqual(self.AvdSpec.connect_adb, True) - self.assertEqual(self.AvdSpec.connect_fastboot, True) self.assertEqual(self.AvdSpec.connect_vnc, False) self.assertEqual(self.AvdSpec.connect_webrtc, False) @@ -545,7 +533,6 @@ class AvdSpecTest(driver_test_lib.BaseDriverTest): self.AvdSpec._ProcessMiscArgs(self.args) self.assertEqual(self.AvdSpec.autoconnect, True) self.assertEqual(self.AvdSpec.connect_adb, True) - self.assertEqual(self.AvdSpec.connect_fastboot, True) self.assertEqual(self.AvdSpec.connect_vnc, False) self.assertEqual(self.AvdSpec.connect_webrtc, True) diff --git a/create/cheeps_remote_image_remote_instance.py b/create/cheeps_remote_image_remote_instance.py index af03ddeb..7d2ddcbd 100644 --- a/create/cheeps_remote_image_remote_instance.py +++ b/create/cheeps_remote_image_remote_instance.py @@ -60,7 +60,6 @@ class CheepsRemoteImageRemoteInstance(base_avd_create.BaseAVDCreate): autoconnect=avd_spec.autoconnect, avd_type=constants.TYPE_CHEEPS, client_adb_port=avd_spec.client_adb_port, - client_fastboot_port=avd_spec.client_fastboot_port, boot_timeout_secs=avd_spec.boot_timeout_secs) # Launch vnc client if we're auto-connecting. diff --git a/create/create_args.py b/create/create_args.py index 4f93d878..0a0d8687 100644 --- a/create/create_args.py +++ b/create/create_args.py @@ -60,13 +60,12 @@ def AddCommonCreateArgs(parser): dest="autoconnect", required=False, choices=[constants.INS_KEY_VNC, constants.INS_KEY_ADB, - constants.INS_KEY_FASTBOOT, constants.INS_KEY_WEBRTC], - help="Determines to establish a tunnel forwarding adb/fastboot/vnc and " - "launch VNC/webrtc. Establish a tunnel forwarding adb, fastboot and vnc " + constants.INS_KEY_WEBRTC], + help="Determines to establish a tunnel forwarding adb/vnc and " + "launch VNC/webrtc. Establish a tunnel forwarding adb and vnc " "then launch vnc if --autoconnect vnc is provided. Establish a " - "tunnel forwarding adb and fastboot if --autoconnect adb is provided. Enstablish a " - "tunnel forwarding adb and fastboot if --autoconnect fastboot is provided. " - "Establish a tunnel forwarding adb, fastboot and auto-launch on the browser " + "tunnel forwarding adb if --autoconnect adb is provided. " + "Establish a tunnel forwarding adb and auto-launch on the browser " "if --autoconnect webrtc is provided. For local goldfish " "instance, create a window.") parser.add_argument( @@ -528,13 +527,6 @@ def GetCreateArgParser(subparser): required=False, help="Specify port for adb forwarding.") create_parser.add_argument( - "--fastboot-port", "-f", - type=int, - default=None, - dest="fastboot_port", - required=False, - help="Specify port for fastboot forwarding.") - create_parser.add_argument( "--base-instance-num", type=int, default=None, @@ -967,30 +959,22 @@ def VerifyArgs(args): "--system-* args are not supported for AVD type: %s" % args.avd_type) - if args.num > 1: - if args.adb_port is not None: - raise errors.UnsupportedMultiAdbPort( - "--adb-port is not supported for multi-devices.") + if args.num > 1 and args.adb_port: + raise errors.UnsupportedMultiAdbPort( + "--adb-port is not supported for multi-devices.") - if args.fastboot_port is not None: - raise errors.UnsupportedMultiAdbPort( - "--fastboot-port is not supported for multi-devices.") - - if args.local_instance is not None: - raise errors.UnsupportedCreateArgs( - "--num is not supported for local instance.") + if args.num > 1 and args.local_instance is not None: + raise errors.UnsupportedCreateArgs( + "--num is not supported for local instance.") if args.local_instance is None and args.gpu == _DEFAULT_GPU: raise errors.UnsupportedCreateArgs( "Please assign one gpu model for GCE instance. Reference: " "https://cloud.google.com/compute/docs/gpus") - if args.adb_port is not None: + if args.adb_port: utils.CheckPortFree(args.adb_port) - if args.fastboot_port is not None: - utils.CheckPortFree(args.fastboot_port) - hw_properties = create_common.ParseKeyValuePairArgs(args.hw_property) for key in hw_properties: if key not in constants.HW_PROPERTIES: diff --git a/create/create_args_test.py b/create/create_args_test.py index a6c34c0c..38ae4f42 100644 --- a/create/create_args_test.py +++ b/create/create_args_test.py @@ -30,7 +30,6 @@ def _CreateArgs(): flavor=None, num=1, adb_port=None, - fastboot_port=None, hw_property=None, stable_cheeps_host_image_name=None, stable_cheeps_host_image_project=None, diff --git a/create/goldfish_remote_host.py b/create/goldfish_remote_host.py index 80c19c22..bfe60899 100644 --- a/create/goldfish_remote_host.py +++ b/create/goldfish_remote_host.py @@ -60,7 +60,6 @@ class GoldfishRemoteHost(base_avd_create.BaseAVDCreate): autoconnect=avd_spec.autoconnect, serial_log_file=avd_spec.serial_log_file, client_adb_port=avd_spec.client_adb_port, - client_fastboot_port=None, boot_timeout_secs=avd_spec.boot_timeout_secs, unlock_screen=avd_spec.unlock_screen, wait_for_boot=False, connect_webrtc=avd_spec.connect_webrtc, diff --git a/create/local_image_local_instance.py b/create/local_image_local_instance.py index b2d36cd7..de6819f4 100644 --- a/create/local_image_local_instance.py +++ b/create/local_image_local_instance.py @@ -80,7 +80,7 @@ _CMD_CVD_START = " start" _CMD_CVD_VERSION = " version" _CMD_LAUNCH_CVD_ARGS = ( " -daemon -config=%s -system_image_dir %s -instance_dir %s " - "-undefok=report_anonymous_usage_stats,config,proxy_fastboot " + "-undefok=report_anonymous_usage_stats,config " "-report_anonymous_usage_stats=y") _CMD_LAUNCH_CVD_HW_ARGS = " -cpus %s -x_res %s -y_res %s -dpi %s -memory_mb %s" _CMD_LAUNCH_CVD_DISK_ARGS = ( @@ -94,8 +94,6 @@ _CMD_LAUNCH_CVD_KERNEL_IMAGE_ARG = " -kernel_path=%s" _CMD_LAUNCH_CVD_INITRAMFS_IMAGE_ARG = " -initramfs_path=%s" _CMD_LAUNCH_CVD_VBMETA_IMAGE_ARG = " -vbmeta_image=%s" _CMD_LAUNCH_CVD_NO_ADB_ARG = " -run_adb_connector=false" -# Supported since U. -_CMD_LAUNCH_CVD_NO_FASTBOOT_ARG = " -proxy_fastboot=false" _CMD_LAUNCH_CVD_INSTANCE_NUMS_ARG = " -instance_nums=%s" # Connect the OpenWrt device via console file. _CMD_LAUNCH_CVD_CONSOLE_ARG = " -console=true" @@ -300,7 +298,6 @@ class LocalImageLocalInstance(base_avd_create.BaseAVDCreate): constants.ANDROID_INFO_FILE)) cmd = self.PrepareLaunchCVDCmd(hw_property, avd_spec.connect_adb, - avd_spec.connect_fastboot, artifact_paths, runtime_dir, avd_spec.connect_webrtc, @@ -577,10 +574,10 @@ class LocalImageLocalInstance(base_avd_create.BaseAVDCreate): # pylint: disable=too-many-branches @staticmethod - def PrepareLaunchCVDCmd(hw_property, connect_adb, connect_fastboot, - artifact_paths, runtime_dir, connect_webrtc, - connect_vnc, super_image_path, launch_args, - config, openwrt=False, use_launch_cvd=False, + def PrepareLaunchCVDCmd(hw_property, connect_adb, artifact_paths, + runtime_dir, connect_webrtc, connect_vnc, + super_image_path, launch_args, config, + openwrt=False, use_launch_cvd=False, instance_ids=None, webrtc_device_id=None, vbmeta_image_path=None): """Prepare launch_cvd command. @@ -592,7 +589,6 @@ class LocalImageLocalInstance(base_avd_create.BaseAVDCreate): hw_property: dict object of hw property. artifact_paths: ArtifactPaths object. connect_adb: Boolean flag that enables adb_connector. - connect_fastboot: Boolean flag that enables fastboot_proxy. runtime_dir: String of runtime directory path. connect_webrtc: Boolean of connect_webrtc. connect_vnc: Boolean of connect_vnc. @@ -627,9 +623,6 @@ class LocalImageLocalInstance(base_avd_create.BaseAVDCreate): if not connect_adb: launch_cvd_w_args = launch_cvd_w_args + _CMD_LAUNCH_CVD_NO_ADB_ARG - if not connect_fastboot: - launch_cvd_w_args = launch_cvd_w_args + _CMD_LAUNCH_CVD_NO_FASTBOOT_ARG - if connect_webrtc: launch_cvd_w_args = launch_cvd_w_args + _CMD_LAUNCH_CVD_WEBRTC_ARGS diff --git a/create/local_image_local_instance_test.py b/create/local_image_local_instance_test.py index 062b1f86..be6d312a 100644 --- a/create/local_image_local_instance_test.py +++ b/create/local_image_local_instance_test.py @@ -38,62 +38,62 @@ class LocalImageLocalInstanceTest(driver_test_lib.BaseDriverTest): LAUNCH_CVD_CMD_WITH_DISK = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -cpus fake -x_res fake -y_res fake -dpi fake -memory_mb fake -blank_data_image_mb fake -data_policy always_create -start_vnc_server=true +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -cpus fake -x_res fake -y_res fake -dpi fake -memory_mb fake -blank_data_image_mb fake -data_policy always_create -start_vnc_server=true EOF""" LAUNCH_CVD_CMD_NO_DISK = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -cpus fake -x_res fake -y_res fake -dpi fake -memory_mb fake -start_vnc_server=true +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -cpus fake -x_res fake -y_res fake -dpi fake -memory_mb fake -start_vnc_server=true EOF""" LAUNCH_CVD_CMD_NO_DISK_WITH_GPU = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -cpus fake -x_res fake -y_res fake -dpi fake -memory_mb fake -start_vnc_server=true +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -cpus fake -x_res fake -y_res fake -dpi fake -memory_mb fake -start_vnc_server=true EOF""" LAUNCH_CVD_CMD_WITH_WEBRTC = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=auto -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_webrtc=true +bin/cvd start -daemon -config=auto -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_webrtc=true EOF""" LAUNCH_CVD_CMD_WITH_MIXED_IMAGES = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -super_image=fake_super_image -boot_image=fake_boot_image -vendor_boot_image=fake_vendor_boot_image +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -super_image=fake_super_image -boot_image=fake_boot_image -vendor_boot_image=fake_vendor_boot_image EOF""" LAUNCH_CVD_CMD_WITH_KERNEL_IMAGES = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -kernel_path=fake_kernel_image -initramfs_path=fake_initramfs_image +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -kernel_path=fake_kernel_image -initramfs_path=fake_initramfs_image EOF""" LAUNCH_CVD_CMD_WITH_VBMETA_IMAGE = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -vbmeta_image=fake_vbmeta_image +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -vbmeta_image=fake_vbmeta_image EOF""" LAUNCH_CVD_CMD_WITH_ARGS = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -setupwizard_mode=REQUIRED +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -setupwizard_mode=REQUIRED EOF""" LAUNCH_CVD_CMD_WITH_OPENWRT = """sg group1 <<EOF sg group2 -bin/launch_cvd -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -console=true +bin/launch_cvd -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -console=true EOF""" LAUNCH_CVD_CMD_WITH_PET_NAME = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -webrtc_device_id=pet-name +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -webrtc_device_id=pet-name EOF""" LAUNCH_CVD_CMD_WITH_NO_CVD = """sg group1 <<EOF sg group2 -bin/launch_cvd -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true +bin/launch_cvd -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true EOF""" LAUNCH_CVD_CMD_WITH_INS_IDS = """sg group1 <<EOF sg group2 -bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config,proxy_fastboot -report_anonymous_usage_stats=y -start_vnc_server=true -instance_nums=1,2 +bin/cvd start -daemon -config=phone -system_image_dir fake_image_dir -instance_dir fake_cvd_dir -undefok=report_anonymous_usage_stats,config -report_anonymous_usage_stats=y -start_vnc_server=true -instance_nums=1,2 EOF""" _EXPECTED_DEVICES_IN_REPORT = [ @@ -518,7 +518,7 @@ EOF""" odm_dlkm_image=None) launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - hw_property, True, True, mock_artifact_paths, "fake_cvd_dir", False, + hw_property, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_DISK) @@ -526,19 +526,19 @@ EOF""" hw_property = {"cpu": "fake", "x_res": "fake", "y_res": "fake", "dpi": "fake", "memory": "fake"} launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - hw_property, True, True, mock_artifact_paths, "fake_cvd_dir", False, + hw_property, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_NO_DISK) # "gpu" is enabled with "default" launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - hw_property, True, True, mock_artifact_paths, "fake_cvd_dir", False, + hw_property, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_NO_DISK_WITH_GPU) # Following test with hw_property is None. launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", True, False, + None, True, mock_artifact_paths, "fake_cvd_dir", True, False, None, None, "auto") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_WEBRTC) @@ -546,7 +546,7 @@ EOF""" mock_artifact_paths.boot_image = "fake_boot_image" mock_artifact_paths.vendor_boot_image = "fake_vendor_boot_image" launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, "fake_super_image", None, "phone") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_MIXED_IMAGES) mock_artifact_paths.boot_image = None @@ -556,7 +556,7 @@ EOF""" mock_artifact_paths.kernel_image = "fake_kernel_image" mock_artifact_paths.initramfs_image = "fake_initramfs_image" launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_KERNEL_IMAGES) mock_artifact_paths.kernel_image = None @@ -564,39 +564,39 @@ EOF""" # Specify vbmeta image. launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone", vbmeta_image_path="fake_vbmeta_image" ) self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_VBMETA_IMAGE) # Add args into launch command with "-setupwizard_mode=REQUIRED" launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, "-setupwizard_mode=REQUIRED", "phone") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_ARGS) # Test with "openwrt" and "use_launch_cvd" are enabled. launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone", openwrt=True, use_launch_cvd=True) self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_OPENWRT) # Test with instance_ids launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone", instance_ids=[1,2]) self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_INS_IDS) # Test with "pet-name" launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone", webrtc_device_id="pet-name") self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_PET_NAME) # Test with "cvd" doesn't exist self.Patch(os.path, "isfile", return_value=False) launch_cmd = self.local_image_local_instance.PrepareLaunchCVDCmd( - None, True, True, mock_artifact_paths, "fake_cvd_dir", False, True, + None, True, mock_artifact_paths, "fake_cvd_dir", False, True, None, None, "phone", openwrt=False, use_launch_cvd=False) self.assertEqual(launch_cmd, self.LAUNCH_CVD_CMD_WITH_NO_CVD) diff --git a/create/local_image_remote_instance.py b/create/local_image_remote_instance.py index b34026b3..58bbb0bb 100644 --- a/create/local_image_remote_instance.py +++ b/create/local_image_remote_instance.py @@ -64,8 +64,7 @@ class LocalImageRemoteInstance(base_avd_create.BaseAVDCreate): unlock_screen=avd_spec.unlock_screen, wait_for_boot=False, connect_webrtc=avd_spec.connect_webrtc, - client_adb_port=avd_spec.client_adb_port, - client_fastboot_port=avd_spec.client_fastboot_port) + client_adb_port=avd_spec.client_adb_port) if create_report.status == report.Status.SUCCESS: if avd_spec.connect_vnc: utils.LaunchVNCFromReport(create_report, avd_spec, no_prompts) diff --git a/create/remote_image_remote_instance.py b/create/remote_image_remote_instance.py index 7cf5e153..c1f77530 100644 --- a/create/remote_image_remote_instance.py +++ b/create/remote_image_remote_instance.py @@ -73,8 +73,7 @@ class RemoteImageRemoteInstance(base_avd_create.BaseAVDCreate): unlock_screen=avd_spec.unlock_screen, wait_for_boot=False, connect_webrtc=avd_spec.connect_webrtc, - client_adb_port=avd_spec.client_adb_port, - client_fastboot_port=avd_spec.client_fastboot_port) + client_adb_port=avd_spec.client_adb_port) if create_report.status == report.Status.SUCCESS: if avd_spec.connect_vnc: utils.LaunchVNCFromReport(create_report, avd_spec, no_prompts) diff --git a/delete/delete_test.py b/delete/delete_test.py index 454d4603..51b1cdf2 100644 --- a/delete/delete_test.py +++ b/delete/delete_test.py @@ -384,7 +384,6 @@ class DeleteTest(driver_test_lib.BaseDriverTest): args.remote_host = None args.local_only = True args.adb_port = None - args.fastboot_port = None args.all = True self.Patch(delete, "_ReleaseOxygenDevice") diff --git a/internal/constants.py b/internal/constants.py index ade5dca2..e17eca57 100755 --- a/internal/constants.py +++ b/internal/constants.py @@ -111,7 +111,6 @@ INSTANCE_NAME = "instance_name" GCE_USER = "vsoc-01" VNC_PORT = "vnc_port" ADB_PORT = "adb_port" -FASTBOOT_PORT = "fastboot_port" WEBRTC_PORT = "webrtc_port" DEVICE_SERIAL = "device_serial" LOGS = "logs" @@ -119,7 +118,6 @@ BASE_INSTANCE_NUM = "base_instance_num" LAUNCH_CVD_COMMAND = "launch_cvd_command" # For cuttlefish remote instances CF_ADB_PORT = 6520 -CF_FASTBOOT_PORT = 7520 CF_VNC_PORT = 6444 # For cheeps remote instances CHEEPS_ADB_PORT = 9222 @@ -178,7 +176,6 @@ INS_KEY_STATUS = "status" INS_KEY_DISPLAY = "display" INS_KEY_IP = "ip" INS_KEY_ADB = "adb" -INS_KEY_FASTBOOT = "fastboot" INS_KEY_VNC = "vnc" INS_KEY_WEBRTC = "webrtc" INS_KEY_WEBRTC_PORT = "webrtc_port" diff --git a/internal/lib/cvd_compute_client_multi_stage_test.py b/internal/lib/cvd_compute_client_multi_stage_test.py index 812c95fe..8c315047 100644 --- a/internal/lib/cvd_compute_client_multi_stage_test.py +++ b/internal/lib/cvd_compute_client_multi_stage_test.py @@ -116,7 +116,6 @@ class CvdComputeClientTest(driver_test_lib.BaseDriverTest): self.args.avd_type = constants.TYPE_CF self.args.flavor = "phone" self.args.adb_port = None - self.args.fastboot_port = None self.args.base_instance_num = None self.args.hw_property = "cpu:2,resolution:1080x1920,dpi:240,memory:4g,disk:10g" self.args.num_avds_per_instance = 2 diff --git a/internal/lib/cvd_runtime_config.py b/internal/lib/cvd_runtime_config.py index 8f4cba04..4f4b4478 100644 --- a/internal/lib/cvd_runtime_config.py +++ b/internal/lib/cvd_runtime_config.py @@ -30,7 +30,6 @@ _CFG_KEY_VNC_PORT = "vnc_server_port" # The adb port field name changes from "host_port" to "adb_host_port". _CFG_KEY_ADB_PORT = "host_port" _CFG_KEY_ADB_HOST_PORT = "adb_host_port" -_CFG_KEY_FASTBOOT_HOST_PORT = "fastboot_host_port" _CFG_KEY_ENABLE_WEBRTC = "enable_webrtc" # TODO(148648620): Check instance_home_[id] for backward compatible. _RE_LOCAL_INSTANCE_ID = re.compile(r".+(?:local-instance-|instance_home_)" @@ -151,7 +150,6 @@ class CvdRuntimeConfig(): self._adb_port = (ins_dict.get(_CFG_KEY_ADB_PORT) or ins_dict.get(_CFG_KEY_ADB_HOST_PORT)) self._adb_ip_port = ins_dict.get(_CFG_KEY_ADB_IP_PORT) - self._fastboot_port = ins_dict.get(_CFG_KEY_FASTBOOT_HOST_PORT) self._virtual_disk_paths = ins_dict.get(_CFG_KEY_VIRTUAL_DISK_PATHS) if not self._cvd_tools_path: self._cvd_tools_path = os.path.dirname( @@ -223,11 +221,6 @@ class CvdRuntimeConfig(): return self._adb_port @property - def fastboot_port(self): - """Return fastboot_port""" - return self._fastboot_port - - @property def config_path(self): """Return config_path.""" return self._config_path diff --git a/internal/lib/cvd_runtime_config_test.py b/internal/lib/cvd_runtime_config_test.py index 8845a2e4..ae77ef07 100644 --- a/internal/lib/cvd_runtime_config_test.py +++ b/internal/lib/cvd_runtime_config_test.py @@ -42,7 +42,6 @@ class CvdRuntimeconfigTest(driver_test_lib.BaseDriverTest): "2":{ "adb_ip_and_port": "127.0.0.1:6520", "adb_host_port": 6520, - "fastboot_host_port": 7520, "instance_dir": "/path-to-instance-dir", "crosvm_binary" : "/home/vsoc-01/bin/crosvm", "vnc_server_port": 6444 @@ -65,7 +64,6 @@ class CvdRuntimeconfigTest(driver_test_lib.BaseDriverTest): "1":{ "adb_ip_and_port": "127.0.0.1:6520", "adb_host_port": 6520, - "fastboot_host_port": 7520, "instance_dir": "/path-to-instance-dir", "vnc_server_port": 6444, "virtual_disk_paths": ["/path-to-image"] @@ -112,7 +110,6 @@ class CvdRuntimeconfigTest(driver_test_lib.BaseDriverTest): {'adb_ip_and_port': '127.0.0.1:6520', 'crosvm_binary': '/home/vsoc-01/bin/crosvm', 'adb_host_port': 6520, - 'fastboot_host_port': 7520, 'instance_dir': '/path-to-instance-dir', 'vnc_server_port': 6444} }, @@ -141,7 +138,7 @@ class CvdRuntimeconfigTest(driver_test_lib.BaseDriverTest): self.assertEqual(fake_cvd_runtime_config_webrtc.adb_ip_port, "127.0.0.1:6520") self.assertEqual(fake_cvd_runtime_config_webrtc.instance_dir, "/path-to-instance-dir") self.assertEqual(fake_cvd_runtime_config_webrtc.vnc_port, 6444) - self.assertEqual(fake_cvd_runtime_config_webrtc.fastboot_port, 7520) + self.assertEqual(fake_cvd_runtime_config_webrtc.adb_port, 6520) self.assertEqual(fake_cvd_runtime_config_webrtc.virtual_disk_paths, ['/path-to-image']) self.assertEqual(fake_cvd_runtime_config_webrtc.cvd_tools_path, "/home/vsoc-01/bin") diff --git a/internal/lib/cvd_utils.py b/internal/lib/cvd_utils.py index e800367a..8f3a2f23 100644 --- a/internal/lib/cvd_utils.py +++ b/internal/lib/cvd_utils.py @@ -143,19 +143,6 @@ def GetAdbPorts(base_instance_num, num_avds_per_instance): return [constants.CF_ADB_PORT + (base_instance_num or 1) - 1 + index for index in range(num_avds_per_instance or 1)] -def GetFastbootPorts(base_instance_num, num_avds_per_instance): - """Get Fastboot ports of cuttlefish. - - Args: - base_instance_num: An integer or None, the instance number of the first - device. - num_avds_per_instance: An integer or None, the number of devices. - - Returns: - The port numbers as a list of integers. - """ - return [constants.CF_FASTBOOT_PORT + (base_instance_num or 1) - 1 + index - for index in range(num_avds_per_instance or 1)] def GetVncPorts(base_instance_num, num_avds_per_instance): """Get VNC ports of cuttlefish. diff --git a/internal/lib/cvd_utils_test.py b/internal/lib/cvd_utils_test.py index 106c5130..c48f180f 100644 --- a/internal/lib/cvd_utils_test.py +++ b/internal/lib/cvd_utils_test.py @@ -47,12 +47,6 @@ class CvdUtilsTest(driver_test_lib.BaseDriverTest): self.assertEqual([6520], cvd_utils.GetAdbPorts(1, 1)) self.assertEqual([6521, 6522], cvd_utils.GetAdbPorts(2, 2)) - def testGetFastbootPorts(self): - """Test GetFastbootPorts.""" - self.assertEqual([7520], cvd_utils.GetFastbootPorts(None, None)) - self.assertEqual([7520], cvd_utils.GetFastbootPorts(1, 1)) - self.assertEqual([7521, 7522], cvd_utils.GetFastbootPorts(2, 2)) - def testGetVncPorts(self): """Test GetVncPorts.""" self.assertEqual([6444], cvd_utils.GetVncPorts(None, None)) diff --git a/internal/lib/utils.py b/internal/lib/utils.py index 6a085f54..3a6a2025 100755 --- a/internal/lib/utils.py +++ b/internal/lib/utils.py @@ -82,23 +82,18 @@ _RE_WEBRTC_SSH_TUNNEL_PATTERN = ( _ADB_CONNECT_ARGS = "connect 127.0.0.1:%(adb_port)d" # Store the ports that vnc/adb are forwarded to, both are integers. ForwardedPorts = collections.namedtuple("ForwardedPorts", [constants.VNC_PORT, - constants.ADB_PORT, - constants.FASTBOOT_PORT]) + constants.ADB_PORT]) AVD_PORT_DICT = { constants.TYPE_GCE: ForwardedPorts(constants.GCE_VNC_PORT, - constants.GCE_ADB_PORT, - None), + constants.GCE_ADB_PORT), constants.TYPE_CF: ForwardedPorts(constants.CF_VNC_PORT, - constants.CF_ADB_PORT, - constants.CF_FASTBOOT_PORT), + constants.CF_ADB_PORT), constants.TYPE_GF: ForwardedPorts(constants.GF_VNC_PORT, - constants.GF_ADB_PORT, - None), + constants.GF_ADB_PORT), constants.TYPE_CHEEPS: ForwardedPorts(constants.CHEEPS_VNC_PORT, - constants.CHEEPS_ADB_PORT, - None), - constants.TYPE_FVP: ForwardedPorts(None, constants.FVP_ADB_PORT, None), + constants.CHEEPS_ADB_PORT), + constants.TYPE_FVP: ForwardedPorts(None, constants.FVP_ADB_PORT), } _VNC_BIN = "ssvnc" @@ -849,7 +844,7 @@ def EstablishSshTunnel(ip_addr, rsa_key_file, ssh_user, """Create an ssh tunnel. Args: - ip_addr: String, use to build the adb, fastboot & vnc tunnel between local + ip_addr: String, use to build the adb & vnc tunnel between local and remote instance. rsa_key_file: String, Private key file path to use when creating the ssh tunnels. @@ -883,7 +878,7 @@ def EstablishWebRTCSshTunnel(ip_addr, webrtc_local_port, rsa_key_file, ssh_user, the port of the webrtc operator of the remote instance. Args: - ip_addr: String, use to build the adb, fastboot & vnc tunnel between local + ip_addr: String, use to build the adb & vnc tunnel between local and remote instance. webrtc_local_port: Integer, pick a free port as webrtc local port. rsa_key_file: String, Private key file path to use when creating @@ -919,7 +914,7 @@ def GetWebRTCServerPort(ip_addr, rsa_key_file, ssh_user, determine the WebRTC server port is 8443 or 1443. Args: - ip_addr: String, use to build the adb, fastboot & vnc tunnel between local + ip_addr: String, use to build the adb & vnc tunnel between local and remote instance. rsa_key_file: String, Private key file path to use when creating the ssh tunnels. @@ -975,35 +970,29 @@ def GetWebrtcPortFromSSHTunnel(ip): return None -# TODO(147337696): create ssh tunnels tear down as adb, fastboot and vnc. +# TODO(147337696): create ssh tunnels tear down as adb and vnc. # pylint: disable=too-many-locals -def AutoConnect(ip_addr, rsa_key_file, target_vnc_port, target_adb_port, target_fastboot_port, - ssh_user, client_adb_port=None, client_fastboot_port=None, - extra_args_ssh_tunnel=None): +def AutoConnect(ip_addr, rsa_key_file, target_vnc_port, target_adb_port, + ssh_user, client_adb_port=None, extra_args_ssh_tunnel=None): """Autoconnect to an AVD instance. Args: - ip_addr: String, use to build the adb, fastboot & vnc tunnel between local + ip_addr: String, use to build the adb & vnc tunnel between local and remote instance. rsa_key_file: String, Private key file path to use when creating the ssh tunnels. target_vnc_port: Integer of target vnc port number. target_adb_port: Integer of target adb port number. - target_fastboot_port: Integer of target fastboot port number. ssh_user: String of user login into the instance. client_adb_port: Integer, Specified adb port to establish connection. - client_fastboot_port: Integer, Specified fastboot port to establish connection. extra_args_ssh_tunnel: String, extra args for ssh tunnel connection. Returns: - NamedTuple of (vnc_port, adb_port, fastboot_port) SSHTUNNEL of the connect, both are + NamedTuple of (vnc_port, adb_port) SSHTUNNEL of the connect, both are integers. """ local_adb_port = client_adb_port or PickFreePort() port_mapping = [(local_adb_port, target_adb_port)] - local_fastboot_port = client_fastboot_port or PickFreePort() - if target_fastboot_port: - port_mapping.append((local_fastboot_port, target_fastboot_port)) local_free_vnc_port = None if target_vnc_port: local_free_vnc_port = PickFreePort() @@ -1014,7 +1003,7 @@ def AutoConnect(ip_addr, rsa_key_file, target_vnc_port, target_adb_port, target_ except subprocess.CalledProcessError as e: PrintColorString("\n%s\nFailed to create ssh tunnels, retry with '#acloud " "reconnect'." % e, TextColors.FAIL) - return ForwardedPorts(vnc_port=None, adb_port=None, fastboot_port=None) + return ForwardedPorts(vnc_port=None, adb_port=None) try: adb_connect_args = _ADB_CONNECT_ARGS % {"adb_port": local_adb_port} @@ -1024,8 +1013,7 @@ def AutoConnect(ip_addr, rsa_key_file, target_vnc_port, target_adb_port, target_ "'#acloud reconnect'", TextColors.FAIL) return ForwardedPorts(vnc_port=local_free_vnc_port, - adb_port=local_adb_port, - fastboot_port=local_fastboot_port) + adb_port=local_adb_port) def FindRemoteFiles(ssh_obj, search_dirs): @@ -1620,7 +1608,7 @@ def GetCvdPorts(): Returns: - ForwardedPorts: vnc, adb and fastboot ports. + ForwardedPorts: vnc port and adb port. """ return AVD_PORT_DICT[constants.TYPE_CF] @@ -1633,8 +1621,6 @@ def SetCvdPorts(base_instance_num): """ offset = (base_instance_num or 1) - 1 AVD_PORT_DICT[constants.TYPE_CF] = ForwardedPorts( - constants.CF_VNC_PORT + offset, - constants.CF_ADB_PORT + offset, - constants.CF_FASTBOOT_PORT + offset) + constants.CF_VNC_PORT + offset, constants.CF_ADB_PORT + offset) # TODO: adjust WebRTC ports diff --git a/internal/lib/utils_test.py b/internal/lib/utils_test.py index 9f97743d..3e518888 100644 --- a/internal/lib/utils_test.py +++ b/internal/lib/utils_test.py @@ -391,17 +391,15 @@ class UtilsTest(driver_test_lib.BaseDriverTest): fake_rsa_key_file = "/tmp/rsa_file" fake_target_vnc_port = 8888 target_adb_port = 9999 - target_fastboot_port = 7777 ssh_user = "fake_user" call_side_effect = subprocess.CalledProcessError(123, "fake", "fake error") - result = utils.ForwardedPorts(vnc_port=None, adb_port=None, fastboot_port=None) + result = utils.ForwardedPorts(vnc_port=None, adb_port=None) self.Patch(utils, "EstablishSshTunnel", side_effect=call_side_effect) self.assertEqual(result, utils.AutoConnect(fake_ip_addr, fake_rsa_key_file, fake_target_vnc_port, target_adb_port, - target_fastboot_port, ssh_user)) def testAutoConnectWithExtraArgs(self): @@ -410,7 +408,6 @@ class UtilsTest(driver_test_lib.BaseDriverTest): fake_rsa_key_file = "/tmp/rsa_file" fake_target_vnc_port = 8888 target_adb_port = 9999 - target_fastboot_port = 7777 ssh_user = "fake_user" fake_port = 12345 self.Patch(utils, "PickFreePort", return_value=fake_port) @@ -421,17 +418,14 @@ class UtilsTest(driver_test_lib.BaseDriverTest): rsa_key_file=fake_rsa_key_file, target_vnc_port=fake_target_vnc_port, target_adb_port=target_adb_port, - target_fastboot_port=target_fastboot_port, ssh_user=ssh_user, client_adb_port=fake_port, - client_fastboot_port=fake_port, extra_args_ssh_tunnel=extra_args_ssh_tunnel) mock_establish_ssh_tunnel.assert_called_with( fake_ip_addr, fake_rsa_key_file, ssh_user, [utils.PortMapping(fake_port, target_adb_port), - utils.PortMapping(fake_port, target_fastboot_port), utils.PortMapping(fake_port, fake_target_vnc_port)], extra_args_ssh_tunnel) mock_execute_command.assert_called_with( @@ -596,7 +590,6 @@ class UtilsTest(driver_test_lib.BaseDriverTest): """test base_instance_num.""" utils.SetCvdPorts(2) self.assertEqual(utils.GetCvdPorts().adb_port, 6521) - self.assertEqual(utils.GetCvdPorts().fastboot_port, 7521) self.assertEqual(utils.GetCvdPorts().vnc_port, 6445) utils.SetCvdPorts(None) diff --git a/list/instance.py b/list/instance.py index 5fdf776d..d6fa6fef 100644 --- a/list/instance.py +++ b/list/instance.py @@ -61,7 +61,6 @@ _CVD_STOP_ERROR_KEYWORDS = "cvd_internal_stop E" _CVD_TIMEOUT = 30 # Keywords read from runtime config. _ADB_HOST_PORT = "adb_host_port" -_FASTBOOT_HOST_PORT = "fastboot_host_port" # Keywords read from the output of "cvd status". _DISPLAYS = "displays" _WEBRTC_PORT = "webrtc_port" @@ -73,11 +72,9 @@ _ACLOUDWEB_INSTANCE_START_STRING = "cf-" _MSG_UNABLE_TO_CALCULATE = "Unable to calculate" _NO_ANDROID_ENV = "android source not available" _RE_GROUP_ADB = "local_adb_port" -_RE_GROUP_FASTBOOT = "local_fastboot_port" _RE_GROUP_VNC = "local_vnc_port" _RE_SSH_TUNNEL_PATTERN = (r"((.*\s*-L\s)(?P<%s>\d+):127.0.0.1:%s)" r"((.*\s*-L\s)(?P<%s>\d+):127.0.0.1:%s)" - r"((.*\s*-L\s)(?P<%s>\d+):127.0.0.1:%s)" r"(.+(%s|%s))") _RE_TIMEZONE = re.compile(r"^(?P<time>[0-9\-\.:T]*)(?P<timezone>[+-]\d+:\d+)$") _RE_DEVICE_INFO = re.compile(r"(?s).*(?P<device_info>[{][\s\w\W]+})") @@ -320,8 +317,8 @@ class Instance(object): # pylint: disable=too-many-locals def __init__(self, name, fullname, display, ip, status=None, adb_port=None, - fastboot_port=None, vnc_port=None, ssh_tunnel_is_connected=None, - createtime=None, elapsed_time=None, avd_type=None, avd_flavor=None, + vnc_port=None, ssh_tunnel_is_connected=None, createtime=None, + elapsed_time=None, avd_type=None, avd_flavor=None, is_local=False, device_information=None, zone=None, webrtc_port=None, webrtc_forward_port=None): self._name = name @@ -329,9 +326,8 @@ class Instance(object): self._status = status self._display = display # Resolution and dpi self._ip = ip - self._adb_port = adb_port # adb port which is forwarding to remote - self._fastboot_port = fastboot_port # fastboot port which is forwarding to remote - self._vnc_port = vnc_port # vnc port which is forwarding to remote + self._adb_port = adb_port # adb port which is forwarding to remote + self._vnc_port = vnc_port # vnc port which is forwarding to remote self._webrtc_port = webrtc_port self._webrtc_forward_port = webrtc_forward_port # True if ssh tunnel is still connected @@ -405,8 +401,6 @@ class Instance(object): return constants.INS_KEY_VNC if self._adb_port: return constants.INS_KEY_ADB - if self._fastboot_port: - return constants.INS_KEY_FASTBOOT return None @property @@ -465,11 +459,6 @@ class Instance(object): return self._adb_port @property - def fastboot_port(self): - """Return fastboot_port.""" - return self._fastboot_port - - @property def vnc_port(self): """Return vnc_port.""" return self._vnc_port @@ -514,7 +503,6 @@ class LocalInstance(Instance): ins_info = self._cf_runtime_cfg.instances.get(ins_id, {}) adb_port = ins_info.get(_ADB_HOST_PORT) or self._cf_runtime_cfg.adb_port - fastboot_port = ins_info.get(_FASTBOOT_HOST_PORT) or self._cf_runtime_cfg.fastboot_port webrtc_device_id = (ins_info.get(constants.INS_KEY_WEBRTC_DEVICE_ID) or f"cvd-{self._local_instance_id}") adb_serial = f"0.0.0.0:{adb_port}" @@ -544,7 +532,6 @@ class LocalInstance(Instance): name=name, fullname=fullname, display=display, ip="0.0.0.0", status=constants.INS_STATUS_RUNNING, adb_port=adb_port, - fastboot_port=fastboot_port, vnc_port=self._cf_runtime_cfg.vnc_port, createtime=None, elapsed_time=None, avd_type=constants.TYPE_CF, is_local=True, device_information=device_information, @@ -946,14 +933,12 @@ class RemoteInstance(Instance): # Find ssl tunnel info. adb_port = None - fastboot_port = None vnc_port = None webrtc_forward_port = None device_information = None if ip: - forwarded_ports = self.GetForwardedPortsFromSSHTunnel(ip, hostname, avd_type) + forwarded_ports = self.GetAdbVncPortFromSSHTunnel(ip, hostname, avd_type) adb_port = forwarded_ports.adb_port - fastboot_port = forwarded_ports.fastboot_port vnc_port = forwarded_ports.vnc_port ssh_tunnel_is_connected = adb_port is not None webrtc_forward_port = utils.GetWebrtcPortFromSSHTunnel(ip) @@ -974,7 +959,7 @@ class RemoteInstance(Instance): super().__init__( name=name, fullname=fullname, display=display, ip=ip, status=status, - adb_port=adb_port, fastboot_port=fastboot_port, vnc_port=vnc_port, + adb_port=adb_port, vnc_port=vnc_port, ssh_tunnel_is_connected=ssh_tunnel_is_connected, createtime=create_time, elapsed_time=elapsed_time, avd_type=avd_type, avd_flavor=avd_flavor, is_local=False, @@ -1025,7 +1010,7 @@ class RemoteInstance(Instance): return None @staticmethod - def GetForwardedPortsFromSSHTunnel(ip, hostname, avd_type): + def GetAdbVncPortFromSSHTunnel(ip, hostname, avd_type): """Get forwarding adb and vnc port from ssh tunnel. Args: @@ -1034,30 +1019,26 @@ class RemoteInstance(Instance): avd_type: String, the AVD type. Returns: - NamedTuple ForwardedPorts(vnc_port, adb_port, fastboot_port) holding the ports + NamedTuple ForwardedPorts(vnc_port, adb_port) holding the ports used in the ssh forwarded call. Both fields are integers. """ if avd_type not in utils.AVD_PORT_DICT: - return utils.ForwardedPorts(vnc_port=None, adb_port=None, fastboot_port=None) + return utils.ForwardedPorts(vnc_port=None, adb_port=None) default_vnc_port = utils.AVD_PORT_DICT[avd_type].vnc_port default_adb_port = utils.AVD_PORT_DICT[avd_type].adb_port - default_fastboot_port = utils.AVD_PORT_DICT[avd_type].fastboot_port # TODO(165888525): Align the SSH tunnel for the order of adb port and # vnc port. re_pattern = re.compile(_RE_SSH_TUNNEL_PATTERN % (_RE_GROUP_ADB, default_adb_port, - _RE_GROUP_FASTBOOT, default_fastboot_port, _RE_GROUP_VNC, default_vnc_port, ip, hostname)) adb_port = None - fastboot_port = None vnc_port = None process_output = utils.CheckOutput(constants.COMMAND_PS) for line in process_output.splitlines(): match = re_pattern.match(line) if match: adb_port = int(match.group(_RE_GROUP_ADB)) - fastboot_port = int(match.group(_RE_GROUP_FASTBOOT)) vnc_port = int(match.group(_RE_GROUP_VNC)) break @@ -1065,6 +1046,4 @@ class RemoteInstance(Instance): "IP:%s, forwarding (adb:%s, vnc:%s)"), ip, adb_port, vnc_port) - return utils.ForwardedPorts(vnc_port=vnc_port, - adb_port=adb_port, - fastboot_port=fastboot_port) + return utils.ForwardedPorts(vnc_port=vnc_port, adb_port=adb_port) diff --git a/list/instance_test.py b/list/instance_test.py index 078fddab..b997b190 100644 --- a/list/instance_test.py +++ b/list/instance_test.py @@ -36,18 +36,13 @@ from acloud.internal.lib.adb_tools import AdbTools from acloud.list import instance -ForwardedPorts = collections.namedtuple("ForwardedPorts", - [constants.VNC_PORT, - constants.ADB_PORT, - constants.FASTBOOT_PORT]) - class InstanceTest(driver_test_lib.BaseDriverTest): """Test instance.""" PS_SSH_TUNNEL = ("/fake_ps_1 --fake arg \n" "/fake_ps_2 --fake arg \n" "/usr/bin/ssh -i ~/.ssh/acloud_rsa " "-o UserKnownHostsFile=/dev/null " - "-o StrictHostKeyChecking=no -L 54321:127.0.0.1:6520 -L 6789:127.0.0.1:7520" + "-o StrictHostKeyChecking=no -L 54321:127.0.0.1:6520 " "-L 12345:127.0.0.1:6444 -N -f -l user 1.1.1.1").encode() GCE_INSTANCE = { constants.INS_KEY_NAME: "fake_ins_name", @@ -256,7 +251,7 @@ class InstanceTest(driver_test_lib.BaseDriverTest): datetime.timedelta(hours=2), instance._GetElapsedTime(start_time)) # pylint: disable=protected-access - def testGetForwardedPortsFromSSHTunnel(self): + def testGetAdbVncPortFromSSHTunnel(self): """"Test Get forwarding adb and vnc port from ssh tunnel.""" self.Patch(subprocess, "check_output", return_value=self.PS_SSH_TUNNEL) self.Patch(instance, "_GetElapsedTime", return_value="fake_time") @@ -266,36 +261,33 @@ class InstanceTest(driver_test_lib.BaseDriverTest): return_value="fake_project") self.Patch(gcompute_client, "GetGCEHostName", return_value="fake_hostname") forwarded_ports = instance.RemoteInstance( - mock.MagicMock()).GetForwardedPortsFromSSHTunnel( + mock.MagicMock()).GetAdbVncPortFromSSHTunnel( "1.1.1.1", "fake_hostname", constants.TYPE_CF) self.assertEqual(54321, forwarded_ports.adb_port) - self.assertEqual(6789, forwarded_ports.fastboot_port) self.assertEqual(12345, forwarded_ports.vnc_port) # If avd_type is undefined in utils.AVD_PORT_DICT. forwarded_ports = instance.RemoteInstance( - mock.MagicMock()).GetForwardedPortsFromSSHTunnel( + mock.MagicMock()).GetAdbVncPortFromSSHTunnel( "1.1.1.1", "fake_hostname", "undefined_avd_type") self.assertEqual(None, forwarded_ports.adb_port) - self.assertEqual(None, forwarded_ports.fastboot_port) self.assertEqual(None, forwarded_ports.vnc_port) # pylint: disable=protected-access def testProcessGceInstance(self): """"Test process instance detail.""" fake_adb = 123456 - fake_fastboot = 654321 fake_vnc = 654321 - + forwarded_ports = collections.namedtuple("ForwardedPorts", + [constants.VNC_PORT, + constants.ADB_PORT]) self.Patch(instance.RemoteInstance, "_GetProjectName", return_value="fake_project") self.Patch( instance.RemoteInstance, - "GetForwardedPortsFromSSHTunnel", - return_value=ForwardedPorts(vnc_port=fake_vnc, - adb_port=fake_adb, - fastboot_port=fake_fastboot)) + "GetAdbVncPortFromSSHTunnel", + return_value=forwarded_ports(vnc_port=fake_vnc, adb_port=fake_adb)) self.Patch(utils, "GetWebrtcPortFromSSHTunnel", return_value="fake_webrtc_port") self.Patch(instance, "_GetElapsedTime", return_value="fake_time") @@ -325,8 +317,8 @@ class InstanceTest(driver_test_lib.BaseDriverTest): # test ssh_tunnel_is_connected will be false if ssh tunnel connection is not found self.Patch( instance.RemoteInstance, - "GetForwardedPortsFromSSHTunnel", - return_value=ForwardedPorts(vnc_port=None, adb_port=None, fastboot_port=None)) + "GetAdbVncPortFromSSHTunnel", + return_value=forwarded_ports(vnc_port=None, adb_port=None)) instance_info = instance.RemoteInstance(self.GCE_INSTANCE) self.assertFalse(instance_info.ssh_tunnel_is_connected) expected_full_name = "device serial: not connected (%s) elapsed time: %s" % ( @@ -336,17 +328,17 @@ class InstanceTest(driver_test_lib.BaseDriverTest): def testInstanceSummary(self): """Test instance summary.""" fake_adb = 123456 - fake_fastboot = 654321 fake_vnc = 654321 + forwarded_ports = collections.namedtuple("ForwardedPorts", + [constants.VNC_PORT, + constants.ADB_PORT]) self.Patch(instance.RemoteInstance, "_GetProjectName", return_value="fake_project") self.Patch( instance.RemoteInstance, - "GetForwardedPortsFromSSHTunnel", - return_value=ForwardedPorts(vnc_port=fake_vnc, - adb_port=fake_adb, - fastboot_port=fake_fastboot)) + "GetAdbVncPortFromSSHTunnel", + return_value=forwarded_ports(vnc_port=fake_vnc, adb_port=fake_adb)) self.Patch(utils, "GetWebrtcPortFromSSHTunnel", return_value=8443) self.Patch(instance, "_GetElapsedTime", return_value="fake_time") self.Patch(AdbTools, "IsAdbConnected", return_value=True) @@ -372,8 +364,8 @@ class InstanceTest(driver_test_lib.BaseDriverTest): self.Patch( instance.RemoteInstance, - "GetForwardedPortsFromSSHTunnel", - return_value=ForwardedPorts(vnc_port=None, adb_port=None, fastboot_port=None)) + "GetAdbVncPortFromSSHTunnel", + return_value=forwarded_ports(vnc_port=None, adb_port=None)) self.Patch(instance, "_GetElapsedTime", return_value="fake_time") self.Patch(AdbTools, "IsAdbConnected", return_value=False) remote_instance = instance.RemoteInstance(self.GCE_INSTANCE) @@ -441,10 +433,6 @@ class InstanceTest(driver_test_lib.BaseDriverTest): name, fullname, display, ip, adb_port=6666) self.assertEqual(ins_webrtc._GetAutoConnect(), constants.INS_KEY_ADB) - ins_webrtc = instance.Instance( - name, fullname, display, ip, fastboot_port=6666) - self.assertEqual(ins_webrtc._GetAutoConnect(), constants.INS_KEY_FASTBOOT) - ins_webrtc = instance.Instance(name, fullname, display, ip) self.assertEqual(ins_webrtc._GetAutoConnect(), None) diff --git a/list/list_test.py b/list/list_test.py index a5296577..45ea7b31 100644 --- a/list/list_test.py +++ b/list/list_test.py @@ -47,7 +47,7 @@ class ListTest(driver_test_lib.BaseDriverTest): self.Patch(instance.RemoteInstance, "_GetZoneName") self.Patch(instance.RemoteInstance, "_GetProjectName") self.Patch(instance, "GetInstanceIP", return_value=ssh.IP()) - self.Patch(instance.RemoteInstance, "GetForwardedPortsFromSSHTunnel") + self.Patch(instance.RemoteInstance, "GetAdbVncPortFromSSHTunnel") self.Patch(adb_tools, "AdbTools") self.Patch(adb_tools.AdbTools, "IsAdbConnected", return_value=False) self.Patch(auth, "CreateCredentials") diff --git a/public/actions/base_device_factory.py b/public/actions/base_device_factory.py index 8ac52720..d7021d19 100644 --- a/public/actions/base_device_factory.py +++ b/public/actions/base_device_factory.py @@ -62,18 +62,6 @@ class BaseDeviceFactory(): return [None] # pylint: disable=no-self-use - def GetFastbootPorts(self): - """Get Fastboot ports of the created devices. - - Subclasses should define this function if their ADB ports are not - constant. - - Returns: - The port numbers as a list of integers. - """ - return [None] - - # pylint: disable=no-self-use def GetVncPorts(self): """Get VNC ports of the created devices. diff --git a/public/actions/common_operations.py b/public/actions/common_operations.py index f7823121..890f799f 100644 --- a/public/actions/common_operations.py +++ b/public/actions/common_operations.py @@ -208,8 +208,8 @@ def _GetErrorType(error): # pylint: disable=too-many-locals,unused-argument,too-many-branches,too-many-statements def CreateDevices(command, cfg, device_factory, num, avd_type, - report_internal_ip=False, autoconnect=False, serial_log_file=None, - client_adb_port=None, client_fastboot_port=None, + report_internal_ip=False, autoconnect=False, + serial_log_file=None, client_adb_port=None, boot_timeout_secs=None, unlock_screen=False, wait_for_boot=True, connect_webrtc=False, ssh_private_key_path=None, @@ -231,7 +231,6 @@ def CreateDevices(command, cfg, device_factory, num, avd_type, serial_log_file: String, the file path to tar the serial logs. autoconnect: Boolean, whether to auto connect to device. client_adb_port: Integer, Specify port for adb forwarding. - client_fastboot_port: Integer, Specify port for fastboot forwarding. boot_timeout_secs: Integer, boot timeout secs. unlock_screen: Boolean, whether to unlock screen after invoke vnc client. wait_for_boot: Boolean, True to check serial log include boot up @@ -277,9 +276,8 @@ def CreateDevices(command, cfg, device_factory, num, avd_type, # TODO(b/154175542): Report multiple devices. vnc_ports = device_factory.GetVncPorts() adb_ports = device_factory.GetAdbPorts() - fastboot_ports = device_factory.GetFastbootPorts() - if not vnc_ports[0] and not adb_ports[0] and not fastboot_ports[0]: - vnc_ports[0], adb_ports[0], fastboot_ports[0] = utils.AVD_PORT_DICT[avd_type] + if not vnc_ports[0] and not adb_ports[0]: + vnc_ports[0], adb_ports[0] = utils.AVD_PORT_DICT[avd_type] device_dict = { "ip": ip + (":" + str(adb_ports[0]) if adb_ports[0] else ""), @@ -298,10 +296,9 @@ def CreateDevices(command, cfg, device_factory, num, avd_type, extra_args_ssh_tunnel) extra_args_ssh_tunnel="" if autoconnect and reporter.status == report.Status.SUCCESS: - forwarded_ports = _EstablishDeviceConnections( - device.gce_hostname or ip, - vnc_ports, adb_ports, fastboot_ports, - client_adb_port, client_fastboot_port, ssh_user, + forwarded_ports = _EstablishAdbVncConnections( + device.gce_hostname or ip, vnc_ports, adb_ports, + client_adb_port, ssh_user, ssh_private_key_path=(ssh_private_key_path or cfg.ssh_private_key_path), extra_args_ssh_tunnel=extra_args_ssh_tunnel, @@ -310,7 +307,6 @@ def CreateDevices(command, cfg, device_factory, num, avd_type, forwarded_port = forwarded_ports[0] device_dict[constants.VNC_PORT] = forwarded_port.vnc_port device_dict[constants.ADB_PORT] = forwarded_port.adb_port - device_dict[constants.FASTBOOT_PORT] = forwarded_port.fastboot_port device_dict[constants.DEVICE_SERIAL] = ( constants.REMOTE_INSTANCE_ADB_SERIAL % forwarded_port.adb_port) @@ -345,8 +341,7 @@ def CreateDevices(command, cfg, device_factory, num, avd_type, return reporter -def _EstablishDeviceConnections(ip, vnc_ports, adb_ports, fastboot_ports, - client_adb_port, client_fastboot_port, +def _EstablishAdbVncConnections(ip, vnc_ports, adb_ports, client_adb_port, ssh_user, ssh_private_key_path, extra_args_ssh_tunnel, unlock_screen): """Establish the adb and vnc connections. @@ -358,9 +353,7 @@ def _EstablishDeviceConnections(ip, vnc_ports, adb_ports, fastboot_ports, ip: String, the IPv4 address. vnc_ports: List of integer, the vnc ports. adb_ports: List of integer, the adb ports. - fastboot_ports: List of integer, the fastboot ports. client_adb_port: Integer, Specify port for adb forwarding. - client_fastboot_port: Integer, Specify port for fastboot forwarding. ssh_user: String, the user name for SSH tunneling. ssh_private_key_path: String, the private key for SSH tunneling. extra_args_ssh_tunnel: String, extra args for ssh tunnel connection. @@ -370,16 +363,14 @@ def _EstablishDeviceConnections(ip, vnc_ports, adb_ports, fastboot_ports, A list of namedtuple of (vnc_port, adb_port) """ forwarded_ports = [] - for vnc_port, adb_port, fastboot_port in zip(vnc_ports, adb_ports, fastboot_ports): + for vnc_port, adb_port in zip(vnc_ports, adb_ports): forwarded_port = utils.AutoConnect( ip_addr=ip, rsa_key_file=ssh_private_key_path, target_vnc_port=vnc_port, target_adb_port=adb_port, - target_fastboot_port=fastboot_port, ssh_user=ssh_user, client_adb_port=client_adb_port, - client_fastboot_port=client_fastboot_port, extra_args_ssh_tunnel=extra_args_ssh_tunnel) forwarded_ports.append(forwarded_port) if unlock_screen: diff --git a/public/actions/common_operations_test.py b/public/actions/common_operations_test.py index 45a3d314..51bb2289 100644 --- a/public/actions/common_operations_test.py +++ b/public/actions/common_operations_test.py @@ -72,7 +72,6 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): return_value=self.compute_client) self.Patch(self.device_factory, "GetVncPorts", return_value=[6444]) self.Patch(self.device_factory, "GetAdbPorts", return_value=[6520]) - self.Patch(self.device_factory, "GetFastbootPorts", return_value=[7520]) self.Patch(self.device_factory, "GetBuildInfoDict", return_value={"branch": self.BRANCH, "build_id": self.BUILD_ID, @@ -125,9 +124,9 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): "logs": self.LOGS }]}) - def testCreateDevicesWithAdbAndFastbootPorts(self): + def testCreateDevicesWithAdbPort(self): """Test Create Devices with adb port for cuttlefish avd type.""" - forwarded_ports = mock.Mock(adb_port=12345, fastboot_port=54321, vnc_port=56789) + forwarded_ports = mock.Mock(adb_port=12345, vnc_port=56789) mock_auto_connect = self.Patch(utils, "AutoConnect", return_value=forwarded_ports) cfg = self._CreateCfg() @@ -135,13 +134,12 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): self.device_factory, 1, "cuttlefish", autoconnect=True, - client_adb_port=12345, - client_fastboot_port=54321) + client_adb_port=12345) mock_auto_connect.assert_called_with( ip_addr="127.0.0.1", rsa_key_file="cfg/private/key", - target_vnc_port=6444, target_adb_port=6520, target_fastboot_port=7520, - ssh_user=constants.GCE_USER, client_adb_port=12345, client_fastboot_port=54321, + target_vnc_port=6444, target_adb_port=6520, + ssh_user=constants.GCE_USER, client_adb_port=12345, extra_args_ssh_tunnel="extra args") self.assertEqual(_report.command, self.CMD) self.assertEqual(_report.status, report.Status.SUCCESS) @@ -153,7 +151,6 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): "branch": self.BRANCH, "build_id": self.BUILD_ID, "adb_port": 12345, - "fastboot_port": 54321, "device_serial": "127.0.0.1:12345", "vnc_port": 56789, "build_target": self.BUILD_TARGET, @@ -167,7 +164,6 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): forwarded_ports_2 = mock.Mock(adb_port=23456, vnc_port=67890) self.Patch(self.device_factory, "GetVncPorts", return_value=[6444, 6445]) self.Patch(self.device_factory, "GetAdbPorts", return_value=[6520, 6521]) - self.Patch(self.device_factory, "GetFastbootPorts", return_value=[7520, 7521]) self.Patch(utils, "PickFreePort", return_value=12345) mock_auto_connect = self.Patch( utils, "AutoConnect", side_effects=[forwarded_ports_1, @@ -181,13 +177,13 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): self.assertEqual(2, mock_auto_connect.call_count) mock_auto_connect.assert_any_call( ip_addr="127.0.0.1", rsa_key_file="cfg/private/key", - target_vnc_port=6444, target_adb_port=6520, target_fastboot_port=7520, - ssh_user=constants.GCE_USER, client_adb_port=None, client_fastboot_port=None, + target_vnc_port=6444, target_adb_port=6520, + ssh_user=constants.GCE_USER, client_adb_port=None, extra_args_ssh_tunnel="extra args") mock_auto_connect.assert_any_call( ip_addr="127.0.0.1", rsa_key_file="cfg/private/key", - target_vnc_port=6444, target_adb_port=6520, target_fastboot_port=7520, - ssh_user=constants.GCE_USER, client_adb_port=None, client_fastboot_port=None, + target_vnc_port=6445, target_adb_port=6521, + ssh_user=constants.GCE_USER, client_adb_port=None, extra_args_ssh_tunnel="extra args") self.assertEqual(_report.command, self.CMD) self.assertEqual(_report.status, report.Status.SUCCESS) @@ -215,7 +211,7 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): def testCreateDevicesWithSshParameters(self): """Test Create Devices with ssh user and key.""" - forwarded_ports = mock.Mock(adb_port=12345, fastboot_port=54321, vnc_port=56789) + forwarded_ports = mock.Mock(adb_port=12345, vnc_port=56789) mock_auto_connect = self.Patch(utils, "AutoConnect", return_value=forwarded_ports) mock_establish_webrtc = self.Patch(utils, "EstablishWebRTCSshTunnel") @@ -228,9 +224,8 @@ class CommonOperationsTest(driver_test_lib.BaseDriverTest): mock_auto_connect.assert_called_with( ip_addr="127.0.0.1", rsa_key_file="private/key", - target_vnc_port=6444, target_adb_port=6520, target_fastboot_port=7520, - ssh_user="user", client_adb_port=None, client_fastboot_port=None, - extra_args_ssh_tunnel="extra args") + target_vnc_port=6444, target_adb_port=6520, ssh_user="user", + client_adb_port=None, extra_args_ssh_tunnel="extra args") mock_establish_webrtc.assert_called_with( ip_addr="127.0.0.1", rsa_key_file="private/key", ssh_user="user", extra_args_ssh_tunnel="extra args", diff --git a/public/actions/remote_host_cf_device_factory.py b/public/actions/remote_host_cf_device_factory.py index 3322c128..82295b0a 100644 --- a/public/actions/remote_host_cf_device_factory.py +++ b/public/actions/remote_host_cf_device_factory.py @@ -474,15 +474,6 @@ class RemoteHostDeviceFactory(base_device_factory.BaseDeviceFactory): return cvd_utils.GetAdbPorts(self._avd_spec.base_instance_num, self._avd_spec.num_avds_per_instance) - def GetFastbootPorts(self): - """Get Fastboot ports of the created devices. - - Returns: - The port numbers as a list of integers. - """ - return cvd_utils.GetFastbootPorts(self._avd_spec.base_instance_num, - self._avd_spec.num_avds_per_instance) - def GetVncPorts(self): """Get VNC ports of the created devices. diff --git a/public/actions/remote_host_cf_device_factory_test.py b/public/actions/remote_host_cf_device_factory_test.py index bd80a8b5..87936c48 100644 --- a/public/actions/remote_host_cf_device_factory_test.py +++ b/public/actions/remote_host_cf_device_factory_test.py @@ -127,8 +127,6 @@ class RemoteHostDeviceFactoryTest(driver_test_lib.BaseDriverTest): mock_pull.PullLogs.assert_called_once() factory.GetAdbPorts() mock_cvd_utils.GetAdbPorts.assert_called_with(2, 3) - factory.GetFastbootPorts() - mock_cvd_utils.GetFastbootPorts.assert_called_with(2, 3) factory.GetVncPorts() mock_cvd_utils.GetVncPorts.assert_called_with(2, 3) self.assertEqual({"inst": "failure"}, factory.GetFailures()) @@ -175,8 +173,6 @@ class RemoteHostDeviceFactoryTest(driver_test_lib.BaseDriverTest): mock_pull.PullLogs.assert_not_called() factory.GetAdbPorts() mock_cvd_utils.GetAdbPorts.assert_called_with(None, None) - factory.GetFastbootPorts() - mock_cvd_utils.GetFastbootPorts.assert_called_with(None, None) factory.GetVncPorts() mock_cvd_utils.GetVncPorts.assert_called_with(None, None) self.assertFalse(factory.GetFailures()) @@ -228,8 +224,6 @@ class RemoteHostDeviceFactoryTest(driver_test_lib.BaseDriverTest): mock_pull.PullLogs.assert_not_called() factory.GetAdbPorts() mock_cvd_utils.GetAdbPorts.assert_called_with(None, None) - factory.GetFastbootPorts() - mock_cvd_utils.GetFastbootPorts.assert_called_with(None, None) factory.GetVncPorts() mock_cvd_utils.GetVncPorts.assert_called_with(None, None) self.assertFalse(factory.GetFailures()) diff --git a/public/actions/remote_host_gf_device_factory_test.py b/public/actions/remote_host_gf_device_factory_test.py index a6cbe01d..9fd54b0e 100644 --- a/public/actions/remote_host_gf_device_factory_test.py +++ b/public/actions/remote_host_gf_device_factory_test.py @@ -159,7 +159,6 @@ class RemoteHostGoldfishDeviceFactoryTest(driver_test_lib.BaseDriverTest): self.assertEqual(self._X86_64_INSTANCE_NAME, instance_name) self.assertEqual(self._X86_64_BUILD_INFO, factory.GetBuildInfoDict()) self.assertEqual([5555], factory.GetAdbPorts()) - self.assertEqual([None], factory.GetFastbootPorts()) self.assertEqual([None], factory.GetVncPorts()) self.assertEqual({}, factory.GetFailures()) self.assertEqual({instance_name: self._LOGS}, factory.GetLogs()) diff --git a/public/actions/remote_instance_cf_device_factory.py b/public/actions/remote_instance_cf_device_factory.py index f8ea2eb8..b6259997 100644 --- a/public/actions/remote_instance_cf_device_factory.py +++ b/public/actions/remote_instance_cf_device_factory.py @@ -217,15 +217,6 @@ class RemoteInstanceDeviceFactory(gce_device_factory.GCEDeviceFactory): return cvd_utils.GetAdbPorts(self._avd_spec.base_instance_num, self._avd_spec.num_avds_per_instance) - def GetFastbootPorts(self): - """Get Fastboot ports of the created devices. - - Returns: - The port numbers as a list of integers. - """ - return cvd_utils.GetFastbootPorts(self._avd_spec.base_instance_num, - self._avd_spec.num_avds_per_instance) - def GetVncPorts(self): """Get VNC ports of the created devices. diff --git a/public/actions/remote_instance_cf_device_factory_test.py b/public/actions/remote_instance_cf_device_factory_test.py index 28038416..ecd24857 100644 --- a/public/actions/remote_instance_cf_device_factory_test.py +++ b/public/actions/remote_instance_cf_device_factory_test.py @@ -124,7 +124,6 @@ class RemoteInstanceDeviceFactoryTest(driver_test_lib.BaseDriverTest): args.flavor = "phone" args.local_image = constants.FIND_IN_BUILD_ENV args.adb_port = None - args.fastboot_port = None args.launch_args = None fake_avd_spec = avd_spec.AVDSpec(args) fake_avd_spec.cfg.enable_multi_stage = True @@ -168,7 +167,6 @@ class RemoteInstanceDeviceFactoryTest(driver_test_lib.BaseDriverTest): args.flavor = "phone" args.local_image = constants.FIND_IN_BUILD_ENV args.adb_port = None - args.fastboot_port = None args.launch_args = None fake_avd_spec = avd_spec.AVDSpec(args) fake_avd_spec.cfg.enable_multi_stage = True @@ -199,7 +197,6 @@ class RemoteInstanceDeviceFactoryTest(driver_test_lib.BaseDriverTest): args.flavor = "phone" args.local_image = "fake_local_image" args.adb_port = None - args.fastboot_port = None args.cheeps_betty_image = None args.launch_args = None avd_spec_local_image = avd_spec.AVDSpec(args) @@ -272,8 +269,6 @@ class RemoteInstanceDeviceFactoryTest(driver_test_lib.BaseDriverTest): mock_cvd_utils.GetAdbPorts.assert_called_with(None, None) factory.GetVncPorts() mock_cvd_utils.GetVncPorts.assert_called_with(None, None) - factory.GetFastbootPorts() - mock_cvd_utils.GetFastbootPorts.assert_called_with(None, None) self.assertEqual({"instance": "failure"}, factory.GetFailures()) self.assertEqual(2, len(factory.GetLogs().get("instance"))) diff --git a/public/actions/remote_instance_fvp_device_factory_test.py b/public/actions/remote_instance_fvp_device_factory_test.py index 86c9ba17..d6899127 100644 --- a/public/actions/remote_instance_fvp_device_factory_test.py +++ b/public/actions/remote_instance_fvp_device_factory_test.py @@ -65,7 +65,6 @@ class RemoteInstanceDeviceFactoryTest(driver_test_lib.BaseDriverTest): args.local_image = "fake_local_image" args.local_system_image = None args.adb_port = None - args.fastboot_port = None args.launch_args = None avd_spec_local_image = avd_spec.AVDSpec(args) factory = remote_instance_fvp_device_factory.RemoteInstanceDeviceFactory( diff --git a/public/device_driver.py b/public/device_driver.py index ac680512..9cb38b0d 100755 --- a/public/device_driver.py +++ b/public/device_driver.py @@ -406,7 +406,6 @@ def CreateGCETypeAVD(cfg, target_adb_port=constants.GCE_ADB_PORT, ssh_user=_SSH_USER, client_adb_port=avd_spec.client_adb_port, - client_fastboot_port=avd_spec.client_fastboot_port, extra_args_ssh_tunnel=cfg.extra_args_ssh_tunnel) device_dict[constants.VNC_PORT] = forwarded_ports.vnc_port device_dict[constants.ADB_PORT] = forwarded_ports.adb_port diff --git a/reconnect/reconnect.py b/reconnect/reconnect.py index 5ab55b0f..33f67eaf 100644 --- a/reconnect/reconnect.py +++ b/reconnect/reconnect.py @@ -127,7 +127,7 @@ def ReconnectInstance(ssh_private_key_path, """Reconnect to the specified instance. It will: - - re-establish ssh tunnels for adb/fastboot/vnc port forwarding + - re-establish ssh tunnels for adb/vnc port forwarding - re-establish adb connection - restart vnc client - update device information in reconnect_report @@ -156,7 +156,6 @@ def ReconnectInstance(ssh_private_key_path, adb_cmd = AdbTools(instance.adb_port) vnc_port = instance.vnc_port adb_port = instance.adb_port - fastboot_port = instance.fastboot_port webrtc_port = instance.webrtc_port # ssh tunnel is up but device is disconnected on adb if instance.ssh_tunnel_is_connected and not adb_cmd.IsAdbConnectionAlive(): @@ -170,12 +169,10 @@ def ReconnectInstance(ssh_private_key_path, rsa_key_file=ssh_private_key_path, target_vnc_port=utils.AVD_PORT_DICT[instance.avd_type].vnc_port, target_adb_port=utils.AVD_PORT_DICT[instance.avd_type].adb_port, - target_fastboot_port=utils.AVD_PORT_DICT[instance.avd_type].fastboot_port, ssh_user=constants.GCE_USER, extra_args_ssh_tunnel=extra_args_ssh_tunnel) vnc_port = forwarded_ports.vnc_port adb_port = forwarded_ports.adb_port - fastboot_port = forwarded_ports.fastboot_port if autoconnect is constants.INS_KEY_WEBRTC: if not instance.islocal: webrtc_port = utils.GetWebrtcPortFromSSHTunnel(instance.ip) @@ -196,14 +193,13 @@ def ReconnectInstance(ssh_private_key_path, constants.IP: instance.ip, constants.INSTANCE_NAME: instance.name, constants.VNC_PORT: vnc_port, - constants.ADB_PORT: adb_port, - constants.FASTBOOT_PORT: fastboot_port, + constants.ADB_PORT: adb_port } if adb_port and not instance.islocal: device_dict[constants.DEVICE_SERIAL] = ( constants.REMOTE_INSTANCE_ADB_SERIAL % adb_port) - if (vnc_port or webrtc_port) and adb_port and fastboot_port: + if (vnc_port or webrtc_port) and adb_port: reconnect_report.AddData(key="devices", value=device_dict) else: # We use 'ps aux' to grep adb/vnc fowarding port from ssh tunnel diff --git a/reconnect/reconnect_args.py b/reconnect/reconnect_args.py index bf5ec59f..04ca32ca 100644 --- a/reconnect/reconnect_args.py +++ b/reconnect/reconnect_args.py @@ -55,8 +55,7 @@ def GetReconnectArgParser(subparser): dest="autoconnect", required=False, choices=[constants.INS_KEY_VNC, constants.INS_KEY_ADB, - constants.INS_KEY_FASTBOOT, constants.INS_KEY_WEBRTC], - help="If need adb/fastboot/vnc/webrtc only, you can pass in 'adb', 'fastboot', " - "'vnc' or 'webrtc' only here.") + constants.INS_KEY_WEBRTC], + help="If need adb only, you can pass in 'adb' here.") return reconnect_parser diff --git a/reconnect/reconnect_test.py b/reconnect/reconnect_test.py index 0c768475..f15a368c 100644 --- a/reconnect/reconnect_test.py +++ b/reconnect/reconnect_test.py @@ -35,9 +35,7 @@ from acloud.reconnect import reconnect ForwardedPorts = collections.namedtuple("ForwardedPorts", - [constants.VNC_PORT, - constants.ADB_PORT, - constants.FASTBOOT_PORT]) + [constants.VNC_PORT, constants.ADB_PORT]) class ReconnectTest(driver_test_lib.BaseDriverTest): @@ -53,7 +51,6 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): instance_object.ip = "1.1.1.1" instance_object.islocal = False instance_object.adb_port = "8686" - instance_object.fastboot_port = "9686" instance_object.avd_type = "cuttlefish" self.Patch(subprocess, "check_call", return_value=True) self.Patch(utils, "LaunchVncClient") @@ -66,7 +63,6 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): constants.INSTANCE_NAME: "fake_name", constants.VNC_PORT: 6666, constants.ADB_PORT: "8686", - constants.FASTBOOT_PORT: "9686", constants.DEVICE_SERIAL: "127.0.0.1:8686" } @@ -95,14 +91,13 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): instance_object.vnc_port = 5555 extra_args_ssh_tunnel = None self.Patch(utils, "AutoConnect", - return_value=ForwardedPorts(vnc_port=11111, adb_port=22222, fastboot_port=33333)) + return_value=ForwardedPorts(vnc_port=11111, adb_port=22222)) reconnect.ReconnectInstance( ssh_private_key_path, instance_object, fake_report, autoconnect="vnc") utils.AutoConnect.assert_called_with(ip_addr=instance_object.ip, rsa_key_file=ssh_private_key_path, target_vnc_port=constants.CF_VNC_PORT, target_adb_port=constants.CF_ADB_PORT, - target_fastboot_port=constants.CF_FASTBOOT_PORT, ssh_user=constants.GCE_USER, extra_args_ssh_tunnel=extra_args_ssh_tunnel) utils.LaunchVncClient.assert_called_with(11111) @@ -111,7 +106,6 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): constants.INSTANCE_NAME: "fake_name", constants.VNC_PORT: 11111, constants.ADB_PORT: 22222, - constants.FASTBOOT_PORT: 33333, constants.DEVICE_SERIAL: "127.0.0.1:22222" } fake_report.AddData.assert_called_with(key="devices", value=fake_device_dict) @@ -127,7 +121,6 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): rsa_key_file=ssh_private_key_path, target_vnc_port=constants.CF_VNC_PORT, target_adb_port=constants.CF_ADB_PORT, - target_fastboot_port=constants.CF_FASTBOOT_PORT, ssh_user=constants.GCE_USER, extra_args_ssh_tunnel=extra_args_ssh_tunnel) utils.LaunchVncClient.assert_called_with(11111, "999", "777") @@ -135,15 +128,14 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): # test fail reconnect report. self.Patch(utils, "AutoConnect", - return_value=ForwardedPorts(vnc_port=None, adb_port=None, fastboot_port=None)) + return_value=ForwardedPorts(vnc_port=None, adb_port=None)) reconnect.ReconnectInstance( ssh_private_key_path, instance_object, fake_report, autoconnect="vnc") fake_device_dict = { constants.IP: "1.1.1.1", constants.INSTANCE_NAME: "fake_name", constants.VNC_PORT: None, - constants.ADB_PORT: None, - constants.FASTBOOT_PORT: None + constants.ADB_PORT: None } fake_report.AddData.assert_called_with(key="device_failing_reconnect", value=fake_device_dict) @@ -162,8 +154,7 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): constants.IP: "1.1.1.1", constants.INSTANCE_NAME: "fake_name", constants.VNC_PORT: 5555, - constants.ADB_PORT: "8686", - constants.FASTBOOT_PORT: "9686" + constants.ADB_PORT: "8686" } fake_report.AddData.assert_called_with(key="devices", value=fake_device_dict) @@ -245,7 +236,6 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): rsa_key_file=ssh_private_key_path, target_vnc_port=constants.GCE_VNC_PORT, target_adb_port=constants.GCE_ADB_PORT, - target_fastboot_port=None, ssh_user=constants.GCE_USER, extra_args_ssh_tunnel=None) reconnect.StartVnc.assert_called_once() @@ -259,7 +249,6 @@ class ReconnectTest(driver_test_lib.BaseDriverTest): rsa_key_file=ssh_private_key_path, target_vnc_port=constants.CF_VNC_PORT, target_adb_port=constants.CF_ADB_PORT, - target_fastboot_port=constants.CF_FASTBOOT_PORT, ssh_user=constants.GCE_USER, extra_args_ssh_tunnel=None) reconnect.StartVnc.assert_called_once() |