[autotest] Remove Brillo v1 update code.
The BrilloUpdater/BrilloTestPlatform implementation was for version one
of Brillo. This is no longer in use. Confirmed by Brillo Test Engineer.
As part of autoupdate_EndToEndTest rewrite, I will remove this code.
BUG=chromium:709710
TEST=test_that chromeos2-row3-rack10-host13.cros autoupdate_EndToEndTest
Change-Id: I7a5500ea14c33fde7d4cc998d1f536130868e371
Reviewed-on: https://chromium-review.googlesource.com/538915
Commit-Ready: David Haddock <dhaddock@chromium.org>
Tested-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index 5803577..3a36557 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -35,10 +35,6 @@
"""Generic error for ChromiumOS-specific exceptions."""
-class BrilloError(error.InstallError):
- """Generic error for Brillo-specific exceptions."""
-
-
class RootFSUpdateError(ChromiumOSError):
"""Raised when the RootFS fails to update."""
@@ -736,15 +732,3 @@
'within %d seconds' % (event,
self.KERNEL_UPDATE_TIMEOUT))
-
-class BrilloUpdater(BaseUpdater):
- """Helper class for updating a Brillo DUT."""
-
- def __init__(self, update_url, host=None):
- """Initialize the object.
-
- @param update_url: The URL we want the update to use.
- @param host: A client.common_lib.hosts.Host implementation.
- """
- super(BrilloUpdater, self).__init__(
- '/system/bin/update_engine_client', update_url, host)
diff --git a/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py b/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py
index 351af74..3535500 100755
--- a/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py
+++ b/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py
@@ -710,8 +710,6 @@
os_type = host.get_os_type()
if os_type in ('cros', 'moblab'):
return ChromiumOSTestPlatform(host)
- if os_type == 'brillo':
- return BrilloTestPlatform(host)
raise error.TestError('Unknown OS type reported by host: %s' % os_type)
@@ -1223,195 +1221,6 @@
return self._host.oobe_triggers_update()
-class BrilloTestPlatform(TestPlatform):
- """A TestPlatform implementation for Brillo."""
-
- _URL_DEFAULT_PORT = 80
- _DUT_LOCALHOST = '127.0.0.1'
-
- def __init__(self, host):
- self._host = host
- self._autotest_devserver = None
- self._devserver_dir = None
- self._staged_urls = None
- self._forwarding_ports = set()
-
-
- @classmethod
- def _get_host_port(cls, url):
- """Returns the host and port values from a given URL.
-
- @param url: The URL from which the values are extracted.
-
- @return A pair consisting of the host and port strings.
- """
- host, _, port = urlparse.urlsplit(url).netloc.partition(':')
- return host, port or str(cls._URL_DEFAULT_PORT)
-
-
- def _install_rev_forwarding(self, port=None):
- """Installs reverse forwarding rules via ADB.
-
- @param port: The TCP port we want forwarded; if None, installs all
- previously configured ports.
- """
- ports = self._forwarding_ports if port is None else [port]
- for port in ports:
- port_spec = 'tcp:%s' % port
- self._host.add_forwarding(port_spec, port_spec, reverse=True)
-
-
- def _add_rev_forwarding(self, url):
- """Configures reverse port forwarding and adjusts the given URL.
-
- This extracts the port from the URL, adds it to the set of configured
- forwarding ports, installs it to the DUT, then returns the adjusted URL
- for use by the DUT.
-
- @param url: The URL for which we need to establish forwarding.
-
- @return: The adjusted URL for use on the DUT.
- """
- if url:
- host, port = self._get_host_port(url)
- if port not in self._forwarding_ports:
- self._forwarding_ports.add(port)
- self._install_rev_forwarding(port=port)
- url = url.replace(host, self._DUT_LOCALHOST, 1)
- return url
-
-
- def _remove_rev_forwarding(self, url=None):
- """Removes a reverse port forwarding.
-
- @param url: The URL for which forwarding was established; if None,
- removes all previously configured ports.
- """
- ports = set()
- if url is None:
- ports.update(self._forwarding_ports)
- else:
- _, port = self._get_host_port(url)
- if port in self._forwarding_ports:
- ports.add(port)
-
- # TODO(garnold) Enable once ADB port removal is fixed (b/24771474):
- # for port in ports:
- # self._host.remove_forwarding(src='tcp:%s' % port, reverse=True)
-
- self._forwarding_ports.difference_update(ports)
-
-
- def _install_source_version(self, devserver_hostname, payload_url):
- """Installs a source version onto the test device.
-
- @param devserver_hostname: Redirect updates through this host.
- @param payload_url: URL of staged payload for installing a source image.
- """
- try:
- # Start a private Omaha server and update the DUT.
- temp_devserver = None
- url = None
- try:
- temp_devserver = OmahaDevserver(
- devserver_hostname, self._devserver_dir, payload_url)
- temp_devserver.start_devserver()
- url = self._add_rev_forwarding(temp_devserver.get_update_url())
- updater = autoupdater.BrilloUpdater(url, host=self._host)
- updater.update_image()
- finally:
- if url:
- self._remove_rev_forwarding(url)
- if temp_devserver:
- temp_devserver.stop_devserver()
-
- # Reboot the DUT.
- self.reboot_device()
- except OmahaDevserverFailedToStart as e:
- logging.fatal('Failed to start private devserver for installing '
- 'the source payload (%s) on the DUT', payload_url)
- raise error.TestError(
- 'Failed to start private devserver for installing the '
- 'source image on the DUT: %s' % e)
- except error.AutoservRunError as e:
- logging.fatal('Error re-imaging or rebooting the DUT with the '
- 'source image from %s', payload_url)
- raise error.TestError('Failed to install the source image or '
- 'reboot the DUT: %s' % e)
-
-
- # Interface overrides.
- #
- def initialize(self, autotest_devserver, devserver_dir):
- self._autotest_devserver = autotest_devserver
- self._devserver_dir = devserver_dir
-
-
- def reboot_device(self):
- self._host.reboot()
- self._install_rev_forwarding()
-
-
- def prep_artifacts(self, test_conf):
- # TODO(garnold) Currently we don't stage anything and assume that the
- # provided URLs are of pre-staged payloads. We should implement staging
- # support once a release scheme for Brillo is finalized.
- self._staged_urls = self.StagedURLs(
- self._add_rev_forwarding(test_conf['source_payload_uri']), None,
- self._add_rev_forwarding(test_conf['target_payload_uri']), None)
- return self._staged_urls
-
-
- def prep_device_for_update(self, source_release):
- # Install the source version onto the DUT.
- if self._staged_urls.source_url:
- logging.info('Installing a source image on the DUT')
- devserver_hostname = urlparse.urlparse(
- self._autotest_devserver.url()).hostname
- self._install_source_version(devserver_hostname,
- self._staged_urls.source_url)
-
-
- def get_active_slot(self):
- return self._host.run('rootdev -s /system').stdout.strip()
-
-
- def start_update_perf(self, bindir):
- pass
-
-
- def stop_update_perf(self):
- pass
-
-
- def trigger_update(self, omaha_devserver):
- url = self._add_rev_forwarding(omaha_devserver.get_update_url())
- updater = autoupdater.BrilloUpdater(url, host=self._host)
- updater.trigger_update()
-
-
- def finalize_update(self):
- pass
-
-
- def get_update_log(self, num_lines):
- return self._host.run_output(
- 'logcat -d -s update_engine | tail -n %d' % num_lines,
- stdout_tee=None)
-
-
- def check_device_after_update(self, target_release):
- self._remove_rev_forwarding()
- # TODO(garnold) Port forwarding removal is broken in ADB (b/24771474).
- # Instead we reboot the device, which has the side-effect of flushing
- # all forwarding rules. Once fixed, the following should be removed.
- self.reboot_device()
-
-
- def oobe_triggers_update(self):
- return False
-
-
class autoupdate_EndToEndTest(test.test):
"""Complete update test between two Chrome OS releases.