From 1e5e5aeb99166f1b84b249ad7debd8a972a310bb Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 1 Sep 2019 16:46:42 +0300 Subject: [PATCH] [RICPLT-1981] Get all nodebIds Change-Id: I1ac12255ea9e6a3352854e4a7cb4aee49909fc2c Signed-off-by: Amichai --- .../__pycache__/verifylogs.cpython-36.pyc | Bin 573 -> 0 bytes .../__pycache__/config.cpython-36.pyc | Bin 211 -> 0 bytes .../__pycache__/scripts.cpython-36.pyc | Bin 1674 -> 0 bytes Automation/Tests/log.html | 2125 ----------------- Automation/Tests/output.xml | 97 - Automation/Tests/report.html | 2431 -------------------- E2Manager/controllers/nodeb_controller.go | 2 +- E2Manager/controllers/nodeb_controller_test.go | 83 +- E2Manager/services/rnib_reader_service.go | 18 +- 9 files changed, 16 insertions(+), 4740 deletions(-) delete mode 100755 Automation/Tests/ConfigurationUpdate/__pycache__/verifylogs.cpython-36.pyc delete mode 100644 Automation/Tests/Get-All-Nodes/__pycache__/config.cpython-36.pyc delete mode 100644 Automation/Tests/Get-All-Nodes/__pycache__/scripts.cpython-36.pyc delete mode 100644 Automation/Tests/log.html delete mode 100644 Automation/Tests/output.xml delete mode 100644 Automation/Tests/report.html 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 ff6202617809e921d2890e0baacadb2480ce9fa8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 573 zcmZut!D`z;5S?AEWZBrsp@m#}Fu55_6gP)JD5c=gTT;`cq?iPwcviL&ORKJ=P#Niz z9&_wZGfX{l;rQdHO|$rVOXF^{{mGa01_kXF%$X)E&AffPw%tZ|8X3 zmT#kl-dU-|Bl8T?AJ^TZ(;|@v{n75;{_bxY9oCyiGQ@-a`F1ALY;?YT`XXsG;6|uK z#zq8Tj04xSG1PLNDP7doN*a;)+0wM@c-Dk0n7#^B9^)*MY3eWJtZDZ@b7a`+9(4WL zk7IACBI)Iqd7S0mq?j*#9Zj^lqHd}8N&B%kR&fw6a_wiKioYc2XVSZoIt&VWW4eQ^B-P1YFSW@(veF@D6*!9D-mjbGS>6-k_Z00c*}?j%U=PJLA5K6y_`WzNuN4 F`~%mWkH7!` 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 07484b99c095e9ca269c14b8669f19f40b5adde5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 211 zcmYk0Jqp4=6og-53Kau_jaRUU3))K1MlHlfD@8(dpUJ`|FYHg@k?cHAT1#)BjjM$? zFdxGd!;HhQeS7T>aRcBEfAUYJi<|tDK@i)iqr@y*%r0Y iY=I`4Ng1t)qh=>6&mtREm%2GAh+Bzq?{n362)s8PfjuJt 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 5cb1749aaac1f12b4ff1443f277cdadce696a04c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1674 zcmbVM&2G~`5caNrvT+-dx|Ehmpem{aDKy?Vw3G-T+NzX_5~0vj5UQN4+onq5Xl)A- z+Ecl3;2pSf;~jVlUpes#aADR-oU{#6Ra^V{^Lln>_M7z-Qz`w&-*@ltO-Rx&Y2?Dd zpTqDL0hq*4Q>yl!sEQb7@@J`vnZi_f$_%}ga@udOl*)C1;*w#gFg9U$_W^wA7@Z2l zr^uI&l@sX%G4S9YE+hxdz&o;=P4J59A?k#Pf0y_Ti1TO1JaSu( z8PtNdADAw;+xy(Vs+pBUzw%nz!c4Cj@2CoU))$)SVekqOx8tMF9g*hl^3=m#BhCvO71r!MNa9(jv|Uq7tM}%jr>Qh$ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

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() } -- 2.16.6