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