VOL-1027 : Initial commit of voltha 2.0 data model
Change-Id: Ib8006de1af2166281ccf1c9d7c2b9156991bf4e4
diff --git a/db/model/node_test.go b/db/model/node_test.go
new file mode 100644
index 0000000..3fa05c9
--- /dev/null
+++ b/db/model/node_test.go
@@ -0,0 +1,62 @@
+package model
+
+import (
+ "crypto/md5"
+ "fmt"
+ "github.com/golang/protobuf/ptypes/any"
+ "github.com/opencord/voltha/protos/go/bbf_fiber"
+ "github.com/opencord/voltha/protos/go/common"
+ "github.com/opencord/voltha/protos/go/openflow_13"
+ "github.com/opencord/voltha/protos/go/voltha"
+ "testing"
+)
+
+func Test_Node_01_New(t *testing.T) {
+ ports := []*voltha.Port{
+ {
+ PortNo: 123,
+ Label: "test-etcd_port-0",
+ Type: voltha.Port_PON_OLT,
+ AdminState: common.AdminState_ENABLED,
+ OperStatus: common.OperStatus_ACTIVE,
+ DeviceId: "etcd_port-0-device-id",
+ Peers: []*voltha.Port_PeerPort{},
+ },
+ }
+ data := &voltha.Device{
+ Id: "Config-SomeNode-01-new-test",
+ Type: "simulated_olt",
+ Root: true,
+ ParentId: "",
+ ParentPortNo: 0,
+ Vendor: "voltha-test",
+ Model: "GetLatest-voltha-simulated-olt",
+ HardwareVersion: "1.0.0",
+ FirmwareVersion: "1.0.0",
+ Images: &voltha.Images{},
+ SerialNumber: "abcdef-123456",
+ VendorId: "DEADBEEF-INC",
+ Adapter: "simulated_olt",
+ Vlan: 1234,
+ Address: &voltha.Device_HostAndPort{HostAndPort: "1.2.3.4:5555"},
+ ExtraArgs: "",
+ ProxyAddress: &voltha.Device_ProxyAddress{},
+ AdminState: voltha.AdminState_PREPROVISIONED,
+ OperStatus: common.OperStatus_ACTIVE,
+ Reason: "",
+ ConnectStatus: common.ConnectStatus_REACHABLE,
+ Custom: &any.Any{},
+ Ports: ports,
+ Flows: &openflow_13.Flows{},
+ FlowGroups: &openflow_13.FlowGroups{},
+ PmConfigs: &voltha.PmConfigs{},
+ ChannelTerminations: []*bbf_fiber.ChannelterminationConfig{},
+ ImageDownloads: []*voltha.ImageDownload{},
+ }
+ root := &Root{}
+ txid := fmt.Sprintf("%x", md5.Sum([]byte("node_transaction_id")))
+
+ node := NewNode(root, data, true, txid)
+
+ t.Logf("new SomeNode created : %+v\n", node)
+}