blob: 3fa05c9df144009f69a2915ed75d6796885f9327 [file] [log] [blame]
Stephane Barbarie4a2564d2018-07-26 11:02:58 -04001package model
2
3import (
4 "crypto/md5"
5 "fmt"
6 "github.com/golang/protobuf/ptypes/any"
7 "github.com/opencord/voltha/protos/go/bbf_fiber"
8 "github.com/opencord/voltha/protos/go/common"
9 "github.com/opencord/voltha/protos/go/openflow_13"
10 "github.com/opencord/voltha/protos/go/voltha"
11 "testing"
12)
13
14func Test_Node_01_New(t *testing.T) {
15 ports := []*voltha.Port{
16 {
17 PortNo: 123,
18 Label: "test-etcd_port-0",
19 Type: voltha.Port_PON_OLT,
20 AdminState: common.AdminState_ENABLED,
21 OperStatus: common.OperStatus_ACTIVE,
22 DeviceId: "etcd_port-0-device-id",
23 Peers: []*voltha.Port_PeerPort{},
24 },
25 }
26 data := &voltha.Device{
27 Id: "Config-SomeNode-01-new-test",
28 Type: "simulated_olt",
29 Root: true,
30 ParentId: "",
31 ParentPortNo: 0,
32 Vendor: "voltha-test",
33 Model: "GetLatest-voltha-simulated-olt",
34 HardwareVersion: "1.0.0",
35 FirmwareVersion: "1.0.0",
36 Images: &voltha.Images{},
37 SerialNumber: "abcdef-123456",
38 VendorId: "DEADBEEF-INC",
39 Adapter: "simulated_olt",
40 Vlan: 1234,
41 Address: &voltha.Device_HostAndPort{HostAndPort: "1.2.3.4:5555"},
42 ExtraArgs: "",
43 ProxyAddress: &voltha.Device_ProxyAddress{},
44 AdminState: voltha.AdminState_PREPROVISIONED,
45 OperStatus: common.OperStatus_ACTIVE,
46 Reason: "",
47 ConnectStatus: common.ConnectStatus_REACHABLE,
48 Custom: &any.Any{},
49 Ports: ports,
50 Flows: &openflow_13.Flows{},
51 FlowGroups: &openflow_13.FlowGroups{},
52 PmConfigs: &voltha.PmConfigs{},
53 ChannelTerminations: []*bbf_fiber.ChannelterminationConfig{},
54 ImageDownloads: []*voltha.ImageDownload{},
55 }
56 root := &Root{}
57 txid := fmt.Sprintf("%x", md5.Sum([]byte("node_transaction_id")))
58
59 node := NewNode(root, data, true, txid)
60
61 t.Logf("new SomeNode created : %+v\n", node)
62}