2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
18 This source code is part of the near-RT RIC (RAN Intelligent Controller)
19 platform project (RICP).
21 ==================================================================================
33 "routing-manager/pkg/rtmgr"
37 func TestGetSbi(t *testing.T) {
38 var errtype = errors.New("")
39 var sbitype = new(RmrPush)
40 var invalids = []string{"rmrpus", ""}
42 sbii, err := GetSbi("rmrpush")
44 t.Errorf("GetSbi(rmrpub) was incorrect, got: %v, want: %v.", reflect.TypeOf(err), nil)
46 if reflect.TypeOf(sbii) != reflect.TypeOf(sbitype) {
47 t.Errorf("GetSbi(rmrpub) was incorrect, got: %v, want: %v.", reflect.TypeOf(sbii), reflect.TypeOf(sbitype))
50 for _, arg := range invalids {
53 t.Errorf("GetSbi("+arg+") was incorrect, got: %v, want: %v.", reflect.TypeOf(err), reflect.TypeOf(errtype))
58 func TestUpdateE2TendPoint(t *testing.T) {
61 sbii, err := GetSbi("rmrpush")
63 var EP = make(map[string]*rtmgr.Endpoint)
64 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}
67 var rmrpush = RmrPush{}
68 rmrpush.AddEndpoint(rtmgr.Eps["127.0.0.2"])
70 var E2map = make(map[string]rtmgr.E2TInstance)
72 E2map["127.0.0.2:4562"] = rtmgr.E2TInstance{
74 Fqdn: "127.0.0.2:4562",
75 Ranlist: []string{"1", "2"},
78 sbi.updateE2TEndpoints(&E2map, sbii)
82 func TestPruneEndpointList(t *testing.T) {
85 sbii, err := GetSbi("rmrpush")
86 var EP = make(map[string]*rtmgr.Endpoint)
87 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}
90 var rmrpush = RmrPush{}
91 rmrpush.AddEndpoint(rtmgr.Eps["127.0.0.2"])
93 sbi.pruneEndpointList(sbii)