[VOL-2235] Mocks and interfaces for rw-core
This update consists of mocks that are used by the rw-core
during unit testing. It also includes interfaces used for unit
tests.
Change-Id: I20ca1455c358113c3aa897acc6355e0ddbc614b7
diff --git a/rw_core/core/device_state_transitions_test.go b/rw_core/core/device_state_transitions_test.go
index 33171ee..0e7b4b3 100644
--- a/rw_core/core/device_state_transitions_test.go
+++ b/rw_core/core/device_state_transitions_test.go
@@ -17,6 +17,7 @@
import (
"github.com/opencord/voltha-go/rw_core/coreIf"
+ "github.com/opencord/voltha-go/rw_core/mocks"
"github.com/opencord/voltha-lib-go/v2/pkg/log"
"github.com/opencord/voltha-protos/v2/go/voltha"
"github.com/stretchr/testify/assert"
@@ -28,60 +29,17 @@
var tdm coreIf.DeviceManager
type testDeviceManager struct {
+ mocks.DeviceManager
}
func newTestDeviceManager() *testDeviceManager {
return &testDeviceManager{}
}
-func (tdm *testDeviceManager) GetDevice(string) (*voltha.Device, error) {
- return nil, nil
-}
-
-func (tdm *testDeviceManager) IsRootDevice(string) (bool, error) {
- return false, nil
-}
-
-func (tdm *testDeviceManager) NotifyInvalidTransition(pto *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) SetAdminStateToEnable(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) CreateLogicalDevice(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) SetupUNILogicalPorts(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) DisableAllChildDevices(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) DeleteLogicalDevice(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) DeleteLogicalPorts(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) DeleteAllChildDevices(to *voltha.Device) error {
- return nil
-}
-
-func (tdm *testDeviceManager) RunPostDeviceDelete(to *voltha.Device) error {
- return nil
-}
-
func init() {
- log.AddPackage(log.JSON, log.WarnLevel, nil)
- //log.UpdateAllLoggers(log.Fields{"instanceId": "device-state-transition"})
- //log.SetAllLogLevel(log.DebugLevel)
+ if _, err := log.AddPackage(log.JSON, log.WarnLevel, nil); err != nil {
+ log.Fatal("failure-adding-package-core")
+ }
tdm = newTestDeviceManager()
transitionMap = NewTransitionMap(tdm)
}