//
// Copyright 2019 AT&T Intellectual Property
// Copyright 2019 Nokia
+// Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
servedNrCells = append(servedNrCells, &entities.ServedNRCell{ServedNrCellInformation: &entities.ServedNRCellInformation{
CellId: v,
ChoiceNrMode: &entities.ServedNRCellInformation_ChoiceNRMode{
- Fdd: &entities.ServedNRCellInformation_ChoiceNRMode_FddInfo{
-
- },
+ Fdd: &entities.ServedNRCellInformation_ChoiceNRMode_FddInfo{},
},
NrMode: entities.Nr_FDD,
NrPci: 5,
context := controllerUpdateGnbTestContext{
getNodebInfoResult: nil,
requestBody: map[string]interface{}{
- "servedNrCells": []interface{}{
- },
+ "servedNrCells": []interface{}{},
},
expectedStatusCode: http.StatusBadRequest,
expectedJsonResponse: ValidationFailureJson,
oldServedCells := generateServedCells("whatever1", "whatever2")
context := controllerUpdateEnbTestContext{
- getNodebInfoResult: &getNodebInfoResult{
- nodebInfo: &entities.NodebInfo{
- RanName: RanName,
- ConnectionStatus: entities.ConnectionStatus_CONNECTED,
- AssociatedE2TInstanceAddress: AssociatedE2TInstanceAddress,
- NodeType: entities.Node_ENB,
- Configuration: &entities.NodebInfo_Enb{Enb: &entities.Enb{ServedCells: oldServedCells, EnbType: entities.EnbType_MACRO_NG_ENB}},
- },
- rnibError: nil,
- },
+ getNodebInfoResult: &getNodebInfoResult{
+ nodebInfo: &entities.NodebInfo{
+ RanName: RanName,
+ ConnectionStatus: entities.ConnectionStatus_CONNECTED,
+ AssociatedE2TInstanceAddress: AssociatedE2TInstanceAddress,
+ NodeType: entities.Node_ENB,
+ Configuration: &entities.NodebInfo_Enb{Enb: &entities.Enb{ServedCells: oldServedCells, EnbType: entities.EnbType_MACRO_NG_ENB}},
+ },
+ rnibError: nil,
+ },
requestBody: requestBody,
expectedStatusCode: http.StatusBadRequest,
expectedJsonResponse: ValidationFailureJson,
controller.handleErrorResponse(e2managererrors.NewRmrError(), writer)
assert.Equal(t, http.StatusInternalServerError, writer.Result().StatusCode)
+ writer = httptest.NewRecorder()
+ controller.handleErrorResponse(e2managererrors.NewNoConnectedRanError(), writer)
+ assert.Equal(t, http.StatusNotFound, writer.Result().StatusCode)
+
writer = httptest.NewRecorder()
controller.handleErrorResponse(e2managererrors.NewResourceNotFoundError(), writer)
assert.Equal(t, http.StatusNotFound, writer.Result().StatusCode)