blob: bb87fac0b56913c56526fdd799d37fb55f253e83 [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 (
sbarbari17d7e222019-11-05 10:02:29 -050019 "github.com/opencord/voltha-go/db/model"
Daniele Rossi8697d052019-10-28 17:15:43 +010020 "github.com/opencord/voltha-go/ro_core/config"
sbarbari17d7e222019-11-05 10:02:29 -050021 "github.com/opencord/voltha-lib-go/v2/pkg/db"
Scott Baker555307d2019-11-04 08:58:01 -080022 "github.com/opencord/voltha-protos/v2/go/voltha"
Daniele Rossi8697d052019-10-28 17:15:43 +010023 "github.com/stretchr/testify/assert"
24 "testing"
25)
26
27func TestNewDeviceAgent(t *testing.T) {
28
29 var core Core
30 core.instanceId = "ro_core"
31 core.config = config.NewROCoreFlags()
sbarbari17d7e222019-11-05 10:02:29 -050032 backend := db.Backend{
Daniele Rossi8697d052019-10-28 17:15:43 +010033 Client: core.kvClient,
34 StoreType: core.config.KVStoreType,
35 Host: core.config.KVStoreHost,
36 Port: core.config.KVStorePort,
37 Timeout: core.config.KVStoreTimeout,
38 PathPrefix: "service/voltha"}
39 core.clusterDataRoot = model.NewRoot(&voltha.Voltha{}, &backend)
40 core.genericMgr = newModelProxyManager(core.clusterDataProxy)
41 core.deviceMgr = newDeviceManager(core.clusterDataProxy, core.instanceId)
42
43 devAgent := newDeviceAgent(&voltha.Device{Id: "new_device"}, core.deviceMgr, core.clusterDataProxy)
44 assert.NotNil(t, devAgent)
45
46}