From 64dc6b9da7e913c3ea89671be12a33b6d2b8c6f0 Mon Sep 17 00:00:00 2001 From: Irina Date: Tue, 14 Jul 2020 14:48:39 +0300 Subject: [PATCH] [RIC-432] - Support Update eNB REST API - delete/update/get/add return nodeb response Change-Id: I5908d4961e002217c7a6d5ee42b4db2d1f5e71eb Signed-off-by: Irina --- E2Manager/container-tag.yaml | 2 +- .../httpmsghandlers/add_enb_request_handler.go | 2 +- .../httpmsghandlers/delete_enb_request_handler.go | 2 +- .../delete_enb_request_handler_test.go | 2 +- .../httpmsghandlers/get_nodeb_request_handler.go | 2 +- .../get_nodeb_request_handler_test.go | 2 +- .../httpmsghandlers/update_gnb_request_handler.go | 2 +- .../update_nodeb_request_handler_test.go | 20 --- E2Manager/managers/update_enb_manager_test.go | 20 --- E2Manager/models/add_enb_response.go | 47 ------- E2Manager/models/delete_enb_response.go | 47 ------- E2Manager/models/get_nodeb_response.go | 49 ------- E2Manager/models/update_gnb_response.go | 47 ------- Swagger/E2Manager_API.yaml | 147 +-------------------- 14 files changed, 12 insertions(+), 379 deletions(-) delete mode 100644 E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go delete mode 100644 E2Manager/managers/update_enb_manager_test.go delete mode 100644 E2Manager/models/add_enb_response.go delete mode 100644 E2Manager/models/delete_enb_response.go delete mode 100644 E2Manager/models/get_nodeb_response.go delete mode 100644 E2Manager/models/update_gnb_response.go diff --git a/E2Manager/container-tag.yaml b/E2Manager/container-tag.yaml index 46e43c8..354d043 100644 --- a/E2Manager/container-tag.yaml +++ b/E2Manager/container-tag.yaml @@ -1,4 +1,4 @@ # The Jenkins job requires a tag to build the Docker image. # Global-JJB script assumes this file is in the repo root. --- -tag: 5.2.13 +tag: 5.2.14 diff --git a/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go b/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go index 92afb33..e5a1c5e 100644 --- a/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go +++ b/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go @@ -80,7 +80,7 @@ func (h *AddEnbRequestHandler) Handle(request models.Request) (models.IResponse, _ = h.createNbIdentity(addEnbRequest) // TODO: add call to ranListManager - return models.NewAddEnbResponse(nodebInfo), nil + return models.NewNodebResponse(nodebInfo), nil } func (h *AddEnbRequestHandler) createNodebInfo(addEnbRequest *models.AddEnbRequest) *entities.NodebInfo { diff --git a/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler.go b/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler.go index 29cb39f..c669dd1 100644 --- a/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler.go +++ b/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler.go @@ -73,6 +73,6 @@ func (h *DeleteEnbRequestHandler) Handle(request models.Request) (models.IRespon } h.logger.Infof("#DeleteEnbRequestHandler.Handle - RAN name: %s - deleted successfully.", deleteEnbRequest.RanName) - return models.NewDeleteEnbResponse(nodebInfo), nil + return models.NewNodebResponse(nodebInfo), nil } diff --git a/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler_test.go index 2c47919..b039c8b 100644 --- a/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler_test.go +++ b/E2Manager/handlers/httpmsghandlers/delete_enb_request_handler_test.go @@ -53,7 +53,7 @@ func TestHandleDeleteEnbSuccess(t *testing.T) { result, err := handler.Handle(&models.DeleteEnbRequest{RanName: ranName}) assert.Nil(t, err) assert.NotNil(t, result) - assert.IsType(t, &models.DeleteEnbResponse{}, result) + assert.IsType(t, &models.NodebResponse{}, result) readerMock.AssertExpectations(t) writerMock.AssertExpectations(t) } diff --git a/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler.go b/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler.go index 1bbbd4c..8c8a0e1 100644 --- a/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler.go +++ b/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler.go @@ -50,7 +50,7 @@ func (handler *GetNodebRequestHandler) Handle(request models.Request) (models.IR return nil, rnibErrorToE2ManagerError(err) } - return models.NewGetNodebResponse(nodeb), nil + return models.NewNodebResponse(nodeb), nil } func rnibErrorToE2ManagerError(err error) error { diff --git a/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler_test.go index 0177561..5a644b9 100644 --- a/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler_test.go +++ b/E2Manager/handlers/httpmsghandlers/get_nodeb_request_handler_test.go @@ -50,7 +50,7 @@ func TestHandleGetNodebSuccess(t *testing.T) { response, err := handler.Handle(models.GetNodebRequest{RanName: ranName}) assert.Nil(t, err) assert.NotNil(t, response) - assert.IsType(t, &models.GetNodebResponse{}, response) + assert.IsType(t, &models.NodebResponse{}, response) } func TestHandleGetNodebFailure(t *testing.T) { diff --git a/E2Manager/handlers/httpmsghandlers/update_gnb_request_handler.go b/E2Manager/handlers/httpmsghandlers/update_gnb_request_handler.go index 3648563..5e382b3 100644 --- a/E2Manager/handlers/httpmsghandlers/update_gnb_request_handler.go +++ b/E2Manager/handlers/httpmsghandlers/update_gnb_request_handler.go @@ -74,7 +74,7 @@ func (h *UpdateGnbRequestHandler) Handle(request models.Request) (models.IRespon return nil, err } - return models.NewUpdateGnbResponse(nodebInfo), nil + return models.NewNodebResponse(nodebInfo), nil } func (h *UpdateGnbRequestHandler) updateGnbCells(nodebInfo *entities.NodebInfo, updateGnbRequest models.UpdateGnbRequest) error { diff --git a/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go deleted file mode 100644 index ff4b9f8..0000000 --- a/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// -// 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 httpmsghandlers diff --git a/E2Manager/managers/update_enb_manager_test.go b/E2Manager/managers/update_enb_manager_test.go deleted file mode 100644 index c107157..0000000 --- a/E2Manager/managers/update_enb_manager_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// -// 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 managers diff --git a/E2Manager/models/add_enb_response.go b/E2Manager/models/add_enb_response.go deleted file mode 100644 index 656d60e..0000000 --- a/E2Manager/models/add_enb_response.go +++ /dev/null @@ -1,47 +0,0 @@ -// -// 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 models - -import ( - "e2mgr/e2managererrors" - "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" - "github.com/golang/protobuf/jsonpb" -) - -type AddEnbResponse struct { - nodebInfo *entities.NodebInfo -} - -func NewAddEnbResponse(nodebInfo *entities.NodebInfo) *AddEnbResponse { - return &AddEnbResponse{ - nodebInfo: nodebInfo, - } -} - -func (response *AddEnbResponse) Marshal() ([]byte, error) { - m := jsonpb.Marshaler{} - result, err := m.MarshalToString(response.nodebInfo) - - if err != nil { - return nil, e2managererrors.NewInternalError() - } - - return []byte(result), nil -} diff --git a/E2Manager/models/delete_enb_response.go b/E2Manager/models/delete_enb_response.go deleted file mode 100644 index 708fd25..0000000 --- a/E2Manager/models/delete_enb_response.go +++ /dev/null @@ -1,47 +0,0 @@ -// -// 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 models - -import ( - "e2mgr/e2managererrors" - "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" - "github.com/golang/protobuf/jsonpb" -) - -type DeleteEnbResponse struct { - nodebInfo *entities.NodebInfo -} - -func NewDeleteEnbResponse(nodebInfo *entities.NodebInfo) *DeleteEnbResponse { - return &DeleteEnbResponse{ - nodebInfo: nodebInfo, - } -} - -func (response *DeleteEnbResponse) Marshal() ([]byte, error) { - m := jsonpb.Marshaler{} - result, err := m.MarshalToString(response.nodebInfo) - - if err != nil { - return nil, e2managererrors.NewInternalError() - } - - return []byte(result), nil -} diff --git a/E2Manager/models/get_nodeb_response.go b/E2Manager/models/get_nodeb_response.go deleted file mode 100644 index 1eaa32a..0000000 --- a/E2Manager/models/get_nodeb_response.go +++ /dev/null @@ -1,49 +0,0 @@ -// -// 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 models - -import ( - "e2mgr/e2managererrors" - "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" - "github.com/golang/protobuf/jsonpb" -) - -type GetNodebResponse struct { - nodebInfo *entities.NodebInfo -} - -func NewGetNodebResponse(nodebInfo *entities.NodebInfo) *GetNodebResponse { - return &GetNodebResponse{ - nodebInfo: nodebInfo, - } -} - -func (response *GetNodebResponse) Marshal() ([]byte, error) { - m := jsonpb.Marshaler{} - result, err := m.MarshalToString(response.nodebInfo) - - if err != nil { - return nil, e2managererrors.NewInternalError() - } - - return []byte(result), nil - -} diff --git a/E2Manager/models/update_gnb_response.go b/E2Manager/models/update_gnb_response.go deleted file mode 100644 index 949eb76..0000000 --- a/E2Manager/models/update_gnb_response.go +++ /dev/null @@ -1,47 +0,0 @@ -// -// 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 models - -import ( - "e2mgr/e2managererrors" - "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" - "github.com/golang/protobuf/jsonpb" -) - -type UpdateGnbResponse struct { - nodebInfo *entities.NodebInfo -} - -func NewUpdateGnbResponse(nodebInfo *entities.NodebInfo) *UpdateGnbResponse { - return &UpdateGnbResponse{ - nodebInfo: nodebInfo, - } -} - -func (response *UpdateGnbResponse) Marshal() ([]byte, error) { - m := jsonpb.Marshaler{} - result, err := m.MarshalToString(response.nodebInfo) - - if err != nil { - return nil, e2managererrors.NewInternalError() - } - - return []byte(result), nil -} diff --git a/Swagger/E2Manager_API.yaml b/Swagger/E2Manager_API.yaml index 536eadd..cbcde2e 100644 --- a/Swagger/E2Manager_API.yaml +++ b/Swagger/E2Manager_API.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: E2 Manager Service description: E2 Manager Service APIs - version: 5.2.12 + version: 5.2.14 servers: - url: 'http://{apiRoot}/v1' variables: @@ -28,7 +28,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/GetNodebResponse' + $ref: '#/components/schemas/NodebResponse' '400': description: The specified RAN name is invalid content: @@ -66,7 +66,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DeleteEnbResponse' + $ref: '#/components/schemas/NodebResponse' '400': description: The specified RAN is not ENB content: @@ -147,7 +147,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UpdateGnbResponse' + $ref: '#/components/schemas/NodebResponse' '400': description: Invalid input content: @@ -278,7 +278,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AddEnbResponse' + $ref: '#/components/schemas/NodebResponse' '400': description: Invalid input content: @@ -301,40 +301,6 @@ components: servedNrCells: $ref: '#/components/schemas/ServedNrCells' additionalProperties: false - UpdateGnbResponse: - properties: - connectionStatus: - oneOf: - - type: string - - type: integer - failureType: - oneOf: - - type: string - - type: integer - globalNbId: - properties: - nbId: - type: string - plmnId: - type: string - additionalProperties: false - type: object - gnb: - $ref: '#/components/schemas/Gnb' - ip: - type: string - nodeType: - oneOf: - - type: string - - type: integer - port: - type: integer - ranName: - type: string - setupFailure: - $ref: '#/components/schemas/SetupFailure' - additionalProperties: false - type: object UpdateEnbRequest: type: object required: @@ -363,41 +329,6 @@ components: inventoryName: type: string type: object - GetNodebResponse: - properties: - connectionStatus: - oneOf: - - type: string - - type: integer - enb: - $ref: '#/components/schemas/Enb' - failureType: - oneOf: - - type: string - - type: integer - globalNbId: - properties: - nbId: - type: string - plmnId: - type: string - type: object - gnb: - $ref: '#/components/schemas/Gnb' - ip: - type: string - nodeType: - oneOf: - - type: string - - type: integer - port: - type: integer - ranName: - type: string - setupFailure: - $ref: '#/components/schemas/SetupFailure' - additionalProperties: false - type: object ErrorResponse: type: object required: @@ -1055,74 +986,6 @@ components: enb: $ref: '#/components/schemas/Enb' additionalProperties: false - AddEnbResponse: - properties: - connectionStatus: - oneOf: - - type: string - - type: integer - failureType: - oneOf: - - type: string - - type: integer - globalNbId: - properties: - nbId: - type: string - plmnId: - type: string - additionalProperties: false - type: object - enb: - $ref: '#/components/schemas/Enb' - ip: - type: string - nodeType: - oneOf: - - type: string - - type: integer - port: - type: integer - ranName: - type: string - setupFailure: - $ref: '#/components/schemas/SetupFailure' - additionalProperties: false - type: object - DeleteEnbResponse: - properties: - connectionStatus: - oneOf: - - type: string - - type: integer - failureType: - oneOf: - - type: string - - type: integer - globalNbId: - properties: - nbId: - type: string - plmnId: - type: string - additionalProperties: false - type: object - enb: - $ref: '#/components/schemas/Enb' - ip: - type: string - nodeType: - oneOf: - - type: string - - type: integer - port: - type: integer - ranName: - type: string - setupFailure: - $ref: '#/components/schemas/SetupFailure' - additionalProperties: false - type: object AdditionalCellInformation: properties: cellLatitude: -- 2.16.6