First commit
This commit is contained in:
38
setup/e2mgr/E2Manager/mocks/e2t_controller_mock.go
Normal file
38
setup/e2mgr/E2Manager/mocks/e2t_controller_mock.go
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type E2TControllerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *E2TControllerMock) HandleRequest(writer http.ResponseWriter, request *http.Request) {
|
||||
m.Called()
|
||||
}
|
||||
|
||||
func (m *E2TControllerMock) GetE2TInstances(writer http.ResponseWriter, request *http.Request) {
|
||||
m.Called()
|
||||
}
|
96
setup/e2mgr/E2Manager/mocks/e2t_instances_manager_mock.go
Normal file
96
setup/e2mgr/E2Manager/mocks/e2t_instances_manager_mock.go
Normal file
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type E2TInstancesManagerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) GetE2TInstance(e2tAddress string) (*entities.E2TInstance, error) {
|
||||
args := m.Called(e2tAddress)
|
||||
|
||||
return args.Get(0).(*entities.E2TInstance), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) AddE2TInstance(e2tInstanceAddress string, podName string) error {
|
||||
args := m.Called(e2tInstanceAddress, podName)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) RemoveE2TInstance(e2tAddress string) error {
|
||||
args := m.Called(e2tAddress)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) SelectE2TInstance() (string, error) {
|
||||
args := m.Called()
|
||||
return args.String(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) AddRansToInstance(e2tAddress string, ranNames []string) error {
|
||||
args := m.Called(e2tAddress, ranNames)
|
||||
return args.Error(0)
|
||||
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) RemoveRanFromInstance(ranName string, e2tAddress string) error {
|
||||
args := m.Called(ranName, e2tAddress)
|
||||
return args.Error(0)
|
||||
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) GetE2TInstances() ([]*entities.E2TInstance, error) {
|
||||
args := m.Called()
|
||||
|
||||
return args.Get(0).([]*entities.E2TInstance), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) GetE2TInstancesNoLogs() ([]*entities.E2TInstance, error) {
|
||||
args := m.Called()
|
||||
|
||||
return args.Get(0).([]*entities.E2TInstance), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) ResetKeepAliveTimestamp(e2tAddress string) error {
|
||||
args := m.Called(e2tAddress)
|
||||
return args.Error(0)
|
||||
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) SetE2tInstanceState(e2tAddress string, currentState entities.E2TInstanceState, newState entities.E2TInstanceState) error {
|
||||
args := m.Called(e2tAddress, currentState, newState)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) GetE2TAddresses() ([]string, error) {
|
||||
args := m.Called()
|
||||
return args.Get(0).([]string), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *E2TInstancesManagerMock) ClearRansOfAllE2TInstances() error {
|
||||
args := m.Called()
|
||||
return args.Error(0)
|
||||
}
|
35
setup/e2mgr/E2Manager/mocks/e2t_shutdown_manager_mock.go
Normal file
35
setup/e2mgr/E2Manager/mocks/e2t_shutdown_manager_mock.go
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type E2TShutdownManagerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *E2TShutdownManagerMock) Shutdown(e2tInstance *entities.E2TInstance) error {
|
||||
args := m.Called(e2tInstance)
|
||||
return args.Error(0)
|
||||
}
|
40
setup/e2mgr/E2Manager/mocks/http_client_mock.go
Normal file
40
setup/e2mgr/E2Manager/mocks/http_client_mock.go
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type HttpClientMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (c *HttpClientMock) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) {
|
||||
args := c.Called(url, contentType, body)
|
||||
return args.Get(0).(*http.Response), args.Error(1)
|
||||
}
|
||||
|
||||
func (c *HttpClientMock) Delete(url, contentType string, body io.Reader) (resp *http.Response, err error) {
|
||||
args := c.Called(url, contentType, body)
|
||||
return args.Get(0).(*http.Response), args.Error(1)
|
||||
}
|
83
setup/e2mgr/E2Manager/mocks/nodeb_controller_mock.go
Normal file
83
setup/e2mgr/E2Manager/mocks/nodeb_controller_mock.go
Normal file
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type NodebControllerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) GetNodeb(writer http.ResponseWriter, r *http.Request) {
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
|
||||
vars := mux.Vars(r)
|
||||
ranName := vars["ranName"]
|
||||
|
||||
writer.Write([]byte(ranName))
|
||||
c.Called()
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) GetNodebIdList(writer http.ResponseWriter, r *http.Request) {
|
||||
c.Called()
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) Shutdown(writer http.ResponseWriter, r *http.Request) {
|
||||
c.Called()
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) X2Reset(writer http.ResponseWriter, r *http.Request) {
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
|
||||
vars := mux.Vars(r)
|
||||
ranName := vars["ranName"]
|
||||
|
||||
writer.Write([]byte(ranName))
|
||||
|
||||
c.Called()
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) X2Setup(writer http.ResponseWriter, r *http.Request) {
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
|
||||
c.Called()
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) EndcSetup(writer http.ResponseWriter, r *http.Request) {
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
|
||||
c.Called()
|
||||
}
|
||||
|
||||
func (c *NodebControllerMock) UpdateGnb(writer http.ResponseWriter, r *http.Request) {
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
writer.WriteHeader(http.StatusOK)
|
||||
|
||||
c.Called()
|
||||
}
|
33
setup/e2mgr/E2Manager/mocks/ran_reconnection_manager_mock.go
Normal file
33
setup/e2mgr/E2Manager/mocks/ran_reconnection_manager_mock.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type RanDisconnectionManagerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *RanDisconnectionManagerMock) DisconnectRan(inventoryName string) error {
|
||||
args := m.Called(inventoryName)
|
||||
|
||||
return args.Error(0)
|
||||
}
|
35
setup/e2mgr/E2Manager/mocks/ran_setup_manager_mock.go
Normal file
35
setup/e2mgr/E2Manager/mocks/ran_setup_manager_mock.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type RanSetupManagerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *RanSetupManagerMock) ExecuteSetup(nodebInfo *entities.NodebInfo, status entities.ConnectionStatus) error {
|
||||
args := m.Called(nodebInfo, status)
|
||||
|
||||
return args.Error(0)
|
||||
}
|
68
setup/e2mgr/E2Manager/mocks/rmrMessengerMock.go
Normal file
68
setup/e2mgr/E2Manager/mocks/rmrMessengerMock.go
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"e2mgr/logger"
|
||||
"e2mgr/rmrCgo"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type RmrMessengerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) Init(port string, maxMsgSize int, flags int, logger *logger.Logger) rmrCgo.RmrMessenger{
|
||||
args := m.Called(port, maxMsgSize, flags, logger)
|
||||
return args.Get(0).(rmrCgo.RmrMessenger)
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) SendMsg(msg *rmrCgo.MBuf, printLogs bool) (*rmrCgo.MBuf, error){
|
||||
args := m.Called(msg, printLogs)
|
||||
return args.Get(0).(*rmrCgo.MBuf), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) WhSendMsg(msg *rmrCgo.MBuf, printLogs bool) (*rmrCgo.MBuf, error){
|
||||
args := m.Called(msg, printLogs)
|
||||
return args.Get(0).(*rmrCgo.MBuf), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) RecvMsg() (*rmrCgo.MBuf, error){
|
||||
args := m.Called()
|
||||
return args.Get(0).(*rmrCgo.MBuf), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) RtsMsg(msg *rmrCgo.MBuf){
|
||||
m.Called( )
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) FreeMsg(){
|
||||
m.Called( )
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) IsReady() bool{
|
||||
args := m.Called( )
|
||||
return args.Bool(0)
|
||||
}
|
||||
|
||||
func (m *RmrMessengerMock) Close(){
|
||||
m.Called( )
|
||||
}
|
158
setup/e2mgr/E2Manager/mocks/rnibReaderMock.go
Normal file
158
setup/e2mgr/E2Manager/mocks/rnibReaderMock.go
Normal file
@@ -0,0 +1,158 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type RnibReaderMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetNodeb(inventoryName string) (*entities.NodebInfo, error) {
|
||||
args := m.Called(inventoryName)
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).(*entities.NodebInfo), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).(*entities.NodebInfo), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetNodebByGlobalNbId(nodeType entities.Node_Type, globalNbId *entities.GlobalNbId) (*entities.NodebInfo, error) {
|
||||
args := m.Called(nodeType, globalNbId)
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).(*entities.NodebInfo), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).(*entities.NodebInfo), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetCellList(inventoryName string) (*entities.Cells, error) {
|
||||
args := m.Called(inventoryName)
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).(*entities.Cells), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).(*entities.Cells), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetListGnbIds() ([]*entities.NbIdentity, error) {
|
||||
args := m.Called()
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).([]*entities.NbIdentity), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).([]*entities.NbIdentity), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetListEnbIds() ([]*entities.NbIdentity, error) {
|
||||
args := m.Called()
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).([]*entities.NbIdentity), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).([]*entities.NbIdentity), nil
|
||||
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetCountGnbList() (int, error) {
|
||||
args := m.Called()
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Int(0), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Int(0), nil
|
||||
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetCell(inventoryName string, pci uint32) (*entities.Cell, error) {
|
||||
args := m.Called(inventoryName, pci)
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).(*entities.Cell), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).(*entities.Cell), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetCellById(cellType entities.Cell_Type, cellId string) (*entities.Cell, error) {
|
||||
args := m.Called(cellType, cellId)
|
||||
|
||||
errArg := args.Get(1);
|
||||
if errArg != nil {
|
||||
return args.Get(0).(*entities.Cell), errArg.(error);
|
||||
}
|
||||
|
||||
return args.Get(0).(*entities.Cell), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetListNodebIds() ([]*entities.NbIdentity, error) {
|
||||
args := m.Called()
|
||||
|
||||
errArg := args.Get(1)
|
||||
|
||||
if errArg != nil {
|
||||
return args.Get(0).([]*entities.NbIdentity), errArg.(error)
|
||||
}
|
||||
|
||||
return args.Get(0).([]*entities.NbIdentity), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetRanLoadInformation(inventoryName string) (*entities.RanLoadInformation, error) {
|
||||
args := m.Called()
|
||||
|
||||
errArg := args.Get(1)
|
||||
|
||||
if errArg != nil {
|
||||
return args.Get(0).(*entities.RanLoadInformation), errArg.(error)
|
||||
}
|
||||
|
||||
return args.Get(0).(*entities.RanLoadInformation), nil
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetE2TInstance(e2taddress string) (*entities.E2TInstance, error) {
|
||||
args := m.Called(e2taddress)
|
||||
return args.Get(0).(*entities.E2TInstance), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetE2TInstances(addresses []string) ([]*entities.E2TInstance, error) {
|
||||
args := m.Called(addresses)
|
||||
return args.Get(0).([]*entities.E2TInstance), args.Error(1)
|
||||
}
|
||||
|
||||
func (m *RnibReaderMock) GetE2TAddresses() ([]string, error) {
|
||||
args := m.Called()
|
||||
return args.Get(0).([]string), args.Error(1)
|
||||
}
|
94
setup/e2mgr/E2Manager/mocks/rnibWriterMock.go
Normal file
94
setup/e2mgr/E2Manager/mocks/rnibWriterMock.go
Normal file
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type RnibWriterMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) SaveNodeb(nbIdentity *entities.NbIdentity, nb *entities.NodebInfo) error {
|
||||
args := rnibWriterMock.Called(nbIdentity, nb)
|
||||
|
||||
errArg := args.Get(0)
|
||||
|
||||
if errArg != nil {
|
||||
return errArg.(error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) UpdateNodebInfo(nodebInfo *entities.NodebInfo) error {
|
||||
args := rnibWriterMock.Called(nodebInfo)
|
||||
|
||||
errArg := args.Get(0)
|
||||
|
||||
if errArg != nil {
|
||||
return errArg.(error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) SaveRanLoadInformation(inventoryName string, ranLoadInformation *entities.RanLoadInformation) error {
|
||||
args := rnibWriterMock.Called(inventoryName, ranLoadInformation)
|
||||
|
||||
errArg := args.Get(0)
|
||||
|
||||
if errArg != nil {
|
||||
return errArg.(error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) SaveE2TInstance(e2tInstance *entities.E2TInstance) error {
|
||||
args := rnibWriterMock.Called(e2tInstance)
|
||||
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) SaveE2TAddresses(addresses []string) error {
|
||||
args := rnibWriterMock.Called(addresses)
|
||||
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) RemoveE2TInstance(address string) error {
|
||||
args := rnibWriterMock.Called(address)
|
||||
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) UpdateGnbCells(nodebInfo *entities.NodebInfo, servedNrCells []*entities.ServedNRCell) error {
|
||||
args := rnibWriterMock.Called(nodebInfo, servedNrCells)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (rnibWriterMock *RnibWriterMock) RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error {
|
||||
args := rnibWriterMock.Called(inventoryName, servedNrCells)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
34
setup/e2mgr/E2Manager/mocks/root_controller_mock.go
Normal file
34
setup/e2mgr/E2Manager/mocks/root_controller_mock.go
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type RootControllerMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (rc *RootControllerMock) HandleHealthCheckRequest(writer http.ResponseWriter, request *http.Request) {
|
||||
rc.Called()
|
||||
}
|
58
setup/e2mgr/E2Manager/mocks/routing_manager_client_mock.go
Normal file
58
setup/e2mgr/E2Manager/mocks/routing_manager_client_mock.go
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type RoutingManagerClientMock struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *RoutingManagerClientMock) AddE2TInstance(e2tAddress string) error {
|
||||
|
||||
args := m.Called(e2tAddress)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *RoutingManagerClientMock) AssociateRanToE2TInstance(e2tAddress string, ranName string) error {
|
||||
|
||||
args := m.Called(e2tAddress, ranName)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *RoutingManagerClientMock) DissociateRanE2TInstance(e2tAddress string, ranName string) error {
|
||||
|
||||
args := m.Called(e2tAddress, ranName)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *RoutingManagerClientMock) DissociateAllRans(e2tAddresses []string) error {
|
||||
|
||||
args := m.Called(e2tAddresses)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *RoutingManagerClientMock) DeleteE2TInstance(e2tAddress string, ransToBeDissociated []string) error {
|
||||
|
||||
args := m.Called(e2tAddress, ransToBeDissociated)
|
||||
return args.Error(0)
|
||||
}
|
136
setup/e2mgr/E2Manager/mocks/sdlInstanceMock.go
Normal file
136
setup/e2mgr/E2Manager/mocks/sdlInstanceMock.go
Normal file
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// Copyright 2019 AT&T Intellectual Property
|
||||
// Copyright 2019 Nokia
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
|
||||
// platform project (RICP).
|
||||
|
||||
package mocks
|
||||
|
||||
import "github.com/stretchr/testify/mock"
|
||||
|
||||
type MockSdlInstance struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) SubscribeChannel(cb func(string, ...string), channels ...string) error {
|
||||
a := m.Called(cb, channels)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) UnsubscribeChannel(channels ...string) error {
|
||||
a := m.Called(channels)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) SetAndPublish(channelsAndEvents []string, pairs ...interface{}) error {
|
||||
a := m.Called(channelsAndEvents, pairs)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) SetIfAndPublish(channelsAndEvents []string, key string, oldData, newData interface{}) (bool, error) {
|
||||
a := m.Called(channelsAndEvents, key, oldData, newData)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) SetIfNotExistsAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
|
||||
a := m.Called(channelsAndEvents, key, data)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) RemoveAndPublish(channelsAndEvents []string, keys []string) error {
|
||||
a := m.Called(channelsAndEvents, keys)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) RemoveIfAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
|
||||
a := m.Called(channelsAndEvents, key, data)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) RemoveAllAndPublish(channelsAndEvents []string) error {
|
||||
a := m.Called(channelsAndEvents)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) Set(pairs ...interface{}) error {
|
||||
a := m.Called(pairs)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) Get(keys []string) (map[string]interface{}, error) {
|
||||
a := m.Called(keys)
|
||||
return a.Get(0).(map[string]interface{}), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) GetAll() ([]string, error) {
|
||||
a := m.Called()
|
||||
return a.Get(0).([]string), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) Close() error {
|
||||
a := m.Called()
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) Remove(keys []string) error {
|
||||
a := m.Called(keys)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) RemoveAll() error {
|
||||
a := m.Called()
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) SetIf(key string, oldData, newData interface{}) (bool, error) {
|
||||
a := m.Called(key, oldData, newData)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) SetIfNotExists(key string, data interface{}) (bool, error) {
|
||||
a := m.Called(key, data)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
func (m *MockSdlInstance) RemoveIf(key string, data interface{}) (bool, error) {
|
||||
a := m.Called(key, data)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) AddMember(group string, member ...interface{}) error{
|
||||
a := m.Called(group, member)
|
||||
return a.Error(0)
|
||||
}
|
||||
|
||||
func (m *MockSdlInstance) RemoveMember(group string, member ...interface{}) error {
|
||||
a := m.Called(group, member)
|
||||
return a.Error(0)
|
||||
}
|
||||
func (m *MockSdlInstance) RemoveGroup(group string) error {
|
||||
a := m.Called(group)
|
||||
return a.Error(0)
|
||||
}
|
||||
func (m *MockSdlInstance) GetMembers(group string) ([]string, error) {
|
||||
a := m.Called(group)
|
||||
return a.Get(0).([]string), a.Error(1)
|
||||
}
|
||||
func (m *MockSdlInstance) IsMember(group string, member interface{}) (bool, error){
|
||||
a := m.Called(group, member)
|
||||
return a.Bool(0), a.Error(1)
|
||||
}
|
||||
func (m *MockSdlInstance) GroupSize(group string) (int64, error){
|
||||
a := m.Called(group,)
|
||||
return int64(a.Int(0)), a.Error(1)
|
||||
}
|
Reference in New Issue
Block a user