Remove obsolete files
COMMIT-QUEUE.ini was used with ChromeOS CQ.
HACKING is specific to buffet_client which is deleted.
test.json and main.cc are part of test daemon which is removed.
Change-Id: Ie9e20fb525eb57e1d4646a2e17fa491e5b9ab69f
diff --git a/buffet/COMMIT-QUEUE.ini b/buffet/COMMIT-QUEUE.ini
deleted file mode 100644
index f5a018a..0000000
--- a/buffet/COMMIT-QUEUE.ini
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Per-project Commit Queue settings.
-# Documentation: http://goo.gl/5J7oND
-
-[GENERAL]
-
-# Board-specific pre-cq
-pre-cq-configs: gizmo-pre-cq
diff --git a/buffet/HACKING b/buffet/HACKING
deleted file mode 100644
index 95c6193..0000000
--- a/buffet/HACKING
+++ /dev/null
@@ -1,147 +0,0 @@
-This file is intended for onboarding new SWEs hacking on buffet.
-
- A. Common workflows.
- B. Registering your DUT.
-
----
-A. COMMON WORKFLOWS
----
-
-Some common workflows for developing with buffet:
-
-# Tell portage that you'd like to make local changes to Buffet:
-cros_workon start --board=${BOARD} buffet
-
-# Edit files in platform2/buffet/
-vim ...
-
-# Compile and install those changes into the chroot:
-USE=buffet emerge-${BOARD} buffet
-
-# Compile and run buffet unittests
-USE=buffet FEATURES=test emerge-${BOARD} buffet
-
-# Deploy the most recently built version of buffet to a DUT:
-cros deploy --board=${BOARD} <remote host> buffet
-
-#To enable additional debug logging in buffet daemon, run it as:
-# buffet --v=<level>, where <level> is verbosity level of debug info:
-# 1 - enable additional tracing of internal object construction and destruction
-# 2 - add tracing of request and response data sent over HTTP (beware of
-# privacy concerns).
-# 3 - enable low-level CURL tracing for HTTP communication.
-buffet --v=2
-
----
-B. REGISTERING YOUR DUT
----
-
-This process in described in great detail at
-
- https://developers.google.com/cloud-devices/v1/dev-guides/getting-started/register
-
-but since these instructions are generic and comprehensive, here's
-exactly what you need to do to get started when working with
-buffet/Brillo, in ten simple steps.
-
-The word DUT in this context is meant as the device that you want to
-associate with the cloud - for most buffet/Brillo developers this will
-be a Chromebook or another embedded device. These notes assume you
-have shell access to the DUT and also have access to a normal Linux
-workstation with shell and browser access.
-
-1. Open an Incognito window in Chrome on your workstation, go to
-https://www.google.com and log in with your test google account (NEVER
-use @google.com credentials on DUTs). In the following we're using
-<GMAIL_TEST_ACCOUNT> which you should replace with whatever you're
-using, e.g. my-testing-account-xyz@gmail.com.
-
-2. First we need an Authorization Code for the test user. This is
-covered in more detail in
-
- https://developers.google.com/cloud-devices/v1/dev-guides/getting-started/authorizing#code
-
-but basically amounts to entering the following URL in the Incognito window
-
- https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/clouddevices&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=58855907228.apps.googleusercontent.com
-
-If you're not using the default buffet gcd-project, replace the
-client_id parameter in the URL with the one for the product you
-registered as per
-
- https://developers.google.com/cloud-devices/v1/dev-guides/getting-started/authorizing#setup
-
-3. The browser window should display a prompt saying that
-"clouddevicesclient" would like to "Manage your cloud device". Press
-the "Accept" button and write down the Authorization Code
-displayed. It should look something like this
-
- 4/J23qfSkXYFgF_0H7DCOtwS5O7HO69zF9LtnG9_ILIGA.QhJE9WLeqwcaJvIeHux6iLavlvowlwI
-
-4. Open a bash prompt on your Linux workstation and type the following
-
- export SETUP_USER=<GMAIL_TEST_ACCOUNT>
- export SETUP_CODE=4/J23qfSkXYFgF_0H7DCOtwS5O7HO69zF9LtnG9_ILIGA.QhJE9WLeqwcaJvIeHux6iLavlvowlwI
- export SETUP_CLIENT_ID=58855907228.apps.googleusercontent.com
- export SETUP_CLIENT_SECRET=eHSAREAHrIqPsHBxCE9zPPBi
-
-replacing the values for SETUP_USER and SETUP_CODE as
-appropriate. Again, if you're not using the default buffet gcd-project
-replace the values SETUP_CLIENT_ID and SETUP_CLIENT_SECRET as
-appropriate.
-
-5. Now we can get an Access Token. Run the following command from the shell:
-
- curl -d "code=${SETUP_CODE}&client_id=${SETUP_CLIENT_ID}&client_secret=${SETUP_CLIENT_SECRET}&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" https://accounts.google.com/o/oauth2/token
-
-It should print out something like this:
-
- {
- "access_token" : "ya29.HQE<...>",
- "token_type" : "Bearer",
- "expires_in" : 3600,
- "refresh_token" : "1/iMq4<...>"
- }
-
-6. Export the access token in the shell:
-
- export SETUP_ACCESS_TOKEN=ya29.HQE<...>
-
-7. Now we can get the Registration Ticket Id for the device. Run the following
-
- curl --header "Authorization: Bearer ${SETUP_ACCESS_TOKEN}" --header "Content-Type: application/json; charset=UTF-8" --data "{ \"userEmail\": \"${SETUP_USER}\" }" https://www.googleapis.com/clouddevices/v1/registrationTickets
-
-It should print out something like this
-
- {
- "kind": "clouddevices#registrationTicket",
- "id": "453f1139-bd<...>",
- "deviceId": "77500a3f-458b-<...>",
- "userEmail": "<GMAIL_TEST_ACCOUNT>",
- "creationTimeMs": "1424193538212",
- "expirationTimeMs": "1424193778212"
- }
-
-8. Now, open a shell on the DUT and export the following
-
- export DUT_SETUP_TICKET_ID=453f1139-bd<...>
-
-9. Run the following command on the DUT shell
-
- buffet_client RegisterDevice ticket_id=${DUT_SETUP_TICKET_ID}
-
-appropriate. If you're not using the default buffet gcd-project you
-also need to pass other parameters such as client_id, client_secret
-and api_key.
-
-It should succeed and print the device-id
-
- Device registered: 77500a3f-458b-<...>
-
-10. The registered DUT should now show up in the Google account that
-you associated it with. In the Incognito window opened in step 1, go
-to
-
- https://security.google.com/settings/security/permissions
-
-where you can e.g. revoke access to the device.
diff --git a/buffet/etc/weaved/commands/test.json b/buffet/etc/weaved/commands/test.json
deleted file mode 100644
index 911d8f0..0000000
--- a/buffet/etc/weaved/commands/test.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "base": {
- "_jump": {
- "parameters": {
- "_height": "integer"
- },
- "progress": {
- "progress": {
- "type": "integer",
- "minimum": 0,
- "maximum": 100,
- "isRequired": true
- }
- }
- }
- }
-}
diff --git a/buffet/test_daemon/main.cc b/buffet/test_daemon/main.cc
deleted file mode 100644
index afb4cee..0000000
--- a/buffet/test_daemon/main.cc
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2014 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This is a sample daemon that "handles" Buffet commands.
-// It just prints the information about the command received to stdout and
-// marks the command as processed.
-
-#include <string>
-#include <sysexits.h>
-
-#include <base/bind.h>
-#include <base/command_line.h>
-#include <base/format_macros.h>
-#include <base/json/json_writer.h>
-#include <base/values.h>
-#include <brillo/daemons/dbus_daemon.h>
-#include <brillo/map_utils.h>
-#include <brillo/strings/string_utils.h>
-#include <brillo/syslog_logging.h>
-
-#include "buffet/dbus-proxies.h"
-
-namespace {
-
-std::unique_ptr<base::DictionaryValue> DictionaryToJson(
- const brillo::VariantDictionary& dictionary);
-
-std::unique_ptr<base::Value> AnyToJson(const brillo::Any& value) {
- if (value.IsTypeCompatible<brillo::VariantDictionary>())
- return DictionaryToJson(value.Get<brillo::VariantDictionary>());
-
- if (value.IsTypeCompatible<std::string>()) {
- return std::unique_ptr<base::Value>{
- new base::StringValue(value.Get<std::string>())};
- }
-
- if (value.IsTypeCompatible<double>()) {
- return std::unique_ptr<base::Value>{
- new base::FundamentalValue(value.Get<double>())};
- }
-
- if (value.IsTypeCompatible<bool>()) {
- return std::unique_ptr<base::Value>{
- new base::FundamentalValue(value.Get<bool>())};
- }
-
- if (value.IsTypeCompatible<int>()) {
- return std::unique_ptr<base::Value>{
- new base::FundamentalValue(value.Get<int>())};
- }
-
- LOG(FATAL) << "Unsupported type:" << value.GetType().name();
- return {};
-}
-
-std::unique_ptr<base::DictionaryValue> DictionaryToJson(
- const brillo::VariantDictionary& dictionary) {
- std::unique_ptr<base::DictionaryValue> result{new base::DictionaryValue};
- for (const auto& it : dictionary)
- result->Set(it.first, AnyToJson(it.second).release());
- return result;
-}
-
-std::string DictionaryToString(const brillo::VariantDictionary& dictionary) {
- std::unique_ptr<base::DictionaryValue> json{DictionaryToJson(dictionary)};
- std::string str;
- base::JSONWriter::Write(*json, &str);
- return str;
-}
-
-} // anonymous namespace
-
-class Daemon final : public brillo::DBusDaemon {
- public:
- Daemon() = default;
-
- protected:
- int OnInit() override;
- void OnShutdown(int* return_code) override;
-
- private:
- std::unique_ptr<com::android::Weave::ObjectManagerProxy> object_manager_;
-
- void OnBuffetCommand(com::android::Weave::CommandProxy* command);
- void OnBuffetCommandRemoved(const dbus::ObjectPath& object_path);
- void OnPropertyChange(com::android::Weave::CommandProxy* command,
- const std::string& property_name);
- void OnCommandProgress(com::android::Weave::CommandProxy* command,
- int progress);
-
- DISALLOW_COPY_AND_ASSIGN(Daemon);
-};
-
-int Daemon::OnInit() {
- int return_code = brillo::DBusDaemon::OnInit();
- if (return_code != EX_OK)
- return return_code;
-
- object_manager_.reset(new com::android::Weave::ObjectManagerProxy{bus_});
- object_manager_->SetCommandAddedCallback(
- base::Bind(&Daemon::OnBuffetCommand, base::Unretained(this)));
- object_manager_->SetCommandRemovedCallback(
- base::Bind(&Daemon::OnBuffetCommandRemoved, base::Unretained(this)));
-
- printf("Waiting for commands...\n");
- return EX_OK;
-}
-
-void Daemon::OnShutdown(int* return_code) {
- printf("Shutting down...\n");
-}
-
-void Daemon::OnPropertyChange(com::android::Weave::CommandProxy* command,
- const std::string& property_name) {
- printf("Notification: property '%s' on command '%s' changed.\n",
- property_name.c_str(), command->id().c_str());
- printf(" Current command status: '%s'\n", command->status().c_str());
- std::string progress = DictionaryToString(command->progress());
- printf(" Current command progress: %s\n", progress.c_str());
- std::string results = DictionaryToString(command->results());
- printf(" Current command results: %s\n", results.c_str());
-}
-
-void Daemon::OnBuffetCommand(com::android::Weave::CommandProxy* command) {
- // "Handle" only commands that belong to this daemon's category.
- if (command->status() == "done")
- return;
-
- command->SetPropertyChangedCallback(base::Bind(&Daemon::OnPropertyChange,
- base::Unretained(this)));
- printf("++++++++++++++++++++++++++++++++++++++++++++++++\n");
- printf("Command received: %s\n", command->name().c_str());
- printf("DBus Object Path: %s\n", command->GetObjectPath().value().c_str());
- printf(" ID: %s\n", command->id().c_str());
- printf(" status: %s\n", command->status().c_str());
- printf(" origin: %s\n", command->origin().c_str());
- std::string param_names = DictionaryToString(command->parameters());
- printf(" parameters: %s\n", param_names.c_str());
- OnCommandProgress(command, 0);
-}
-
-void Daemon::OnCommandProgress(com::android::Weave::CommandProxy* command,
- int progress) {
- printf("Updating command '%s' progress to %d%%\n", command->id().c_str(),
- progress);
- auto new_progress = command->progress();
- new_progress["progress"] = progress;
- command->SetProgress(new_progress, nullptr);
-
- if (progress >= 100) {
- command->Done(nullptr);
- } else {
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE, base::Bind(&Daemon::OnCommandProgress,
- base::Unretained(this), command, progress + 10),
- base::TimeDelta::FromSeconds(1));
- }
-}
-
-void Daemon::OnBuffetCommandRemoved(const dbus::ObjectPath& object_path) {
- printf("------------------------------------------------\n");
- printf("Command removed\n");
- printf("DBus Object Path: %s\n", object_path.value().c_str());
-}
-
-int main(int argc, char* argv[]) {
- base::CommandLine::Init(argc, argv);
- brillo::InitLog(brillo::kLogToSyslog |
- brillo::kLogToStderr |
- brillo::kLogHeader);
- Daemon daemon;
- return daemon.Run();
-}