Daniele Rossi | 8697d05 | 2019-10-28 17:15:43 +0100 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package core |
| 17 | |
| 18 | import ( |
| 19 | "github.com/opencord/voltha-go/ro_core/config" |
| 20 | "github.com/opencord/voltha-lib-go/v2/pkg/db/model" |
Scott Baker | 555307d | 2019-11-04 08:58:01 -0800 | [diff] [blame] | 21 | "github.com/opencord/voltha-protos/v2/go/voltha" |
Daniele Rossi | 8697d05 | 2019-10-28 17:15:43 +0100 | [diff] [blame] | 22 | "github.com/stretchr/testify/assert" |
| 23 | "testing" |
| 24 | ) |
| 25 | |
| 26 | func 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 | } |