Merge "Adding scope of RICPlatform that are under Apache License"
[ric-plt/rtmgr.git] / pkg / rpe / rpe.go
index 7e01179..9a36564 100644 (file)
    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).
+
 ==================================================================================
 */
 /*
@@ -28,8 +33,8 @@ import (
        "errors"
        "routing-manager/pkg/rtmgr"
        "routing-manager/pkg/sbi"
-       "strconv"
        "runtime"
+       "strconv"
 )
 
 var (
@@ -85,20 +90,20 @@ func (r *Rpe) addRoute(messageType string, tx *rtmgr.Endpoint, rx *rtmgr.Endpoin
                rxList := []rtmgr.EndpointList{[]rtmgr.Endpoint{*rx}}
                messageId := rtmgr.MessageTypes[messageType]
                route := rtmgr.RouteTableEntry{
-                               MessageType: messageId,
-                               TxList:      txList,
-                               RxGroups:    rxList,
-                               SubID:       subId}
-                               *routeTable = append(*routeTable, route)
-                       rtmgr.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
-                       rtmgr.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
-               } else {
-                       pc,_,_,ok := runtime.Caller(1)
-                       details := runtime.FuncForPC(pc)
-                       if ok && details != nil {
-                               rtmgr.Logger.Error("Route addition skipped: Either TX or RX endpoint not present. Caller function is %s", details.Name())
-                       }
+                       MessageType: messageId,
+                       TxList:      txList,
+                       RxGroups:    rxList,
+                       SubID:       subId}
+               *routeTable = append(*routeTable, route)
+               rtmgr.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
+               rtmgr.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
+       } else {
+               pc, _, _, ok := runtime.Caller(1)
+               details := runtime.FuncForPC(pc)
+               if ok && details != nil {
+                       rtmgr.Logger.Error("Route addition skipped: Either TX or RX endpoint not present. Caller function is %s", details.Name())
                }
+       }
 }
 
 func (r *Rpe) generateXappRoutes(xAppEp *rtmgr.Endpoint, e2TermEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
@@ -136,7 +141,7 @@ func (r *Rpe) generateSubscriptionRoutes(e2TermEp *rtmgr.Endpoint, subManEp *rtm
        }
 }
 
-func (r *Rpe) generatePlatformRoutes(e2TermEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, ueManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
+func (r *Rpe) generatePlatformRoutes(e2TermEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, ueManEp *rtmgr.Endpoint, rsmEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
        rtmgr.Logger.Debug("rpe.generatePlatformRoutes invoked")
        //Platform Routes --- Subscription Routes
        //Subscription Manager -> E2 Termination
@@ -168,7 +173,7 @@ func (r *Rpe) generatePlatformRoutes(e2TermEp *rtmgr.Endpoint, subManEp *rtmgr.E
        //E2 Termination -> E2 Manager
        r.addRoute("E2_TERM_INIT", e2TermEp, e2ManEp, routeTable, -1)
        r.addRoute("RIC_X2_SETUP_RESP", e2TermEp, e2ManEp, routeTable, -1)
-       r.addRoute("RIC_X2_SETUP_FAILURE", e2ManEp, e2TermEp, routeTable, -1)
+       r.addRoute("RIC_X2_SETUP_FAILURE", e2TermEp, e2ManEp, routeTable, -1)
        r.addRoute("RIC_X2_RESET_REQ", e2TermEp, e2ManEp, routeTable, -1)
        r.addRoute("RIC_X2_RESET_RESP", e2TermEp, e2ManEp, routeTable, -1)
        r.addRoute("RIC_ENDC_X2_SETUP_RESP", e2TermEp, e2ManEp, routeTable, -1)
@@ -178,6 +183,15 @@ func (r *Rpe) generatePlatformRoutes(e2TermEp *rtmgr.Endpoint, subManEp *rtmgr.E
        r.addRoute("RIC_ERROR_INDICATION", e2TermEp, e2ManEp, routeTable, -1)
        r.addRoute("RIC_ENB_CONF_UPDATE", e2TermEp, e2ManEp, routeTable, -1)
        r.addRoute("RIC_ENB_LOAD_INFORMATION", e2TermEp, e2ManEp, routeTable, -1)
+       //E2 Manager -> Resource Status Manager
+       r.addRoute("RAN_CONNECTED", e2ManEp, rsmEp, routeTable, -1)
+       r.addRoute("RAN_RESTARTED", e2ManEp, rsmEp, routeTable, -1)
+       r.addRoute("RAN_RECONFIGURED", e2ManEp, rsmEp, routeTable, -1)
+       //Resource Status Manager -> E2 Termination
+       r.addRoute("RIC_RES_STATUS_REQ", rsmEp, e2TermEp, routeTable, -1)
+       //E2 Termination -> Resource Status Manager
+       r.addRoute("RIC_RES_STATUS_RESP", e2TermEp, rsmEp, routeTable, -1)
+       r.addRoute("RIC_RES_STATUS_FAILURE", e2TermEp, rsmEp, routeTable, -1)
 }
 
 func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable {
@@ -204,7 +218,12 @@ func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable
                rtmgr.Logger.Error("Platform component not found: %v", "UE Manger")
                rtmgr.Logger.Debug("Endpoints: %v", endPointList)
        }
-       r.generatePlatformRoutes(e2TermEp, subManEp, e2ManEp, ueManEp, routeTable)
+       rsmEp := getEndpointByName(&endPointList, "RSM")
+       if rsmEp == nil {
+               rtmgr.Logger.Error("Platform component not found: %v", "Resource Status Manager")
+               rtmgr.Logger.Debug("Endpoints: %v", endPointList)
+       }
+       r.generatePlatformRoutes(e2TermEp, subManEp, e2ManEp, ueManEp, rsmEp, routeTable)
 
        for _, endPoint := range endPointList {
                rtmgr.Logger.Debug("Endpoint: %v, xAppType: %v", endPoint.Name, endPoint.XAppType)