Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 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 |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 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. |
wahidw | 761934a | 2019-11-27 06:07:26 +0000 | [diff] [blame] | 17 | |
| 18 | |
| 19 | This source code is part of the near-RT RIC (RAN Intelligent Controller) |
| 20 | platform project (RICP). |
| 21 | |
Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 22 | ================================================================================== |
| 23 | */ |
| 24 | /* |
| 25 | Mnemonic: rpe.go |
| 26 | Abstract: Contains RPE (Route Policy Engine) module definitions and generic RPE components |
| 27 | Date: 16 March 2019 |
| 28 | */ |
| 29 | |
| 30 | package rpe |
| 31 | |
| 32 | import ( |
| 33 | "errors" |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 34 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 35 | "routing-manager/pkg/rtmgr" |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 36 | "routing-manager/pkg/sbi" |
prabhukaliswamy | b47d12d | 2019-12-03 15:06:30 +0000 | [diff] [blame] | 37 | "runtime" |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 38 | "strconv" |
Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | var ( |
zkoczka | aaf8d39 | 2019-10-02 17:16:06 +0200 | [diff] [blame] | 42 | SupportedRpes = []*EngineConfig{ |
| 43 | { |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 44 | Name: "rmrpush", |
| 45 | Version: "pubsush", |
| 46 | Protocol: "rmruta", |
| 47 | Instance: NewRmrPush(), |
| 48 | IsAvailable: true, |
Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 49 | }, |
| 50 | } |
| 51 | ) |
| 52 | |
zkoczka | aaf8d39 | 2019-10-02 17:16:06 +0200 | [diff] [blame] | 53 | func GetRpe(rpeName string) (Engine, error) { |
Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 54 | for _, rpe := range SupportedRpes { |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 55 | if rpe.Name == rpeName && rpe.IsAvailable { |
| 56 | return rpe.Instance, nil |
Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 57 | } |
| 58 | } |
Peter Szilagyi | 16d84d6 | 2019-04-24 14:51:02 +0000 | [diff] [blame] | 59 | return nil, errors.New("SBI:" + rpeName + " is not supported or still not a available") |
Balint Uveges | 871fa39 | 2019-04-02 20:31:11 +0000 | [diff] [blame] | 60 | } |
| 61 | |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 62 | type Rpe struct { |
| 63 | } |
| 64 | |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 65 | func getEndpointByName(eps *rtmgr.Endpoints, name string) *rtmgr.Endpoint { |
| 66 | for _, ep := range *eps { |
| 67 | if ep.Name == name { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 68 | xapp.Logger.Debug("name: %s", ep.Name) |
| 69 | xapp.Logger.Debug("ep: %v", ep) |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 70 | return ep |
| 71 | } |
| 72 | } |
| 73 | return nil |
| 74 | } |
| 75 | |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 76 | func getEndpointListByName(eps *rtmgr.Endpoints, name string) []rtmgr.Endpoint { |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 77 | var eplist []rtmgr.Endpoint |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 78 | |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 79 | for _, ep := range *eps { |
| 80 | if ep.Name == name { |
| 81 | xapp.Logger.Debug("name: %s", ep.Name) |
| 82 | xapp.Logger.Debug("ep: %v", ep) |
| 83 | eplist = append(eplist, *ep) |
| 84 | } |
| 85 | } |
| 86 | return eplist |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 87 | } |
| 88 | |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 89 | func getEndpointByUuid(uuid string) *rtmgr.Endpoint { |
| 90 | endPoints := rtmgr.Eps |
| 91 | for _, ep := range endPoints { |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 92 | if ep.Uuid == uuid { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 93 | xapp.Logger.Debug("name: %s", ep.Uuid) |
| 94 | xapp.Logger.Debug("ep: %v", ep) |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 95 | return ep |
| 96 | } |
| 97 | } |
| 98 | return nil |
| 99 | } |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 100 | |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 101 | func (r *Rpe) addRoute(messageType string, tx *rtmgr.Endpoint, rx *rtmgr.Endpoint, routeTable *rtmgr.RouteTable, subId int32, routeType string) { |
| 102 | txList := rtmgr.EndpointList{} |
| 103 | rxList := []rtmgr.EndpointList{} |
| 104 | |
| 105 | if tx == nil && rx == nil { |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 106 | pc, _, _, ok := runtime.Caller(1) |
| 107 | details := runtime.FuncForPC(pc) |
| 108 | if ok && details != nil { |
| 109 | xapp.Logger.Error("Route addition skipped: Either TX or RX endpoint not present. Caller function is %s", details.Name()) |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 110 | } |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 111 | } else { |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 112 | if tx != nil { |
| 113 | txList = rtmgr.EndpointList{*tx} |
| 114 | } |
| 115 | if rx != nil { |
| 116 | rxList = []rtmgr.EndpointList{[]rtmgr.Endpoint{*rx}} |
| 117 | } |
| 118 | messageId := strconv.Itoa(xapp.RICMessageTypes[messageType]) |
| 119 | route := rtmgr.RouteTableEntry{ |
| 120 | MessageType: messageId, |
| 121 | TxList: txList, |
| 122 | RxGroups: rxList, |
| 123 | SubID: subId, |
| 124 | RouteType: routeType} |
| 125 | *routeTable = append(*routeTable, route) |
| 126 | // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId) |
| 127 | // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId) |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 128 | } |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 129 | } |
| 130 | |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 131 | func (r *Rpe) addRoute_rx_list(messageType string, tx *rtmgr.Endpoint, rx []rtmgr.Endpoint, routeTable *rtmgr.RouteTable, subId int32, routeType string) { |
| 132 | txList := rtmgr.EndpointList{} |
| 133 | rxList := []rtmgr.EndpointList{} |
| 134 | |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 135 | if tx != nil { |
| 136 | txList = rtmgr.EndpointList{*tx} |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 137 | } |
| 138 | |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 139 | if rx != nil { |
wahidw | 6977ffd | 2020-02-08 19:00:02 +0000 | [diff] [blame] | 140 | for _, item := range rx { |
| 141 | ep := []rtmgr.Endpoint{item} |
| 142 | rxList = append(rxList, ep) |
| 143 | } |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 144 | } |
| 145 | |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 146 | messageId := strconv.Itoa(xapp.RICMessageTypes[messageType]) |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 147 | route := rtmgr.RouteTableEntry{ |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 148 | MessageType: messageId, |
| 149 | TxList: txList, |
| 150 | RxGroups: rxList, |
| 151 | SubID: subId, |
| 152 | RouteType: routeType} |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 153 | *routeTable = append(*routeTable, route) |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 154 | // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId) |
| 155 | // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId) |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 156 | } |
| 157 | |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 158 | func (r *Rpe) generateXappRoutes(xAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 159 | xapp.Logger.Debug("rpe.generateXappRoutes invoked") |
| 160 | xapp.Logger.Debug("Endpoint: %v, xAppType: %v", xAppEp.Name, xAppEp.XAppType) |
| 161 | if xAppEp.XAppType != sbi.PlatformType && (len(xAppEp.TxMessages) > 0 || len(xAppEp.RxMessages) > 0) { |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 162 | /// TODO --- |
zkoczka | aaf8d39 | 2019-10-02 17:16:06 +0200 | [diff] [blame] | 163 | //xApp -> Subscription Manager |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 164 | r.addRoute("RIC_SUB_REQ", xAppEp, subManEp, routeTable, -1, "") |
| 165 | r.addRoute("RIC_SUB_DEL_REQ", xAppEp, subManEp, routeTable, -1, "") |
zkoczka | aaf8d39 | 2019-10-02 17:16:06 +0200 | [diff] [blame] | 166 | //xApp -> E2 Termination |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 167 | // r.addRoute("RIC_CONTROL_REQ", xAppEp, e2TermEp, routeTable, -1, "") |
prabhukaliswamy | e110ee0 | 2019-12-23 09:51:01 +0000 | [diff] [blame] | 168 | r.addRoute("RIC_CONTROL_REQ", xAppEp, nil, routeTable, -1, "%meid") |
zkoczka | b95b076 | 2019-10-29 13:05:48 +0100 | [diff] [blame] | 169 | //E2 Termination -> xApp |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 170 | /// r.addRoute("RIC_CONTROL_ACK", e2TermEp, xAppEp, routeTable, -1, "") |
| 171 | /// r.addRoute("RIC_CONTROL_FAILURE", e2TermEp, xAppEp, routeTable, -1, "") |
prabhukaliswamy | e110ee0 | 2019-12-23 09:51:01 +0000 | [diff] [blame] | 172 | r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, -1, "") |
| 173 | r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, -1, "") |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 174 | } |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 175 | //xApp->A1Mediator |
| 176 | if xAppEp.XAppType != sbi.PlatformType && len(xAppEp.Policies) > 0 { |
| 177 | xapp.Logger.Debug("rpe.generateXappRoutes found policies section") |
| 178 | for _, policy := range xAppEp.Policies { |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 179 | r.addRoute("A1_POLICY_REQ", nil, xAppEp, routeTable, policy, "") |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 180 | } |
| 181 | } |
| 182 | |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 183 | } |
| 184 | |
rangajal | 0baa70d | 2020-03-31 12:28:53 +0000 | [diff] [blame] | 185 | |
| 186 | func (r *Rpe) generateXappToXappRoutes(RecvxAppEp *rtmgr.Endpoint, endPointList rtmgr.Endpoints, routeTable *rtmgr.RouteTable) { |
| 187 | xapp.Logger.Debug("rpe.generateXappToXappRoutes invoked") |
| 188 | |
| 189 | for _, rxmsg := range RecvxAppEp.RxMessages { |
| 190 | |
| 191 | var src_present bool |
| 192 | xapp.Logger.Debug("RecvxAppEp.RxMessages Endpoint: %v, xAppType: %v and rxmsg: %v ", RecvxAppEp.Name, RecvxAppEp.XAppType, rxmsg) |
| 193 | if (rxmsg != "RIC_SUB_RESP" && rxmsg != "RIC_SUB_FAILURE" && rxmsg != "RIC_SUB_DEL_RESP" && rxmsg != "RIC_SUB_DEL_FAILURE" && rxmsg != "RIC_INDICATION" && rxmsg != "RIC_CONTROL_ACK" && rxmsg != "RIC_CONTROL_FAILURE" && rxmsg != "A1_POLICY_REQ") { |
| 194 | for _, SrcxAppEp := range endPointList { |
| 195 | if SrcxAppEp.XAppType != sbi.PlatformType && (len(SrcxAppEp.TxMessages) > 0) && SrcxAppEp.Name != RecvxAppEp.Name { |
| 196 | for _, txmsg := range SrcxAppEp.TxMessages { |
| 197 | if (rxmsg == txmsg) { |
| 198 | r.addRoute(rxmsg, SrcxAppEp, RecvxAppEp, routeTable, -1, "") |
| 199 | src_present = true |
| 200 | break |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | if src_present == false { |
| 206 | r.addRoute(rxmsg, nil, RecvxAppEp, routeTable, -1, "") |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | } |
| 211 | } |
| 212 | |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 213 | func (r *Rpe) generateSubscriptionRoutes(selectedxAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 214 | xapp.Logger.Debug("rpe.addSubscriptionRoutes invoked") |
zkoczka | aaf8d39 | 2019-10-02 17:16:06 +0200 | [diff] [blame] | 215 | subscriptionList := &rtmgr.Subs |
| 216 | for _, subscription := range *subscriptionList { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 217 | xapp.Logger.Debug("Subscription: %v", subscription) |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 218 | xAppUuid := subscription.Fqdn + ":" + strconv.Itoa(int(subscription.Port)) |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 219 | xapp.Logger.Debug("xApp UUID: %v", xAppUuid) |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 220 | xAppEp := getEndpointByUuid(xAppUuid) |
rangajal | d14518e | 2020-04-21 12:33:37 +0000 | [diff] [blame^] | 221 | if xAppEp != nil { |
| 222 | if xAppEp.Uuid == selectedxAppEp.Uuid { |
| 223 | xapp.Logger.Debug("xApp UUID is matched for selected xApp.UUID: %v and xApp.Name: %v", selectedxAppEp.Uuid, selectedxAppEp.Name) |
| 224 | /// TODO |
| 225 | //Subscription Manager -> xApp |
| 226 | r.addRoute("RIC_SUB_RESP", subManEp, xAppEp, routeTable, subscription.SubID, "") |
| 227 | r.addRoute("RIC_SUB_FAILURE", subManEp, xAppEp, routeTable, subscription.SubID, "") |
| 228 | r.addRoute("RIC_SUB_DEL_RESP", subManEp, xAppEp, routeTable, subscription.SubID, "") |
| 229 | r.addRoute("RIC_SUB_DEL_FAILURE", subManEp, xAppEp, routeTable, subscription.SubID, "") |
| 230 | //E2 Termination -> xApp |
| 231 | r.addRoute("RIC_INDICATION", nil, xAppEp, routeTable, subscription.SubID, "") |
| 232 | r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, subscription.SubID, "") |
| 233 | r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, subscription.SubID, "") |
| 234 | } |
| 235 | } else { |
| 236 | xapp.Logger.Error("generateSubscriptionRoutes xAppEp is nil, xApp UUID: %v", xAppUuid) |
prabhukaliswamy | b47d12d | 2019-12-03 15:06:30 +0000 | [diff] [blame] | 237 | } |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 241 | func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, rsmEp *rtmgr.Endpoint, a1mediatorEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 242 | xapp.Logger.Debug("rpe.generatePlatformRoutes invoked") |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 243 | //Platform Routes --- Subscription Routes |
| 244 | //Subscription Manager -> E2 Termination |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 245 | for _, routes := range *rtmgr.PrsCfg { |
| 246 | var sendEp *rtmgr.Endpoint |
| 247 | var Ep *rtmgr.Endpoint |
| 248 | switch routes.SenderEndPoint { |
| 249 | case "SUBMAN": |
| 250 | sendEp = subManEp |
| 251 | case "E2MAN": |
| 252 | sendEp = e2ManEp |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 253 | //case "UEMAN": |
| 254 | // sendEp = ueManEp |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 255 | case "RSM": |
| 256 | sendEp = rsmEp |
| 257 | case "A1MEDIATOR": |
| 258 | sendEp = a1mediatorEp |
| 259 | } |
| 260 | switch routes.EndPoint { |
| 261 | case "SUBMAN": |
| 262 | Ep = subManEp |
| 263 | case "E2MAN": |
| 264 | Ep = e2ManEp |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 265 | //case "UEMAN": |
| 266 | // Ep = ueManEp |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 267 | case "RSM": |
| 268 | Ep = rsmEp |
| 269 | case "A1MEDIATOR": |
| 270 | Ep = a1mediatorEp |
| 271 | } |
rangajal | 6d20904 | 2020-01-08 12:18:39 +0000 | [diff] [blame] | 272 | |
wahidw | da0fd3a | 2020-01-01 04:28:41 +0000 | [diff] [blame] | 273 | r.addRoute(routes.MessageType, sendEp, Ep, routeTable, routes.SubscriptionId, routes.Meid) |
| 274 | } |
rangajal | 6d20904 | 2020-01-08 12:18:39 +0000 | [diff] [blame] | 275 | |
| 276 | if len(e2TermEp) > 0 { |
| 277 | r.addRoute_rx_list("RIC_SCTP_CLEAR_ALL", e2ManEp, e2TermEp, routeTable, -1, "") |
| 278 | r.addRoute_rx_list("E2_TERM_KEEP_ALIVE_REQ", e2ManEp, e2TermEp, routeTable, -1, "") |
wahidw | dd6b056 | 2020-03-31 03:09:45 +0000 | [diff] [blame] | 279 | r.addRoute_rx_list("RIC_E2_SETUP_RESP", e2ManEp, e2TermEp, routeTable, -1, "") |
| 280 | r.addRoute_rx_list("RIC_E2_SETUP_FAILURE", e2ManEp, e2TermEp, routeTable, -1, "") |
rangajal | 6d20904 | 2020-01-08 12:18:39 +0000 | [diff] [blame] | 281 | } |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 285 | xapp.Logger.Debug("rpe.generateRouteTable invoked") |
| 286 | xapp.Logger.Debug("Endpoint List: %v", endPointList) |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 287 | routeTable := &rtmgr.RouteTable{} |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 288 | /*e2TermEp := getEndpointByName(&endPointList, "E2TERM") |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 289 | if e2TermEp == nil { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 290 | xapp.Logger.Error("Platform component not found: %v", "E2 Termination") |
| 291 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 292 | }*/ |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 293 | subManEp := getEndpointByName(&endPointList, "SUBMAN") |
| 294 | if subManEp == nil { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 295 | xapp.Logger.Error("Platform component not found: %v", "Subscription Manager") |
| 296 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 297 | } |
| 298 | e2ManEp := getEndpointByName(&endPointList, "E2MAN") |
| 299 | if e2ManEp == nil { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 300 | xapp.Logger.Error("Platform component not found: %v", "E2 Manager") |
| 301 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 302 | } |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 303 | /*ueManEp := getEndpointByName(&endPointList, "UEMAN") |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 304 | if ueManEp == nil { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 305 | xapp.Logger.Error("Platform component not found: %v", "UE Manger") |
| 306 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 307 | }*/ |
prabhukaliswamy | be9f268 | 2019-11-22 07:24:09 +0000 | [diff] [blame] | 308 | rsmEp := getEndpointByName(&endPointList, "RSM") |
| 309 | if rsmEp == nil { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 310 | xapp.Logger.Error("Platform component not found: %v", "Resource Status Manager") |
| 311 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
prabhukaliswamy | be9f268 | 2019-11-22 07:24:09 +0000 | [diff] [blame] | 312 | } |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 313 | A1MediatorEp := getEndpointByName(&endPointList, "A1MEDIATOR") |
| 314 | if A1MediatorEp == nil { |
| 315 | xapp.Logger.Error("Platform component not found: %v", "A1Mediator") |
| 316 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
| 317 | } |
| 318 | |
rangajal | 749099b | 2019-12-10 09:37:08 +0000 | [diff] [blame] | 319 | e2TermListEp := getEndpointListByName(&endPointList, "E2TERMINST") |
| 320 | if len(e2TermListEp) == 0 { |
| 321 | xapp.Logger.Error("Platform component not found: %v", "E2 Termination List") |
| 322 | xapp.Logger.Debug("Endpoints: %v", endPointList) |
| 323 | } |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 324 | r.generatePlatformRoutes(e2TermListEp, subManEp, e2ManEp, rsmEp, A1MediatorEp, routeTable) |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 325 | |
| 326 | for _, endPoint := range endPointList { |
wahidw | a8596ec | 2019-12-05 06:30:42 +0000 | [diff] [blame] | 327 | xapp.Logger.Debug("Endpoint: %v, xAppType: %v", endPoint.Name, endPoint.XAppType) |
| 328 | if endPoint.XAppType != sbi.PlatformType && (len(endPoint.TxMessages) > 0 || len(endPoint.RxMessages) > 0) { |
wahidw | cd7867c | 2020-02-05 10:01:12 +0000 | [diff] [blame] | 329 | r.generateXappRoutes(endPoint, subManEp, routeTable) |
| 330 | r.generateSubscriptionRoutes(endPoint, subManEp, routeTable) |
rangajal | 0baa70d | 2020-03-31 12:28:53 +0000 | [diff] [blame] | 331 | r.generateXappToXappRoutes(endPoint, endPointList, routeTable) |
| 332 | |
zkoczka | eb2ff0d | 2019-09-26 16:59:54 +0200 | [diff] [blame] | 333 | } |
| 334 | } |
| 335 | return routeTable |
kalnagy | 9216265 | 2019-07-02 15:15:49 +0200 | [diff] [blame] | 336 | } |