From: Amichai Date: Sun, 1 Sep 2019 13:46:42 +0000 (+0300) Subject: [RICPLT-1981] Get all nodebIds X-Git-Tag: 2.0.10~25 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=1e5e5aeb99166f1b84b249ad7debd8a972a310bb;p=ric-plt%2Fe2mgr.git [RICPLT-1981] Get all nodebIds Change-Id: I1ac12255ea9e6a3352854e4a7cb4aee49909fc2c Signed-off-by: Amichai --- diff --git a/Automation/Tests/ConfigurationUpdate/__pycache__/verifylogs.cpython-36.pyc b/Automation/Tests/ConfigurationUpdate/__pycache__/verifylogs.cpython-36.pyc deleted file mode 100755 index ff62026..0000000 Binary files a/Automation/Tests/ConfigurationUpdate/__pycache__/verifylogs.cpython-36.pyc and /dev/null differ diff --git a/Automation/Tests/Get-All-Nodes/__pycache__/config.cpython-36.pyc b/Automation/Tests/Get-All-Nodes/__pycache__/config.cpython-36.pyc deleted file mode 100644 index 07484b9..0000000 Binary files a/Automation/Tests/Get-All-Nodes/__pycache__/config.cpython-36.pyc and /dev/null differ diff --git a/Automation/Tests/Get-All-Nodes/__pycache__/scripts.cpython-36.pyc b/Automation/Tests/Get-All-Nodes/__pycache__/scripts.cpython-36.pyc deleted file mode 100644 index 5cb1749..0000000 Binary files a/Automation/Tests/Get-All-Nodes/__pycache__/scripts.cpython-36.pyc and /dev/null differ diff --git a/Automation/Tests/log.html b/Automation/Tests/log.html deleted file mode 100644 index 31e3522..0000000 --- a/Automation/Tests/log.html +++ /dev/null @@ -1,2125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Opening Robot Framework log failed

-
    -
  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 8 or newer is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • -
-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Automation/Tests/output.xml b/Automation/Tests/output.xml deleted file mode 100644 index cf142d6..0000000 --- a/Automation/Tests/output.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - -settings - -*Sets new request headers or updates the existing.* - -${header} - - - - - -http - -*Sends a POST request to the endpoint.* - -/v1/nodeb/x2-setup -${json} - - - - - -Execution terminated by signal - - - -robot:exit - -Test execution stopped due to a fatal error. - - - - - - -robot:exit - -Test execution stopped due to a fatal error. - - - -robot:exit - -Test execution stopped due to a fatal error. - - - - - - -robot:exit - -Test execution stopped due to a fatal error. - - - -robot:exit - -Test execution stopped due to a fatal error. - - - -robot:exit - -Test execution stopped due to a fatal error. - - - -ORAN Reset API - RIC to RAN - - - - -Critical Tests -All Tests - - -NOT robot:exit -robot:exit - - -Reset RIC TO RAN -Reset RIC TO RAN.Reset Happy no cause -Reset RIC TO RAN.Reset Happy with cause -Reset RIC TO RAN.Reset unhappy - - - - - diff --git a/Automation/Tests/report.html b/Automation/Tests/report.html deleted file mode 100644 index b13dee0..0000000 --- a/Automation/Tests/report.html +++ /dev/null @@ -1,2431 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Opening Robot Framework report failed

-
    -
  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 8 or newer is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • -
-
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/E2Manager/controllers/nodeb_controller.go b/E2Manager/controllers/nodeb_controller.go index a3136f0..c0f8541 100644 --- a/E2Manager/controllers/nodeb_controller.go +++ b/E2Manager/controllers/nodeb_controller.go @@ -158,7 +158,7 @@ func (rc NodebController) GetNodebIdList (writer http.ResponseWriter, request *h return; } - pmList := utils.ConvertNodebIdListToProtoMessageList(*nodebIdList) + pmList := utils.ConvertNodebIdListToProtoMessageList(nodebIdList) result, err := utils.MarshalProtoMessageListToJsonArray(pmList) if err != nil { diff --git a/E2Manager/controllers/nodeb_controller_test.go b/E2Manager/controllers/nodeb_controller_test.go index ffa8d22..2b906b4 100644 --- a/E2Manager/controllers/nodeb_controller_test.go +++ b/E2Manager/controllers/nodeb_controller_test.go @@ -225,7 +225,7 @@ func TestNodebController_GetNodeb_InternalError(t *testing.T) { func executeGetNodebIdList(logger *logger.Logger, writer *httptest.ResponseRecorder, rnibReaderProvider func() reader.RNibReader) { req, _ := http.NewRequest("GET", "/nodeb-ids", nil) - NewNodebController(logger, nil, rnibReaderProvider, nil).GetNodebIdList(writer, req) + NewNodebController(logger, nil, rnibReaderProvider, nil ).GetNodebIdList(writer,req) } func TestNodebController_GetNodebIdList_Success(t *testing.T) { @@ -240,11 +240,12 @@ func TestNodebController_GetNodebIdList_Success(t *testing.T) { rnibReaderMock := mocks.RnibReaderMock{} var rnibError common.IRNibError - enbList := []*entities.NbIdentity{&entities.NbIdentity{InventoryName: "test1", GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}} - gnbList := []*entities.NbIdentity{&entities.NbIdentity{InventoryName: "test2", GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId2", NbId: "nbId2"}}} - - rnibReaderMock.On("GetListEnbIds").Return(&enbList, rnibError) - rnibReaderMock.On("GetListGnbIds").Return(&gnbList, rnibError) + nbList := []*entities.NbIdentity{ + {InventoryName:"test1", GlobalNbId: &entities.GlobalNbId{PlmnId:"plmnId1",NbId: "nbId1"}}, + {InventoryName:"test2", GlobalNbId: &entities.GlobalNbId{PlmnId:"plmnId2",NbId: "nbId2"}}, + {InventoryName:"test3", GlobalNbId: &entities.GlobalNbId{PlmnId:"",NbId: ""}}, + } + rnibReaderMock.On("GetListNodebIds").Return(nbList, rnibError) rnibReaderProvider := func() reader.RNibReader { return &rnibReaderMock @@ -253,7 +254,7 @@ func TestNodebController_GetNodebIdList_Success(t *testing.T) { executeGetNodebIdList(logger, writer, rnibReaderProvider) assert.Equal(t, writer.Result().StatusCode, http.StatusOK) bodyBytes, err := ioutil.ReadAll(writer.Body) - assert.Equal(t, "[{\"inventoryName\":\"test1\",\"globalNbId\":{\"plmnId\":\"plmnId1\",\"nbId\":\"nbId1\"}},{\"inventoryName\":\"test2\",\"globalNbId\":{\"plmnId\":\"plmnId2\",\"nbId\":\"nbId2\"}}]", string(bodyBytes)) + assert.Equal(t, "[{\"inventoryName\":\"test1\",\"globalNbId\":{\"plmnId\":\"plmnId1\",\"nbId\":\"nbId1\"}},{\"inventoryName\":\"test2\",\"globalNbId\":{\"plmnId\":\"plmnId2\",\"nbId\":\"nbId2\"}},{\"inventoryName\":\"test3\",\"globalNbId\":{}}]",string(bodyBytes) ) } func TestNodebController_GetNodebIdList_EmptyList(t *testing.T) { @@ -268,11 +269,9 @@ func TestNodebController_GetNodebIdList_EmptyList(t *testing.T) { rnibReaderMock := mocks.RnibReaderMock{} var rnibError common.IRNibError - enbList := []*entities.NbIdentity{} - gnbList := []*entities.NbIdentity{} + nbList := []*entities.NbIdentity{} + rnibReaderMock.On("GetListNodebIds").Return(nbList, rnibError) - rnibReaderMock.On("GetListEnbIds").Return(&enbList, rnibError) - rnibReaderMock.On("GetListGnbIds").Return(&gnbList, rnibError) rnibReaderProvider := func() reader.RNibReader { return &rnibReaderMock @@ -297,8 +296,8 @@ func TestNodebController_GetNodebIdList_InternalError(t *testing.T) { rnibReaderMock := mocks.RnibReaderMock{} rnibError := common.NewInternalError(errors.New("#reader.GetEnbIdList - Internal Error")) - var enbList *[]*entities.NbIdentity - rnibReaderMock.On("GetListEnbIds").Return(enbList, rnibError) + var nbList []*entities.NbIdentity + rnibReaderMock.On("GetListNodebIds").Return(nbList, rnibError) rnibReaderProvider := func() reader.RNibReader { return &rnibReaderMock @@ -306,60 +305,4 @@ func TestNodebController_GetNodebIdList_InternalError(t *testing.T) { executeGetNodebIdList(logger, writer, rnibReaderProvider) assert.Equal(t, writer.Result().StatusCode, http.StatusInternalServerError) -} - -func TestNodebController_GetNodebIdList_Success_One(t *testing.T) { - logger, err := logger.InitLogger(logger.InfoLevel) - - if err != nil { - t.Errorf("#nodeb_controller_test.TestNodebController_GetNodebIdList_Success - failed to initialize logger, error: %s", err) - } - - writer := httptest.NewRecorder() - - rnibReaderMock := mocks.RnibReaderMock{} - var rnibError common.IRNibError - - enbList := []*entities.NbIdentity{} - gnbList := []*entities.NbIdentity{&entities.NbIdentity{InventoryName: "test2", GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId2", NbId: "nbId2"}}} - - rnibReaderMock.On("GetListEnbIds").Return(&enbList, rnibError) - rnibReaderMock.On("GetListGnbIds").Return(&gnbList, rnibError) - - rnibReaderProvider := func() reader.RNibReader { - return &rnibReaderMock - } - - executeGetNodebIdList(logger, writer, rnibReaderProvider) - assert.Equal(t, writer.Result().StatusCode, http.StatusOK) - bodyBytes, err := ioutil.ReadAll(writer.Body) - assert.Equal(t, "[{\"inventoryName\":\"test2\",\"globalNbId\":{\"plmnId\":\"plmnId2\",\"nbId\":\"nbId2\"}}]", string(bodyBytes)) -} - -func TestNodebController_GetNodebIdList_Success_Many(t *testing.T) { - logger, err := logger.InitLogger(logger.InfoLevel) - - if err != nil { - t.Errorf("#nodeb_controller_test.TestNodebController_GetNodebIdList_Success - failed to initialize logger, error: %s", err) - } - - writer := httptest.NewRecorder() - - rnibReaderMock := mocks.RnibReaderMock{} - var rnibError common.IRNibError - - enbList := []*entities.NbIdentity{&entities.NbIdentity{InventoryName: "test1", GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}} - gnbList := []*entities.NbIdentity{&entities.NbIdentity{InventoryName: "test2", GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId2", NbId: "nbId2"}}, {InventoryName: "test3", GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId3", NbId: "nbId3"}}} - - rnibReaderMock.On("GetListEnbIds").Return(&enbList, rnibError) - rnibReaderMock.On("GetListGnbIds").Return(&gnbList, rnibError) - - rnibReaderProvider := func() reader.RNibReader { - return &rnibReaderMock - } - - executeGetNodebIdList(logger, writer, rnibReaderProvider) - assert.Equal(t, writer.Result().StatusCode, http.StatusOK) - bodyBytes, err := ioutil.ReadAll(writer.Body) - assert.Equal(t, "[{\"inventoryName\":\"test1\",\"globalNbId\":{\"plmnId\":\"plmnId1\",\"nbId\":\"nbId1\"}},{\"inventoryName\":\"test2\",\"globalNbId\":{\"plmnId\":\"plmnId2\",\"nbId\":\"nbId2\"}},{\"inventoryName\":\"test3\",\"globalNbId\":{\"plmnId\":\"plmnId3\",\"nbId\":\"nbId3\"}}]", string(bodyBytes)) -} +} \ No newline at end of file diff --git a/E2Manager/services/rnib_reader_service.go b/E2Manager/services/rnib_reader_service.go index a598243..5d81220 100644 --- a/E2Manager/services/rnib_reader_service.go +++ b/E2Manager/services/rnib_reader_service.go @@ -35,22 +35,8 @@ func (s RnibReaderService) GetNodeb(ranName string) (*entities.NodebInfo, common return s.rnibReaderProvider().GetNodeb(ranName) } -func (s RnibReaderService) GetNodebIdList()(*[]*entities.NbIdentity, common.IRNibError) { - enbIdList, err := s.rnibReaderProvider().GetListEnbIds() - - if (err != nil) { - return nil, err - } - - gnbIdList, err := s.rnibReaderProvider().GetListGnbIds() - - if (err != nil) { - return nil, err - } - - nodebIdList := append(*enbIdList, *gnbIdList...) - - return &nodebIdList, nil +func (s RnibReaderService) GetNodebIdList()([]*entities.NbIdentity, common.IRNibError) { + return s.rnibReaderProvider().GetListNodebIds() }