VOL-1027 : Initial commit of voltha 2.0 data model
Change-Id: Ib8006de1af2166281ccf1c9d7c2b9156991bf4e4
diff --git a/db/model/root_test.go b/db/model/root_test.go
new file mode 100644
index 0000000..f9aeb67
--- /dev/null
+++ b/db/model/root_test.go
@@ -0,0 +1,44 @@
+package model
+
+import (
+ "encoding/json"
+ "fmt"
+ "github.com/opencord/voltha/protos/go/voltha"
+ "testing"
+ "time"
+)
+
+var (
+ backend *Backend
+ //rootPrefix = "service/voltha/data/core/0001"
+
+ basePrefix = "service/voltha/service/vcores/data/devices"
+ deviceId = "00016f13befaedcc"
+ rootPrefix = basePrefix + "/" + deviceId
+ deviceProxy = "/devices/" + deviceId
+)
+
+func Test_NewRoot(t *testing.T) {
+ backend = NewBackend(ETCD_KV, etcd_host, etcd_port, timeout, rootPrefix)
+
+ //var msgClass *voltha.VolthaInstance
+ var msgClass *voltha.DeviceInstance
+ root := NewRoot(msgClass, backend, nil)
+
+ start := time.Now()
+
+ r := root.Load(msgClass)
+ afterLoad := time.Now()
+ fmt.Printf(">>>>>>>>>>>>> Time to load : %f\n", afterLoad.Sub(start).Seconds())
+
+ d := r.Node.Get(deviceProxy, "", 0, false, "")
+ afterGet := time.Now()
+ fmt.Printf(">>>>>>>>>>>>> Time to load and get: %f\n", afterGet.Sub(start).Seconds())
+
+ jr, _ := json.Marshal(r)
+ fmt.Printf("Content of ROOT --> \n%s\n", jr)
+
+ jd, _ := json.Marshal(d)
+ fmt.Printf("Content of GET --> \n%s\n", jd)
+
+}