X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fconverters%2Fendc_x2setupResponseToProtobuf_test.go;h=11fa7048c56e86cc37de16989d7947469a739b13;hb=7b3d4e4225b50207370fae28e53f476bea309df8;hp=60b7e6ddef87203867dd4c1d182230709c894bcc;hpb=1ec13d4076e7c7abefac6176462c1fee31229213;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/converters/endc_x2setupResponseToProtobuf_test.go b/E2Manager/converters/endc_x2setupResponseToProtobuf_test.go index 60b7e6d..11fa704 100644 --- a/E2Manager/converters/endc_x2setupResponseToProtobuf_test.go +++ b/E2Manager/converters/endc_x2setupResponseToProtobuf_test.go @@ -1,5 +1,4 @@ -/******************************************************************************* - * +/* * Copyright (c) 2019 AT&T Intellectual Property. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,14 +12,18 @@ * 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 converters import ( "e2mgr/e2pdus" "e2mgr/logger" - "e2mgr/rNibWriter" "fmt" "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" "strings" @@ -35,16 +38,14 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) var testCases = []struct { - saveToRNib bool - key *entities.GlobalNbId - gnb string - packedPdu string - failure error + key *entities.GlobalNbId + gnb string + packedPdu string + failure error }{ { - saveToRNib: false, //TODO: use MOCK? - key: &entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}, - gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > ]", + key: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}, + gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > ]", /* E2AP-PDU: successfulOutcome_t @@ -152,9 +153,8 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { */ packedPdu: "202400808e00000100f600808640000200fc00090002f829504a952a0a00fd007200010c0005001e3f271f2e3d4ff03d44d34e4f003e4e5e4400010000150400000a000211e148033e4e5e4c0005001e3f271f2e3d4ff03d44d34e4f003e4e5e4400010000150400000a00021a0044033e4e5e000000002c001e3f271f2e3d4ff0031e3f274400010000150400000a00020000"}, { - saveToRNib: false, - key: &entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}, - gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > ]", + key: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}, + gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > ]", /* E2AP-PDU: successfulOutcome_t @@ -234,8 +234,7 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { packedPdu: "2024006500000100f6005e40000200fc00090002f829504a952a0a00fd004a00004c0005001e3f271f2e3d4ff03d44d34e4f003e4e5e4400010000150400000a000209e040033e4e5e000000002c001e3f271f2e3d4ff0031e3f274400050000150400000a00061820"}, { - saveToRNib: false, - key: &entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}, + key: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}, gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > ]", /* E2AP-PDU: @@ -344,9 +343,8 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { packedPdu: "202400808e00000100f600808640000200fc00090002f829504a952a0a00fd007200010c0005001e3f271f2e3d4ff03d44d34e4f003e4e5e4400010000150400000a000211e148033e4e5e4c0008002e3f451f2e3d4ff04faa3c1a2f0050321e4400040000060400000200081a00440350321e000000002c001e3f271f2e3d4ff0031e3f274400010000150400000a00020000"}, { - saveToRNib: false, - key: &entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}, - gnb: "CONNECTED [served_nr_cell_information: > dl_freq_info: > ul_transmission_bandwidth: dl_transmission_bandwidth: > > > nr_neighbour_infos: > dlar_fcn_freq_info: > > > > ]", + key: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}, + gnb: "CONNECTED [served_nr_cell_information: > dl_freq_info: > ul_transmission_bandwidth: dl_transmission_bandwidth: > > > nr_neighbour_infos: > dlar_fcn_freq_info: > > > > ]", /* E2AP-PDU: successfulOutcome_t @@ -435,9 +433,8 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { { - saveToRNib: false, - key: &entities.GlobalNbId{PlmnId:"04a5c1", NbId:"4fc52bff"}, - gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > nr_neighbour_infos: > frequency_bands: > > > > ]", + key: &entities.GlobalNbId{PlmnId: "04a5c1", NbId: "4fc52bff"}, + gnb: "CONNECTED [served_nr_cell_information: > frequency_bands: > transmission_bandwidth: > > > nr_neighbour_infos: > frequency_bands: > > > > nr_neighbour_infos: > frequency_bands: > > > > ]", /* E2AP-PDU: successfulOutcome_t @@ -536,7 +533,7 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { */ packedPdu: "202400808200000100f6007b40000200fc00090004a5c1504fc52bff00fd006700004c000900aeafa72a3e3b4cd07d4773477f007e7e7e4400080000150400000a0009020204037e7e7e000100002c005a5ff12a3e3b4cd0035a5ff144000500000304000002000608200009005d5caaaf3e354ac0035d5caa4400070000020400000000081860"}, - { key: &entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952aaa"}, + {key: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952aaa"}, /* E2AP-PDU: successfulOutcome_t @@ -562,7 +559,6 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { failure: fmt.Errorf("getList for path [successfulOutcome_t ENDCX2SetupResponse protocolIEs_t ProtocolIE_Container_elm RespondingNodeType-EndcX2Setup respond_en_gNB_t ProtocolIE_Container_elm ServedNRcellsENDCX2ManagementList ServedNRcellsENDCX2ManagementList_elm servedNRCellInfo_t nrpCI_t] failed, rc = 1" /*NO_ITEMS*/),}, } - initDb_f := true for _, tc := range testCases { t.Run(tc.packedPdu, func(t *testing.T) { @@ -580,9 +576,9 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { if tc.failure == nil { t.Errorf("want: success, got: error: %v\n", err) } else { - if strings.Compare(err.Error(), tc.failure.Error()) != 0 { - t.Errorf("want: %s, got: %s", tc.failure, err) - } + if strings.Compare(err.Error(), tc.failure.Error()) != 0 { + t.Errorf("want: %s, got: %s", tc.failure, err) + } } } @@ -591,7 +587,7 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { t.Errorf("want: key=%v, got: empty key", tc.key) } } else { - if strings.Compare(key.PlmnId, tc.key.PlmnId) != 0 || strings.Compare(key.NbId, tc.key.NbId) != 0{ + if strings.Compare(key.PlmnId, tc.key.PlmnId) != 0 || strings.Compare(key.NbId, tc.key.NbId) != 0 { t.Errorf("want: key=%v, got: %v", tc.key, key) } } @@ -603,31 +599,13 @@ func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) { } else { nb := &entities.NodebInfo{} nb.ConnectionStatus = entities.ConnectionStatus_CONNECTED - nb.Configuration = &entities.NodebInfo_Gnb{Gnb:gnb} + nb.Configuration = &entities.NodebInfo_Gnb{Gnb: gnb} gnbStr := fmt.Sprintf("%s %s", nb.ConnectionStatus, gnb.ServedNrCells) if !strings.EqualFold(gnbStr, tc.gnb) { t.Errorf("want: enb=%s, got: %s", tc.gnb, gnbStr) } - // Save to rNib - if tc.saveToRNib { - if initDb_f { - rNibWriter.Init("e2Manager", 1) - initDb_f = false - } - nbIdentity := &entities.NbIdentity{InventoryName:"RanName", GlobalNbId:key} - if rNibErr := rNibWriter.GetRNibWriter().SaveNodeb(nbIdentity, nb); rNibErr != nil { - if tc.failure == nil { - t.Errorf("rNibWriter failed to save ENB. Error: %v\n", rNibErr.Error()) - } else { - if strings.Compare(rNibErr.Error(), tc.failure.Error()) != 0 { - t.Errorf("want: %s, got: %s", tc.failure, rNibErr.Error()) - } - } - } - } } }) } } -