X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fsbi%2Fsbi_test.go;h=68c7654eab22b4a7e13c2760621db9803b9ac882;hb=3ca5f9ed193345eb2d98323f58a460cdff7df3e3;hp=5c7e848acd1266cb910671e73a667a25e02a876e;hpb=92162653c9741f2417d1a36ec1c211d6863d0a68;p=ric-plt%2Frtmgr.git diff --git a/pkg/sbi/sbi_test.go b/pkg/sbi/sbi_test.go index 5c7e848..68c7654 100644 --- a/pkg/sbi/sbi_test.go +++ b/pkg/sbi/sbi_test.go @@ -14,6 +14,10 @@ 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). + ================================================================================== */ /* @@ -24,17 +28,18 @@ package sbi import ( - "testing" - "reflect" "errors" + "reflect" + "routing-manager/pkg/rtmgr" + "testing" ) func TestGetSbi(t *testing.T) { var errtype = errors.New("") - var sbitype = new(NngPub) + var sbitype = new(NngPush) var invalids = []string{"nngpus", ""} - sbii, err := GetSbi("nngpub") + sbii, err := GetSbi("nngpush") if err != nil { t.Errorf("GetSbi(nngpub) was incorrect, got: %v, want: %v.", reflect.TypeOf(err), nil) } @@ -49,3 +54,42 @@ func TestGetSbi(t *testing.T) { } } } + +func TestUpdateE2TendPoint(t *testing.T) { + var err error + var sbi = Sbi{} + sbii, err := GetSbi("nngpush") + + var EP = make(map[string]*rtmgr.Endpoint) + EP["127.0.0.2"] = &rtmgr.Endpoint{Uuid: "127.0.0.2", Name: "E2TERM", XAppType: "app1", Ip: "127.0.0.2", Port: 4562, TxMessages: []string{"", ""}, RxMessages: []string{"", ""}, Socket: nil, IsReady: true, Keepalive: false} + rtmgr.Eps = EP + + var nngpush = NngPush{} + nngpush.AddEndpoint(rtmgr.Eps["127.0.0.2"]) + + var E2map = make(map[string]rtmgr.E2TInstance) + + E2map["127.0.0.2:4562"] = rtmgr.E2TInstance{ + Name: "E2Tinstance1", + Fqdn: "127.0.0.2:4562", + Ranlist: []string{"1", "2"}, + } + + sbi.updateE2TEndpoints(&E2map, sbii) + t.Log(err) +} + +func TestPruneEndpointList(t *testing.T) { + var sbi = Sbi{} + var err error + sbii, err := GetSbi("nngpush") + var EP = make(map[string]*rtmgr.Endpoint) + EP["127.0.0.2"] = &rtmgr.Endpoint{Uuid: "127.0.0.2", Name: "E2TERM", XAppType: "app1", Ip: "127.0.0.1", Port: 4562, TxMessages: []string{"", ""}, RxMessages: []string{"", ""}, Socket: nil, IsReady: true, Keepalive: false} + rtmgr.Eps = EP + + var nngpush = NngPush{} + nngpush.AddEndpoint(rtmgr.Eps["127.0.0.2"]) + + sbi.pruneEndpointList(sbii) + t.Log(err) +}