Revert "[shill] Add hardware address to Device objects."

This reverts commit 1f694d095374fddb9a258b376cffb54ed73981d5

forgot some files

Change-Id: Ifcf5e6551b993354f91fab1e4ef8d337917dfc15
Reviewed-on: http://gerrit.chromium.org/gerrit/6269
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/cellular.cc b/cellular.cc
index 548ac54..4618c06 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -102,7 +102,6 @@
                    EventDispatcher *dispatcher,
                    Manager *manager,
                    const string &link_name,
-                   const std::string &address,
                    int interface_index,
                    Type type,
                    const string &owner,
@@ -111,7 +110,6 @@
              dispatcher,
              manager,
              link_name,
-             address,
              interface_index),
       type_(type),
       state_(kStateDisabled),
diff --git a/cellular.h b/cellular.h
index 54f1aaa..a273d8a 100644
--- a/cellular.h
+++ b/cellular.h
@@ -119,7 +119,6 @@
            EventDispatcher *dispatcher,
            Manager *manager,
            const std::string &link_name,
-           const std::string &address,
            int interface_index,
            Type type,
            const std::string &owner,
diff --git a/cellular_unittest.cc b/cellular_unittest.cc
index df29dba..982430a 100644
--- a/cellular_unittest.cc
+++ b/cellular_unittest.cc
@@ -46,7 +46,6 @@
                              NULL,
                              NULL,
                              "usb0",
-                             "00:01:02:03:04:05",
                              3,
                              Cellular::kTypeGSM,
                              "",
@@ -122,7 +121,6 @@
                              &dispatcher_,
                              &manager_,
                              kTestDeviceName,
-                             kTestDeviceAddress,
                              3,
                              Cellular::kTypeGSM,
                              kDBusOwner,
@@ -171,7 +169,6 @@
   };
 
   static const char kTestDeviceName[];
-  static const char kTestDeviceAddress[];
   static const int kTestSocket;
   static const char kDBusOwner[];
   static const char kDBusPath[];
@@ -197,7 +194,6 @@
 };
 
 const char CellularTest::kTestDeviceName[] = "usb0";
-const char CellularTest::kTestDeviceAddress[] = "00:01:02:03:04:05";
 const int CellularTest::kTestSocket = 123;
 const char CellularTest::kDBusOwner[] = ":1.19";
 const char CellularTest::kDBusPath[] = "/org/chromium/ModemManager/Gobi/0";
diff --git a/dbus_adaptor_unittest.cc b/dbus_adaptor_unittest.cc
index 9c14ab0..082d9b9 100644
--- a/dbus_adaptor_unittest.cc
+++ b/dbus_adaptor_unittest.cc
@@ -55,7 +55,6 @@
                                &dispatcher_,
                                &manager_,
                                "mock",
-                               "addr0",
                                0)),
         service_(new MockService(&control_interface_,
                                  &dispatcher_,
diff --git a/device.cc b/device.cc
index 838f311..851c922 100644
--- a/device.cc
+++ b/device.cc
@@ -45,11 +45,9 @@
                EventDispatcher *dispatcher,
                Manager *manager,
                const string &link_name,
-               const string &address,
                int interface_index)
     : powered_(true),
       reconnect_(true),
-      hardware_address_(address),
       interface_index_(interface_index),
       running_(false),
       link_name_(link_name),
@@ -138,9 +136,6 @@
 string Device::GetStorageIdentifier() {
   string id = GetRpcIdentifier();
   ControlInterface::RpcIdToStorageId(&id);
-  size_t needle = id.find('_');
-  LOG_IF(ERROR, needle == string::npos) << "No _ in storage id?!?!";
-  id.replace(id.begin() + needle + 1, id.end(), hardware_address_);
   return id;
 }
 
diff --git a/device.h b/device.h
index 7f9fbfb..27fee74 100644
--- a/device.h
+++ b/device.h
@@ -23,6 +23,7 @@
 class ControlInterface;
 class DHCPProvider;
 class DeviceAdaptorInterface;
+class DeviceInfo;
 class Endpoint;
 class Error;
 class EventDispatcher;
@@ -46,7 +47,6 @@
          EventDispatcher *dispatcher,
          Manager *manager,
          const std::string &link_name,
-         const std::string &address,
          int interface_index);
   virtual ~Device();
 
@@ -109,9 +109,9 @@
                                   bool(Device::*set)(const Strings&));
 
   // Properties
+  std::string hardware_address_;
   bool powered_;  // TODO(pstew): Is this what |running_| is for?
   bool reconnect_;
-  const std::string hardware_address_;
 
   PropertyStore store_;
 
diff --git a/device_info.cc b/device_info.cc
index c7afe61..c6ba786 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -153,9 +153,6 @@
       infos_[dev_index].address = msg.GetAttribute(IFLA_ADDRESS);
       VLOG(2) << "link index " << dev_index << " address "
               << infos_[dev_index].address.HexEncode();
-    } else {
-      LOG(ERROR) << "Add Link message does not have IFLA_ADDRESS!";
-      return;
     }
     if (!msg.HasAttribute(IFLA_IFNAME)) {
       LOG(ERROR) << "Add Link message does not have IFLA_IFNAME!";
@@ -172,7 +169,7 @@
         technology = GetDeviceTechnology(link_name);
       }
     }
-    string address = infos_[dev_index].address.HexEncode();
+
     switch (technology) {
       case Device::kCellular:
         // Cellular devices are managed by ModemInfo.
@@ -181,15 +178,15 @@
         return;
       case Device::kEthernet:
         device = new Ethernet(control_interface_, dispatcher_, manager_,
-                              link_name, address, dev_index);
+                              link_name, dev_index);
         break;
       case Device::kWifi:
         device = new WiFi(control_interface_, dispatcher_, manager_,
-                          link_name, address, dev_index);
+                          link_name, dev_index);
         break;
       default:
         device = new DeviceStub(control_interface_, dispatcher_, manager_,
-                                link_name, address, dev_index, technology);
+                                link_name, dev_index, technology);
         break;
     }
     RegisterDevice(device);
diff --git a/device_info.h b/device_info.h
index 09271c6..f749669 100644
--- a/device_info.h
+++ b/device_info.h
@@ -39,8 +39,8 @@
   void RegisterDevice(const DeviceRefPtr &device);
 
   DeviceRefPtr GetDevice(int interface_index) const;
-  virtual bool GetAddress(int interface_index, ByteString *address) const;
-  virtual bool GetFlags(int interface_index, unsigned int *flags) const;
+  bool GetAddress(int interface_index, ByteString *address) const;
+  bool GetFlags(int interface_index, unsigned int *flags) const;
 
  private:
   friend class DeviceInfoTest;
diff --git a/device_info_unittest.cc b/device_info_unittest.cc
index 2001c56..3e76418 100644
--- a/device_info_unittest.cc
+++ b/device_info_unittest.cc
@@ -76,8 +76,6 @@
                                          IPAddress::kAddressFamilyIPv4);
   message->SetAttribute(static_cast<uint16>(IFLA_IFNAME),
                         ByteString(kTestDeviceName, true));
-  ByteString test_address(kTestAddress, sizeof(kTestAddress));
-  message->SetAttribute(IFLA_ADDRESS, test_address);
   return message;
 }
 
@@ -91,6 +89,8 @@
   scoped_ptr<RTNLMessage> message(BuildMessage(RTNLMessage::kMessageTypeLink,
                                                RTNLMessage::kMessageModeAdd));
   message->set_link_status(RTNLMessage::LinkStatus(0, IFF_LOWER_UP, 0));
+  ByteString test_address(kTestAddress, sizeof(kTestAddress));
+  message->SetAttribute(IFLA_ADDRESS, test_address);
   EXPECT_FALSE(device_info_.GetDevice(kTestDeviceIndex).get());
   SendMessageToDeviceInfo(*message);
   EXPECT_TRUE(device_info_.GetDevice(kTestDeviceIndex).get());
@@ -100,7 +100,7 @@
   ByteString address;
   EXPECT_TRUE(device_info_.GetAddress(kTestDeviceIndex, &address));
   EXPECT_FALSE(address.IsEmpty());
-  EXPECT_TRUE(address.Equals(ByteString(kTestAddress, sizeof(kTestAddress))));
+  EXPECT_TRUE(test_address.Equals(address));
 
   message.reset(BuildMessage(RTNLMessage::kMessageTypeLink,
                              RTNLMessage::kMessageModeAdd));
diff --git a/device_stub.h b/device_stub.h
index 4775097..9e45fa0 100644
--- a/device_stub.h
+++ b/device_stub.h
@@ -29,11 +29,10 @@
   DeviceStub(ControlInterface *control_interface,
              EventDispatcher *dispatcher,
              Manager *manager,
-             const std::string &link_name,
-             const std::string &address,
+             const std::string& link_name,
              int interface_index,
              Technology technology)
-      : Device(control_interface, dispatcher, manager, link_name, address,
+      : Device(control_interface, dispatcher, manager, link_name,
                interface_index),
         technology_(technology) {}
   void Start() {}
diff --git a/device_unittest.cc b/device_unittest.cc
index 604607e..8142277 100644
--- a/device_unittest.cc
+++ b/device_unittest.cc
@@ -35,32 +35,25 @@
 
 namespace shill {
 
+namespace {
+const char kDeviceName[] = "testdevice";
+}  // namespace {}
+
 class DeviceTest : public PropertyStoreTest {
  public:
   DeviceTest()
-      : device_(new Device(&control_interface_,
-                           NULL,
-                           NULL,
-                           kDeviceName,
-                           kDeviceAddress,
-                           0)) {
+      : device_(new Device(&control_interface_, NULL, NULL, kDeviceName, 0)) {
     DHCPProvider::GetInstance()->glib_ = &glib_;
     DHCPProvider::GetInstance()->control_interface_ = &control_interface_;
   }
   virtual ~DeviceTest() {}
 
  protected:
-  static const char kDeviceName[];
-  static const char kDeviceAddress[];
-
   MockGLib glib_;
   MockControl control_interface_;
   DeviceRefPtr device_;
 };
 
-const char DeviceTest::kDeviceName[] = "testdevice";
-const char DeviceTest::kDeviceAddress[] = "address";
-
 TEST_F(DeviceTest, Contains) {
   EXPECT_TRUE(device_->store()->Contains(flimflam::kNameProperty));
   EXPECT_FALSE(device_->store()->Contains(""));
diff --git a/ethernet.cc b/ethernet.cc
index 9b0b3f4..4cdedc9 100644
--- a/ethernet.cc
+++ b/ethernet.cc
@@ -30,13 +30,11 @@
                    EventDispatcher *dispatcher,
                    Manager *manager,
                    const string &link_name,
-                   const std::string &address,
                    int interface_index)
     : Device(control_interface,
              dispatcher,
              manager,
              link_name,
-             address,
              interface_index),
       service_registered_(false),
       service_(new EthernetService(control_interface,
diff --git a/ethernet.h b/ethernet.h
index c0ea433..9967e1c 100644
--- a/ethernet.h
+++ b/ethernet.h
@@ -19,7 +19,6 @@
            EventDispatcher *dispatcher,
            Manager *manager,
            const std::string& link_name,
-           const std::string &address,
            int interface_index);
   ~Ethernet();
 
diff --git a/manager.h b/manager.h
index 9a4aa47..5f6f925 100644
--- a/manager.h
+++ b/manager.h
@@ -65,8 +65,8 @@
   ServiceRefPtr FindService(const std::string& name);
   std::vector<std::string> EnumerateAvailableServices();
 
-  virtual DeviceInfo *device_info() { return &device_info_; }
-  virtual PropertyStore *store() { return &store_; }
+  DeviceInfo *device_info() { return &device_info_; }
+  PropertyStore *store() { return &store_; }
 
  private:
   friend class ManagerAdaptorInterface;
diff --git a/manager_unittest.cc b/manager_unittest.cc
index 2450c86..9cc7d5f 100644
--- a/manager_unittest.cc
+++ b/manager_unittest.cc
@@ -39,19 +39,16 @@
                                               &dispatcher_,
                                               &manager_,
                                               "null0",
-                                              "addr0",
                                               0)),
         mock_device2_(new NiceMock<MockDevice>(&control_interface_,
                                                &dispatcher_,
                                                &manager_,
                                                "null2",
-                                               "addr2",
                                                2)),
         mock_device3_(new NiceMock<MockDevice>(&control_interface_,
                                                &dispatcher_,
                                                &manager_,
                                                "null3",
-                                               "addr3",
                                                3)) {
   }
   virtual ~ManagerTest() {}
diff --git a/mock_device.cc b/mock_device.cc
index 4e5187a..bc69e94 100644
--- a/mock_device.cc
+++ b/mock_device.cc
@@ -23,13 +23,11 @@
                        EventDispatcher *dispatcher,
                        Manager *manager,
                        const std::string &link_name,
-                       const std::string &address,
                        int interface_index)
     : Device(control_interface,
              dispatcher,
              manager,
              link_name,
-             address,
              interface_index) {
   ON_CALL(*this, TechnologyIs(_)).WillByDefault(Return(false));
 }
diff --git a/mock_device.h b/mock_device.h
index f1205cf..2147bbc 100644
--- a/mock_device.h
+++ b/mock_device.h
@@ -23,7 +23,6 @@
              EventDispatcher *dispatcher,
              Manager *manager,
              const std::string &link_name,
-             const std::string &address,
              int interface_index);
   virtual ~MockDevice();
 
diff --git a/modem.cc b/modem.cc
index 4f38518..58cab52 100644
--- a/modem.cc
+++ b/modem.cc
@@ -84,14 +84,6 @@
     return;
   }
 
-  ByteString address_bytes;
-  if (!manager_->device_info()->GetAddress(interface_index, &address_bytes)) {
-    // TODO(petkov): ensure that DeviceInfo has heard about this device before
-    //               we go ahead and try to add it.
-    LOG(ERROR) << "Unable to create cellular device without a hardware addr.";
-    return;
-  }
-
   uint32 mm_type = kuint32max;
   Cellular::Type type;
   DBusProperties::GetUint32(properties, kPropertyType, &mm_type);
@@ -113,7 +105,6 @@
                          dispatcher_,
                          manager_,
                          link_name,
-                         address_bytes.HexEncode(),
                          interface_index,
                          type,
                          owner_,
diff --git a/modem_unittest.cc b/modem_unittest.cc
index 781c052..fb0b217 100644
--- a/modem_unittest.cc
+++ b/modem_unittest.cc
@@ -4,7 +4,6 @@
 
 #include <vector>
 
-#include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include <mm/mm-modem.h>
 #include <net/if.h>
@@ -13,10 +12,8 @@
 #include "shill/cellular.h"
 #include "shill/manager.h"
 #include "shill/mock_control.h"
-#include "shill/mock_device_info.h"
 #include "shill/mock_dbus_properties_proxy.h"
 #include "shill/mock_glib.h"
-#include "shill/mock_manager.h"
 #include "shill/mock_sockets.h"
 #include "shill/modem.h"
 #include "shill/proxy_factory.h"
@@ -28,7 +25,6 @@
 using testing::_;
 using testing::DoAll;
 using testing::Return;
-using testing::SetArgumentPointee;
 using testing::StrictMock;
 using testing::Test;
 
@@ -83,7 +79,7 @@
   MockGLib glib_;
   MockControl control_interface_;
   EventDispatcher dispatcher_;
-  MockManager manager_;
+  Manager manager_;
   scoped_ptr<MockDBusPropertiesProxy> proxy_;
   TestProxyFactory proxy_factory_;
   Modem modem_;
@@ -137,7 +133,6 @@
   EXPECT_FALSE(modem_.device_.get());
 
   static const char kLinkName[] = "usb0";
-  static const unsigned char kAddress[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
   const int kTestSocket = 10;
   props[Modem::kPropertyLinkName].writer().append_string(kLinkName);
   EXPECT_CALL(sockets_, Socket(PF_INET, SOCK_DGRAM, 0))
@@ -147,14 +142,6 @@
       .WillRepeatedly(DoAll(SetInterfaceIndex(), Return(0)));
   EXPECT_CALL(sockets_, Close(kTestSocket))
       .WillRepeatedly(Return(0));
-
-  ByteString expected_address(kAddress, arraysize(kAddress));
-  MockDeviceInfo info_(&control_interface_, &dispatcher_, &manager_);
-  EXPECT_CALL(info_, GetAddress(kTestInterfaceIndex, _))
-      .WillOnce(DoAll(SetArgumentPointee<1>(expected_address), Return(true)))
-      .WillOnce(DoAll(SetArgumentPointee<1>(expected_address), Return(true)));
-  EXPECT_CALL(manager_, device_info()).WillRepeatedly(Return(&info_));
-
   modem_.CreateCellularDevice(props);
   EXPECT_FALSE(modem_.device_.get());
 
diff --git a/wifi.cc b/wifi.cc
index ca88281..6db73ab 100644
--- a/wifi.cc
+++ b/wifi.cc
@@ -44,13 +44,11 @@
            EventDispatcher *dispatcher,
            Manager *manager,
            const string& link,
-           const std::string &address,
            int interface_index)
     : Device(control_interface,
              dispatcher,
              manager,
              link,
-             address,
              interface_index),
       task_factory_(this),
       bgscan_short_interval_(0),
diff --git a/wifi.h b/wifi.h
index 8a35e95..86969da 100644
--- a/wifi.h
+++ b/wifi.h
@@ -27,8 +27,7 @@
   WiFi(ControlInterface *control_interface,
        EventDispatcher *dispatcher,
        Manager *manager,
-       const std::string &link,
-       const std::string &address,
+       const std::string& link,
        int interface_index);
   virtual ~WiFi();
   virtual void Start();
diff --git a/wifi_unittest.cc b/wifi_unittest.cc
index 78a49cc..18039e5 100644
--- a/wifi_unittest.cc
+++ b/wifi_unittest.cc
@@ -44,7 +44,7 @@
 class WiFiPropertyTest : public PropertyStoreTest {
  public:
   WiFiPropertyTest()
-      : device_(new WiFi(&control_interface_, NULL, NULL, "wifi", "", 0)) {
+      : device_(new WiFi(&control_interface_, NULL, NULL, "wifi", 0)) {
   }
   virtual ~WiFiPropertyTest() {}
 
@@ -95,12 +95,7 @@
  public:
   WiFiMainTest()
       : manager_(&control_interface_, NULL, NULL),
-        wifi_(new WiFi(&control_interface_,
-                       NULL,
-                       &manager_,
-                       kDeviceName,
-                       kDeviceAddress,
-                       0)),
+        wifi_(new WiFi(&control_interface_, NULL, &manager_, kDeviceName, 0)),
         supplicant_process_proxy_(new NiceMock<MockSupplicantProcessProxy>()),
         supplicant_interface_proxy_(
             new NiceMock<MockSupplicantInterfaceProxy>(wifi_)),
@@ -178,7 +173,6 @@
   // initialization order
  protected:
   static const char kDeviceName[];
-  static const char kDeviceAddress[];
   static const char kNetworkModeAdHoc[];
   static const char kNetworkModeInfrastructure[];
 
@@ -191,7 +185,6 @@
 };
 
 const char WiFiMainTest::kDeviceName[] = "wlan0";
-const char WiFiMainTest::kDeviceAddress[] = "00:01:02:03:04:05";
 const char WiFiMainTest::kNetworkModeAdHoc[] = "ad-hoc";
 const char WiFiMainTest::kNetworkModeInfrastructure[] = "infrastructure";