+func (r *Rpe) generateSubscriptionRoutes(selectedxAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
+ xapp.Logger.Debug("rpe.addSubscriptionRoutes invoked")
+ subscriptionList := &rtmgr.Subs
+ for _, subscription := range *subscriptionList {
+ xapp.Logger.Debug("Subscription: %v", subscription)
+ xAppUuid := subscription.Fqdn + ":" + strconv.Itoa(int(subscription.Port))
+ xapp.Logger.Debug("xApp UUID: %v", xAppUuid)
+ xAppEp := getEndpointByUuid(xAppUuid)
+ if xAppEp.Uuid == selectedxAppEp.Uuid {
+ xapp.Logger.Debug("xApp UUID is matched for selected xApp.UUID: %v and xApp.Name: %v", selectedxAppEp.Uuid, selectedxAppEp.Name)
+ /// TODO
+ //Subscription Manager -> xApp
+ r.addRoute("RIC_SUB_RESP", subManEp, xAppEp, routeTable, subscription.SubID, "")
+ r.addRoute("RIC_SUB_FAILURE", subManEp, xAppEp, routeTable, subscription.SubID, "")
+ r.addRoute("RIC_SUB_DEL_RESP", subManEp, xAppEp, routeTable, subscription.SubID, "")
+ r.addRoute("RIC_SUB_DEL_FAILURE", subManEp, xAppEp, routeTable, subscription.SubID, "")
+ //E2 Termination -> xApp
+ r.addRoute("RIC_INDICATION", nil, xAppEp, routeTable, subscription.SubID, "")
+ r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, subscription.SubID, "")
+ r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, subscription.SubID, "")
+ }
+ }
+}
+
+func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, rsmEp *rtmgr.Endpoint, a1mediatorEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
+ xapp.Logger.Debug("rpe.generatePlatformRoutes invoked")
+ //Platform Routes --- Subscription Routes
+ //Subscription Manager -> E2 Termination
+ for _, routes := range *rtmgr.PrsCfg {
+ var sendEp *rtmgr.Endpoint
+ var Ep *rtmgr.Endpoint
+ switch routes.SenderEndPoint {
+ case "SUBMAN":
+ sendEp = subManEp
+ case "E2MAN":
+ sendEp = e2ManEp
+ //case "UEMAN":
+ // sendEp = ueManEp
+ case "RSM":
+ sendEp = rsmEp
+ case "A1MEDIATOR":
+ sendEp = a1mediatorEp
+ }
+ switch routes.EndPoint {
+ case "SUBMAN":
+ Ep = subManEp
+ case "E2MAN":
+ Ep = e2ManEp
+ //case "UEMAN":
+ // Ep = ueManEp
+ case "RSM":
+ Ep = rsmEp
+ case "A1MEDIATOR":
+ Ep = a1mediatorEp
+ }
+
+ r.addRoute(routes.MessageType, sendEp, Ep, routeTable, routes.SubscriptionId, routes.Meid)
+ }
+
+ if len(e2TermEp) > 0 {
+ r.addRoute_rx_list("RIC_SCTP_CLEAR_ALL", e2ManEp, e2TermEp, routeTable, -1, "")
+ r.addRoute_rx_list("E2_TERM_KEEP_ALIVE_REQ", e2ManEp, e2TermEp, routeTable, -1, "")
+ r.addRoute_rx_list("RIC_E2_SETUP_RESP", e2ManEp, e2TermEp, routeTable, -1, "")
+ r.addRoute_rx_list("RIC_E2_SETUP_FAILURE", e2ManEp, e2TermEp, routeTable, -1, "")
+ }
+}
+
+func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable {
+ xapp.Logger.Debug("rpe.generateRouteTable invoked")
+ xapp.Logger.Debug("Endpoint List: %v", endPointList)
+ routeTable := &rtmgr.RouteTable{}
+ /*e2TermEp := getEndpointByName(&endPointList, "E2TERM")
+ if e2TermEp == nil {
+ xapp.Logger.Error("Platform component not found: %v", "E2 Termination")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }*/
+ subManEp := getEndpointByName(&endPointList, "SUBMAN")
+ if subManEp == nil {
+ xapp.Logger.Error("Platform component not found: %v", "Subscription Manager")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }
+ e2ManEp := getEndpointByName(&endPointList, "E2MAN")
+ if e2ManEp == nil {
+ xapp.Logger.Error("Platform component not found: %v", "E2 Manager")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }
+ /*ueManEp := getEndpointByName(&endPointList, "UEMAN")
+ if ueManEp == nil {
+ xapp.Logger.Error("Platform component not found: %v", "UE Manger")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }*/
+ rsmEp := getEndpointByName(&endPointList, "RSM")
+ if rsmEp == nil {
+ xapp.Logger.Error("Platform component not found: %v", "Resource Status Manager")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }
+ A1MediatorEp := getEndpointByName(&endPointList, "A1MEDIATOR")
+ if A1MediatorEp == nil {
+ xapp.Logger.Error("Platform component not found: %v", "A1Mediator")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }
+
+ e2TermListEp := getEndpointListByName(&endPointList, "E2TERMINST")
+ if len(e2TermListEp) == 0 {
+ xapp.Logger.Error("Platform component not found: %v", "E2 Termination List")
+ xapp.Logger.Debug("Endpoints: %v", endPointList)
+ }
+ r.generatePlatformRoutes(e2TermListEp, subManEp, e2ManEp, rsmEp, A1MediatorEp, routeTable)
+
+ for _, endPoint := range endPointList {
+ xapp.Logger.Debug("Endpoint: %v, xAppType: %v", endPoint.Name, endPoint.XAppType)
+ if endPoint.XAppType != sbi.PlatformType && (len(endPoint.TxMessages) > 0 || len(endPoint.RxMessages) > 0) {
+ r.generateXappRoutes(endPoint, subManEp, routeTable)
+ r.generateSubscriptionRoutes(endPoint, subManEp, routeTable)
+ r.generateXappToXappRoutes(endPoint, endPointList, routeTable)
+
+ }
+ }
+ return routeTable