X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frpe%2Frpe.go;h=0ca7ca40f875dbeae7134325e0bb722804885dba;hb=refs%2Fchanges%2F77%2F7977%2F1;hp=3a3eac1e20b1fd870a0f469ea36be456aa983fd4;hpb=bceb7d41dd5a7785982844faa9ea2171fe5b8dc4;p=ric-plt%2Frtmgr.git diff --git a/pkg/rpe/rpe.go b/pkg/rpe/rpe.go index 3a3eac1..0ca7ca4 100644 --- a/pkg/rpe/rpe.go +++ b/pkg/rpe/rpe.go @@ -31,11 +31,13 @@ package rpe import ( "errors" - "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" + "routing-manager/pkg/models" "routing-manager/pkg/rtmgr" "routing-manager/pkg/sbi" "runtime" "strconv" + + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) var ( @@ -106,7 +108,7 @@ func (r *Rpe) addRoute(messageType string, tx *rtmgr.Endpoint, rx *rtmgr.Endpoin pc, _, _, ok := runtime.Caller(1) details := runtime.FuncForPC(pc) if ok && details != nil { - xapp.Logger.Error("Route addition skipped: Either TX or RX endpoint not present. Caller function is %s", details.Name()) + xapp.Logger.Error("Addition of route skipped due to either TX or RX endpoint not present. Caller function is %s", details.Name()) } } else { if tx != nil { @@ -124,8 +126,8 @@ func (r *Rpe) addRoute(messageType string, tx *rtmgr.Endpoint, rx *rtmgr.Endpoin SubID: subId, RouteType: routeType} *routeTable = append(*routeTable, route) - // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId) - // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId) + // xapp.Logger.Debug("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId) + // xapp.Logger.Trace("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId) } } @@ -153,8 +155,8 @@ func (r *Rpe) addRoute_rx_list(messageType string, tx *rtmgr.Endpoint, rx []rtmg SubID: subId, RouteType: routeType} *routeTable = append(*routeTable, route) - // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId) - // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId) + // xapp.Logger.Debug("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, SubId) + // xapp.Logger.Trace("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, SubId) } func (r *Rpe) generateXappRoutes(xAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { @@ -224,7 +226,7 @@ func (r *Rpe) generateXappToXappRoutes(RecvxAppEp *rtmgr.Endpoint, endPointList xapp.Logger.Debug("Appending Message type %v,for SrcxAppEp.Name %v", rxmsg, RecvxAppEp) RxGrp = append(RxGrp, *RecvxAppEp) r.addRoute_rx_list(rxmsg, nil, RxGrp, routeTable, -1, "") - return + //return } } } @@ -258,7 +260,27 @@ func (r *Rpe) generateSubscriptionRoutes(selectedxAppEp *rtmgr.Endpoint, subManE } } -func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, rsmEp *rtmgr.Endpoint, a1mediatorEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { +func (r *Rpe) generatePartialSubscriptionTable(xappSubData *models.XappSubscriptionData, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { + xapp.Logger.Debug("rpe.addSingleSubscriptionRoutes invoked") + xAppUuid := *xappSubData.Address + ":" + strconv.Itoa(int(*xappSubData.Port)) + xapp.Logger.Debug("xApp UUID: %v", xAppUuid) + xAppEp := getEndpointByUuid(xAppUuid) + if xAppEp != nil { + //Subscription Manager -> xApp + r.addRoute("RIC_SUB_RESP", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + r.addRoute("RIC_SUB_FAILURE", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + r.addRoute("RIC_SUB_DEL_RESP", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + r.addRoute("RIC_SUB_DEL_FAILURE", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + //E2 Termination -> xApp + r.addRoute("RIC_INDICATION", nil, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, *xappSubData.SubscriptionID, "") + } else { + xapp.Logger.Error("generateSubscriptionRoutes xAppEp is nil, xApp UUID: %v", xAppUuid) + } +} + +func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, a1mediatorEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { xapp.Logger.Debug("rpe.generatePlatformRoutes invoked") //Platform Routes --- Subscription Routes //Subscription Manager -> E2 Termination @@ -274,8 +296,8 @@ func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr. sendEp = subManEp case "E2MAN": sendEp = e2ManEp - case "RSM": - sendEp = rsmEp + //case "RSM":, + // sendEp = rsmEp case "A1MEDIATOR": sendEp = a1mediatorEp } @@ -286,8 +308,8 @@ func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr. Ep = e2ManEp //case "UEMAN": // Ep = ueManEp - case "RSM": - Ep = rsmEp + //case "RSM": + // Ep = rsmEp case "A1MEDIATOR": Ep = a1mediatorEp } @@ -300,7 +322,57 @@ func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr. 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, "") + r.addRoute_rx_list("RIC_SERVICE_UPDATE_ACK", e2ManEp, e2TermEp, routeTable, -1, "") + r.addRoute_rx_list("RIC_SERVICE_UPDATE_FAILURE", e2ManEp, e2TermEp, routeTable, -1, "") + } +} + +func (r *Rpe) generatePartialRouteTable(endPointList rtmgr.Endpoints, xappSubData *models.XappSubscriptionData, updatetype rtmgr.RMRUpdateType) *rtmgr.RouteTable { + xapp.Logger.Debug("rpe.generatePartialRouteTable invoked") + xapp.Logger.Debug("Endpoint List: %v", endPointList) + routeTable := &rtmgr.RouteTable{} + subManEp := getEndpointByName(&endPointList, "SUBMAN") + if subManEp == nil { + xapp.Logger.Error("Platform component not found: %v", "Subscription Manager") + 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) + } + e2ManEp := getEndpointByName(&endPointList, "E2MAN") + if e2ManEp == nil { + xapp.Logger.Error("Platform component not found: %v", "E2 Manager") + xapp.Logger.Debug("Endpoints: %v", endPointList) + }*/ + + if xappSubData != nil && updatetype == rtmgr.SubsType { + xapp.Logger.Info("Updating partial subscription routes") + r.generatePartialSubscriptionTable(xappSubData, subManEp, routeTable) } + /*if updatetype == rtmgr.XappType { + xapp.Logger.Info("Updating partial xapp routes") + 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.generateXappToXappRoutes(endPoint, endPointList, routeTable) + } + } + } + if updatetype == rtmgr.E2Type { + xapp.Logger.Info("Updating partial E2 routes") + if len(e2TermListEp) > 0 { + r.addRoute_rx_list("RIC_SCTP_CLEAR_ALL", e2ManEp, e2TermListEp, routeTable, -1, "") + r.addRoute_rx_list("E2_TERM_KEEP_ALIVE_REQ", e2ManEp, e2TermListEp, routeTable, -1, "") + r.addRoute_rx_list("RIC_E2_SETUP_RESP", e2ManEp, e2TermListEp, routeTable, -1, "") + r.addRoute_rx_list("RIC_E2_SETUP_FAILURE", e2ManEp, e2TermListEp, routeTable, -1, "") + } + }*/ + + return routeTable + } func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable { @@ -322,11 +394,11 @@ func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable xapp.Logger.Error("Platform component not found: %v", "E2 Manager") xapp.Logger.Debug("Endpoints: %v", endPointList) } - rsmEp := getEndpointByName(&endPointList, "RSM") + /*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") @@ -338,7 +410,7 @@ func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable 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) + r.generatePlatformRoutes(e2TermListEp, subManEp, e2ManEp, A1MediatorEp, routeTable) for _, endPoint := range endPointList { xapp.Logger.Debug("Endpoint: %v, xAppType: %v", endPoint.Name, endPoint.XAppType)