Activation: check compatiblity of uploaded software

Before activation, check if the PSU inventory's manufacturer and model
matches the uploaded software, to make sure the software is not updated
to a incompatible PSU.

The model check is mandatory, and if the PSU manufacturer is empty,
ignore the manufacturer check.

Tested: Upload a dummy tarball with incompatible model, verify the
        activation fails;
        Upload a dummy tarball with compatible model, verify the
        activation succeeds with a dummy update service.
        Also added unit tests for several cases:
        * Update on a PSU that model is incompatible;
        * Update on a PSU that the manufacture is incompatible;
        * Update on a PSU that the menufacture is empty;
        * Update on 4 PSUs that the second one is incompatible.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Ia1b6a3fa6c98cdea1ea93c917c0938d4a60f0911
diff --git a/test/test_version.cpp b/test/test_version.cpp
index cba599f..8481952 100644
--- a/test/test_version.cpp
+++ b/test/test_version.cpp
@@ -65,3 +65,16 @@
     EXPECT_EQ("psu-dummy-test.v0.1", version);
     EXPECT_EQ("model=dummy_model,manufacture=dummy_manufacture", extVersion);
 }
+
+TEST_F(TestVersion, getExtVersionInfo)
+{
+    std::string extVersion = "";
+    auto ret = Version::getExtVersionInfo(extVersion);
+    EXPECT_TRUE(ret.empty());
+
+    extVersion = "manufacturer=TestManu,model=TestModel";
+    ret = Version::getExtVersionInfo(extVersion);
+    EXPECT_EQ(2u, ret.size());
+    EXPECT_EQ("TestManu", ret["manufacturer"]);
+    EXPECT_EQ("TestModel", ret["model"]);
+}