Some more test cases in rtmgr
Change-Id: I785f79370bb66ec32daa2bebf6d00e48c3f8aaa1
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
diff --git a/pkg/nbi/control.go b/pkg/nbi/control.go
index 5cde1b0..885230f 100644
--- a/pkg/nbi/control.go
+++ b/pkg/nbi/control.go
@@ -77,7 +77,6 @@
if sbiEngine, err = sbi.GetSbi(xapp.Config.GetString("sbi")); err == nil && sbiEngine != nil {
if sdlEngine, err = sdl.GetSdl(xapp.Config.GetString("sdl")); err == nil && sdlEngine != nil {
if rpeEngine, err = rpe.GetRpe(xapp.Config.GetString("rpe")); err == nil && rpeEngine != nil {
- fmt.Printf("%v,%v,%v,%v",nbiEngine, sbiEngine, sdlEngine, rpeEngine)
return nbiEngine, sbiEngine, sdlEngine, rpeEngine, nil
}
}
diff --git a/pkg/nbi/httprestful_test.go b/pkg/nbi/httprestful_test.go
index 438b617..2bece66 100644
--- a/pkg/nbi/httprestful_test.go
+++ b/pkg/nbi/httprestful_test.go
@@ -35,6 +35,7 @@
"io/ioutil"
"net"
"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+ xfmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models"
"net/http"
"net/http/httptest"
"os"
@@ -809,3 +810,17 @@
adddelrmrroute(routelist,false)
}
+
+func TestPopulateSubscription(t *testing.T) {
+ var sublist xfmodel.SubscriptionList
+
+ subdata := xfmodel.SubscriptionData { Endpoint: []string{"xapp1.com:3800"}, SubscriptionID: -1, Meid: "" }
+ subdata2 := xfmodel.SubscriptionData { Endpoint: []string{"xapp2.com:3800"}, SubscriptionID: 11, Meid: "" }
+ subdata3 := xfmodel.SubscriptionData { Endpoint: []string{"xapp3.com:3800"}, SubscriptionID: 221, Meid: "" }
+ sublist = append(sublist,&subdata)
+ sublist = append(sublist,&subdata2)
+ sublist = append(sublist,&subdata3)
+
+ PopulateSubscription(sublist)
+
+}
diff --git a/pkg/rtmgr/rtmgr.go b/pkg/rtmgr/rtmgr.go
index e5e0dcb..de7db00 100644
--- a/pkg/rtmgr/rtmgr.go
+++ b/pkg/rtmgr/rtmgr.go
@@ -39,87 +39,6 @@
)
var (
- //TODO: temporary solution
- // CamelCase Message Types are for being able to test with old fashioned admin control xApps
- // TODO: Add a separate message definition file (Not using the one from RMR to not create dependency on that library).
- MessageTypes = map[string]string{
- "HandoverPreparation": "0",
- "HandoverCancel": "1",
- "LoadIndication": "2",
- "ErrorIndication": "3",
- "SNStatusTransfer": "4",
- "UEContextRelease": "5",
- "X2Setup": "6",
- "Reset": "7",
- "E2_TERM_INIT": "1100",
- "E2_TERM_KEEP_ALIVE_REQ": "1101",
- "E2_TERM_KEEP_ALIVE_RESP": "1102",
- "RAN_CONNECTED": "1200",
- "RAN_RESTARTED": "1210",
- "RAN_RECONFIGURED": "1220",
- "RIC_SCTP_CLEAR_ALL": "1090",
- "RIC_SCTP_CONNECTION_FAILURE": "1080",
- "RIC_X2_SETUP": "10000",
- "RIC_X2_RESPONSE": "10001",
- "RIC_X2_RESOURCE_STATUS_REQUEST": "10002",
- "RIC_X2_RESOURCE_STATUS_RESPONSE": "10003",
- "RIC_X2_LOAD_INFORMATION": "10004",
- "RIC_E2_TERMINATION_HC_REQUEST": "10005",
- "RIC_E2_TERMINATION_HC_RESPONSE": "10006",
- "RIC_E2_MANAGER_HC_REQUEST": "10007",
- "RIC_E2_MANAGER_HC_RESPONSE": "10008",
- "RIC_ENB_LOAD_INFORMATION": "10020",
- "RIC_ERROR_INDICATION": "10030",
- "RIC_X2_SETUP_REQ": "10060",
- "RIC_X2_SETUP_RESP": "10061",
- "RIC_X2_SETUP_FAILURE": "10062",
- "RIC_X2_RESET_REQ": "10070",
- "RIC_X2_RESET_RESP": "10071",
- "RIC_ENB_CONF_UPDATE": "10080",
- "RIC_ENB_CONF_UPDATE_ACK": "10081",
- "RIC_ENB_CONF_UPDATE_FAILURE": "10082",
- "RIC_RES_STATUS_REQ": "10090",
- "RIC_RES_STATUS_RESP": "10091",
- "RIC_RES_STATUS_FAILURE": "10092",
- "RIC_RESOURCE_STATUS_UPDATE": "10100",
- "RIC_ENDC_X2_SETUP_REQ": "10360",
- "RIC_ENDC_X2_SETUP_RESP": "10361",
- "RIC_ENDC_X2_SETUP_FAILURE": "10362",
- "RIC_ENDC_CONF_UPDATE": "10370",
- "RIC_ENDC_CONF_UPDATE_ACK": "10371",
- "RIC_ENDC_CONF_UPDATE_FAILURE": "10372",
- "RIC_GNB_STATUS_INDICATION": "10450",
- "RIC_SUB_REQ": "12010",
- "RIC_SUB_RESP": "12011",
- "RIC_SUB_FAILURE": "12012",
- "RIC_SUB_DEL_REQ": "12020",
- "RIC_SUB_DEL_RESP": "12021",
- "RIC_SUB_DEL_FAILURE": "12022",
- "RIC_CONTROL_REQ": "12040",
- "RIC_CONTROL_ACK": "12041",
- "RIC_CONTROL_FAILURE": "12042",
- "RIC_INDICATION": "12050",
- "DC_ADM_INT_CONTROL": "20000",
- "DC_ADM_INT_CONTROL_ACK": "20001",
- "A1_POLICY_REQ": "20010",
- "A1_POLICY_RESPONSE": "20011",
- "A1_POLICY_QUERY": "20012",
- "RIC_CONTROL_XAPP_CONFIG_REQUEST": "100000",
- "RIC_CONTROL_XAPP_CONFIG_RESPONSE": "100001",
- }
-
- // Messagetype mappings for the platform components.
- // This implements static default routes needed by the RIC. Needs to be changed in case new components/message types needes to be added/updated.
- // Representation : {"componentName1": {"tx": <tx message type list>, "rx": <rx message type list>}}
- PLATFORMMESSAGETYPES = map[string]map[string][]string{
- "E2TERM": {"tx": []string{"RIC_X2_SETUP_REQ", "RIC_X2_SETUP_RESP", "RIC_X2_SETUP_FAILURE", "RIC_X2_RESET", "RIC_X2_RESET_RESP", "RIC_ENDC_X2_SETUP_REQ", "RIC_ENDC_X2_SETUP_RESP", "RIC_ENDC_X2_SETUP_FAILURE", "RIC_SUB_RESP", "RIC_SUB_FAILURE", "RIC_SUB_DEL_RESP", "RIC_SUB_DEL_FAILURE"}, "rx": []string{"RIC_X2_SETUP_REQ", "RIC_X2_SETUP_RESP", "RIC_X2_SETUP_FAILURE", "RIC_X2_RESET", "RIC_X2_RESET_RESP", "RIC_ENDC_X2_SETUP_REQ", "RIC_ENDC_X2_SETUP_RESP", "RIC_ENDC_X2_SETUP_FAILURE", "RIC_SUB_REQ", "RIC_SUB_DEL_REQ", "RIC_CONTROL_REQ"}},
- "E2MAN": {"tx": []string{"RIC_X2_SETUP_REQ", "RIC_X2_SETUP_RESP", "RIC_X2_SETUP_FAILURE", "RIC_X2_RESET", "RIC_X2_RESET_RESP", "RIC_ENDC_X2_SETUP_REQ", "RIC_ENDC_X2_SETUP_RESP", "RIC_ENDC_X2_SETUP_FAILURE"}, "rx": []string{"RIC_X2_SETUP_REQ", "RIC_X2_SETUP_RESP", "RIC_X2_SETUP_FAILURE", "RIC_X2_RESET", "RIC_X2_RESET_RESP", "RIC_ENDC_X2_SETUP_REQ", "RIC_ENDC_X2_SETUP_RESP", "RIC_ENDC_X2_SETUP_FAILURE"}},
- "SUBMAN": {"tx": []string{"RIC_SUB_REQ", "RIC_SUB_DEL_REQ"}, "rx": []string{"RIC_SUB_RESP", "RIC_SUB_FAILURE", "RIC_SUB_DEL_RESP", "RIC_SUB_DEL_FAILURE"}},
- "UEMAN": {"tx": []string{"RIC_CONTROL_REQ"}, "rx": []string{}},
- "RSM": {"tx": []string{"RIC_RES_STATUS_REQ"}, "rx": []string{"RAN_CONNECTED", "RAN_RESTARTED", "RAN_RECONFIGURED"}},
- "A1MEDIATOR": {"tx": []string{}, "rx": []string{"A1_POLICY_QUERY", "A1_POLICY_RESPONSE"}},
- }
-
Eps Endpoints
Subs SubscriptionList
PrsCfg *PlatformRoutes
diff --git a/pkg/rtmgr/rtmgr_test.go b/pkg/rtmgr/rtmgr_test.go
index 2f02b99..9ffca04 100644
--- a/pkg/rtmgr/rtmgr_test.go
+++ b/pkg/rtmgr/rtmgr_test.go
@@ -32,18 +32,14 @@
"testing"
)
-func TestSetLogLevel(t *testing.T) {
- modeIsOk := []string{"info", "warn", "debug", "error"}
- modeOsNok := []string{"inValId", "LogLEVEL", "Provided"}
- for _, value := range modeIsOk {
- if SetLogLevel(value) != nil {
- t.Error("Invalid log level: " + value)
- }
- }
+func TestGetPlatformComponents(t *testing.T) {
+ //Check epty file
+ _, err := GetPlatformComponents("")
+ t.Log(err)
- for _, value := range modeOsNok {
- if SetLogLevel(value) == nil {
- t.Error("Invalid log level: " + value)
- }
- }
+ //Valid JSON file
+ _, err = GetPlatformComponents("/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml")
+
+ //Invalid JSON file
+ _, err = GetPlatformComponents("./pkg/rtmg/rtmgr.go")
}
diff --git a/pkg/sbi/sbi.go b/pkg/sbi/sbi.go
index 6a878bb..018c111 100644
--- a/pkg/sbi/sbi.go
+++ b/pkg/sbi/sbi.go
@@ -128,8 +128,8 @@
XAppType: PlatformType,
Ip: pc.Fqdn,
Port: pc.Port,
- TxMessages: rtmgr.PLATFORMMESSAGETYPES[pc.Name]["tx"],
- RxMessages: rtmgr.PLATFORMMESSAGETYPES[pc.Name]["rx"],
+ //TxMessages: rtmgr.PLATFORMMESSAGETYPES[pc.Name]["tx"],
+ //RxMessages: rtmgr.PLATFORMMESSAGETYPES[pc.Name]["rx"],
Socket: nil,
IsReady: false,
Keepalive: true,
@@ -160,8 +160,8 @@
XAppType: PlatformType,
Ip: ipaddress,
Port: uint16(port),
- TxMessages: rtmgr.PLATFORMMESSAGETYPES[e2t.Name]["tx"],
- RxMessages: rtmgr.PLATFORMMESSAGETYPES[e2t.Name]["rx"],
+ //TxMessages: rtmgr.PLATFORMMESSAGETYPES[e2t.Name]["tx"],
+ //RxMessages: rtmgr.PLATFORMMESSAGETYPES[e2t.Name]["rx"],
Socket: nil,
IsReady: false,
Keepalive: true,