blob: 9634408b0751de7f17c137634dd564c46f8502d2 [file] [log] [blame]
Daniele Rossi8697d052019-10-28 17:15:43 +01001/*
2 * Copyright 2019-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package core
17
18import (
npujar03b018e2019-11-13 15:29:36 +053019 "testing"
20
sbarbari17d7e222019-11-05 10:02:29 -050021 "github.com/opencord/voltha-go/db/model"
Daniele Rossi8697d052019-10-28 17:15:43 +010022 "github.com/opencord/voltha-go/ro_core/config"
serkant.uluderya2ae470f2020-01-21 11:13:09 -080023 "github.com/opencord/voltha-lib-go/v3/pkg/db"
24 "github.com/opencord/voltha-protos/v3/go/voltha"
Daniele Rossi8697d052019-10-28 17:15:43 +010025 "github.com/stretchr/testify/assert"
Daniele Rossi8697d052019-10-28 17:15:43 +010026)
27
28func TestNewDeviceAgent(t *testing.T) {
29
30 var core Core
npujar03b018e2019-11-13 15:29:36 +053031 core.instanceID = "ro_core"
Daniele Rossi8697d052019-10-28 17:15:43 +010032 core.config = config.NewROCoreFlags()
sbarbari17d7e222019-11-05 10:02:29 -050033 backend := db.Backend{
Daniele Rossi8697d052019-10-28 17:15:43 +010034 Client: core.kvClient,
35 StoreType: core.config.KVStoreType,
36 Host: core.config.KVStoreHost,
37 Port: core.config.KVStorePort,
38 Timeout: core.config.KVStoreTimeout,
39 PathPrefix: "service/voltha"}
40 core.clusterDataRoot = model.NewRoot(&voltha.Voltha{}, &backend)
41 core.genericMgr = newModelProxyManager(core.clusterDataProxy)
npujar03b018e2019-11-13 15:29:36 +053042 core.deviceMgr = newDeviceManager(core.clusterDataProxy, core.instanceID)
Daniele Rossi8697d052019-10-28 17:15:43 +010043
44 devAgent := newDeviceAgent(&voltha.Device{Id: "new_device"}, core.deviceMgr, core.clusterDataProxy)
45 assert.NotNil(t, devAgent)
46
47}