Add support for reading, merging, and querying configs

Change-Id: I04a07cf5e9a6b41213b3101f3e04be350e50b41f
diff --git a/aos/BUILD b/aos/BUILD
index eba1b45..9662ee3 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -376,6 +376,11 @@
     ],
 )
 
+flatbuffer_cc_library(
+    name = "configuration_flatbuffer",
+    srcs = ["configuration.fbs"],
+)
+
 cc_library(
     name = "configuration",
     srcs = [
@@ -386,9 +391,17 @@
     ],
     visibility = ["//visibility:public"],
     deps = [
+        ":configuration_flatbuffer",
+        ":flatbuffer_merge",
+        ":flatbuffers",
+        ":json_to_flatbuffer",
         "//aos:once",
         "//aos:unique_malloc_ptr",
         "//aos/logging",
+        "//aos/util:file",
+        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/container:btree",
+        "@com_google_absl//absl/strings",
     ],
 )
 
@@ -495,3 +508,22 @@
         "@com_github_google_flatbuffers//:flatbuffers",
     ],
 )
+
+cc_test(
+    name = "configuration_test",
+    srcs = [
+        "configuration_test.cc",
+    ],
+    data = [
+        "testdata/config1.json",
+        "testdata/config1_bad.json",
+        "testdata/config2.json",
+        "testdata/config3.json",
+        "testdata/expected.json",
+    ],
+    deps = [
+        ":configuration",
+        "//aos/testing:googletest",
+        "//aos/testing:test_logging",
+    ],
+)