blob: a11baf82c734685512e14d9928b9186707d406e3 [file] [log] [blame]
Balint Uveges871fa392019-04-02 20:31:11 +00001/*
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.
wahidw761934a2019-11-27 06:07:26 +000017
18
19 This source code is part of the near-RT RIC (RAN Intelligent Controller)
20 platform project (RICP).
21
Balint Uveges871fa392019-04-02 20:31:11 +000022==================================================================================
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
30package rpe
31
32import (
33 "errors"
wahidwa8596ec2019-12-05 06:30:42 +000034 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
wahidw505e2492021-05-11 10:53:43 +000035 "routing-manager/pkg/models"
kalnagy92162652019-07-02 15:15:49 +020036 "routing-manager/pkg/rtmgr"
zkoczkaeb2ff0d2019-09-26 16:59:54 +020037 "routing-manager/pkg/sbi"
prabhukaliswamyb47d12d2019-12-03 15:06:30 +000038 "runtime"
wahidwa8596ec2019-12-05 06:30:42 +000039 "strconv"
Balint Uveges871fa392019-04-02 20:31:11 +000040)
41
42var (
zkoczkaaaf8d392019-10-02 17:16:06 +020043 SupportedRpes = []*EngineConfig{
44 {
kalnagy92162652019-07-02 15:15:49 +020045 Name: "rmrpush",
46 Version: "pubsush",
47 Protocol: "rmruta",
48 Instance: NewRmrPush(),
49 IsAvailable: true,
Balint Uveges871fa392019-04-02 20:31:11 +000050 },
51 }
52)
53
zkoczkaaaf8d392019-10-02 17:16:06 +020054func GetRpe(rpeName string) (Engine, error) {
Balint Uveges871fa392019-04-02 20:31:11 +000055 for _, rpe := range SupportedRpes {
kalnagy92162652019-07-02 15:15:49 +020056 if rpe.Name == rpeName && rpe.IsAvailable {
57 return rpe.Instance, nil
Balint Uveges871fa392019-04-02 20:31:11 +000058 }
59 }
Peter Szilagyi16d84d62019-04-24 14:51:02 +000060 return nil, errors.New("SBI:" + rpeName + " is not supported or still not a available")
Balint Uveges871fa392019-04-02 20:31:11 +000061}
62
kalnagy92162652019-07-02 15:15:49 +020063type Rpe struct {
64}
65
kalnagy92162652019-07-02 15:15:49 +020066func getEndpointByName(eps *rtmgr.Endpoints, name string) *rtmgr.Endpoint {
67 for _, ep := range *eps {
68 if ep.Name == name {
wahidwa8596ec2019-12-05 06:30:42 +000069 xapp.Logger.Debug("name: %s", ep.Name)
70 xapp.Logger.Debug("ep: %v", ep)
kalnagy92162652019-07-02 15:15:49 +020071 return ep
72 }
73 }
74 return nil
75}
76
rangajal749099b2019-12-10 09:37:08 +000077func getEndpointListByName(eps *rtmgr.Endpoints, name string) []rtmgr.Endpoint {
wahidwda0fd3a2020-01-01 04:28:41 +000078 var eplist []rtmgr.Endpoint
rangajal749099b2019-12-10 09:37:08 +000079
wahidwda0fd3a2020-01-01 04:28:41 +000080 for _, ep := range *eps {
81 if ep.Name == name {
82 xapp.Logger.Debug("name: %s", ep.Name)
83 xapp.Logger.Debug("ep: %v", ep)
84 eplist = append(eplist, *ep)
85 }
86 }
87 return eplist
rangajal749099b2019-12-10 09:37:08 +000088}
89
zkoczkaeb2ff0d2019-09-26 16:59:54 +020090func getEndpointByUuid(uuid string) *rtmgr.Endpoint {
91 endPoints := rtmgr.Eps
92 for _, ep := range endPoints {
kalnagy92162652019-07-02 15:15:49 +020093 if ep.Uuid == uuid {
wahidwa8596ec2019-12-05 06:30:42 +000094 xapp.Logger.Debug("name: %s", ep.Uuid)
95 xapp.Logger.Debug("ep: %v", ep)
kalnagy92162652019-07-02 15:15:49 +020096 return ep
97 }
98 }
99 return nil
100}
kalnagy92162652019-07-02 15:15:49 +0200101
rangajal749099b2019-12-10 09:37:08 +0000102func (r *Rpe) addRoute(messageType string, tx *rtmgr.Endpoint, rx *rtmgr.Endpoint, routeTable *rtmgr.RouteTable, subId int32, routeType string) {
103 txList := rtmgr.EndpointList{}
104 rxList := []rtmgr.EndpointList{}
105
106 if tx == nil && rx == nil {
wahidwda0fd3a2020-01-01 04:28:41 +0000107 pc, _, _, ok := runtime.Caller(1)
108 details := runtime.FuncForPC(pc)
109 if ok && details != nil {
110 xapp.Logger.Error("Route addition skipped: Either TX or RX endpoint not present. Caller function is %s", details.Name())
wahidwa8596ec2019-12-05 06:30:42 +0000111 }
wahidwa8596ec2019-12-05 06:30:42 +0000112 } else {
wahidwda0fd3a2020-01-01 04:28:41 +0000113 if tx != nil {
114 txList = rtmgr.EndpointList{*tx}
115 }
116 if rx != nil {
117 rxList = []rtmgr.EndpointList{[]rtmgr.Endpoint{*rx}}
118 }
wahidwbce67472020-06-15 13:52:55 +0000119 //messageId := strconv.Itoa(xapp.RICMessageTypes[messageType])
120 messageId := rtmgr.Mtype[messageType]
wahidwda0fd3a2020-01-01 04:28:41 +0000121 route := rtmgr.RouteTableEntry{
122 MessageType: messageId,
123 TxList: txList,
124 RxGroups: rxList,
125 SubID: subId,
126 RouteType: routeType}
127 *routeTable = append(*routeTable, route)
128 // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
129 // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
wahidwa8596ec2019-12-05 06:30:42 +0000130 }
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200131}
132
rangajal749099b2019-12-10 09:37:08 +0000133func (r *Rpe) addRoute_rx_list(messageType string, tx *rtmgr.Endpoint, rx []rtmgr.Endpoint, routeTable *rtmgr.RouteTable, subId int32, routeType string) {
134 txList := rtmgr.EndpointList{}
135 rxList := []rtmgr.EndpointList{}
136
wahidwda0fd3a2020-01-01 04:28:41 +0000137 if tx != nil {
138 txList = rtmgr.EndpointList{*tx}
rangajal749099b2019-12-10 09:37:08 +0000139 }
140
wahidwda0fd3a2020-01-01 04:28:41 +0000141 if rx != nil {
wahidw6977ffd2020-02-08 19:00:02 +0000142 for _, item := range rx {
143 ep := []rtmgr.Endpoint{item}
144 rxList = append(rxList, ep)
145 }
rangajal749099b2019-12-10 09:37:08 +0000146 }
147
wahidwbce67472020-06-15 13:52:55 +0000148 //messageId := strconv.Itoa(xapp.RICMessageTypes[messageType])
149 messageId := rtmgr.Mtype[messageType]
rangajal749099b2019-12-10 09:37:08 +0000150 route := rtmgr.RouteTableEntry{
wahidwda0fd3a2020-01-01 04:28:41 +0000151 MessageType: messageId,
152 TxList: txList,
153 RxGroups: rxList,
154 SubID: subId,
155 RouteType: routeType}
rangajal749099b2019-12-10 09:37:08 +0000156 *routeTable = append(*routeTable, route)
wahidwda0fd3a2020-01-01 04:28:41 +0000157 // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
158 // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
rangajal749099b2019-12-10 09:37:08 +0000159}
160
wahidwcd7867c2020-02-05 10:01:12 +0000161func (r *Rpe) generateXappRoutes(xAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
wahidwa8596ec2019-12-05 06:30:42 +0000162 xapp.Logger.Debug("rpe.generateXappRoutes invoked")
163 xapp.Logger.Debug("Endpoint: %v, xAppType: %v", xAppEp.Name, xAppEp.XAppType)
164 if xAppEp.XAppType != sbi.PlatformType && (len(xAppEp.TxMessages) > 0 || len(xAppEp.RxMessages) > 0) {
wahidwda0fd3a2020-01-01 04:28:41 +0000165 /// TODO ---
zkoczkaaaf8d392019-10-02 17:16:06 +0200166 //xApp -> Subscription Manager
rangajal749099b2019-12-10 09:37:08 +0000167 r.addRoute("RIC_SUB_REQ", xAppEp, subManEp, routeTable, -1, "")
168 r.addRoute("RIC_SUB_DEL_REQ", xAppEp, subManEp, routeTable, -1, "")
zkoczkaaaf8d392019-10-02 17:16:06 +0200169 //xApp -> E2 Termination
wahidwda0fd3a2020-01-01 04:28:41 +0000170 // r.addRoute("RIC_CONTROL_REQ", xAppEp, e2TermEp, routeTable, -1, "")
prabhukaliswamye110ee02019-12-23 09:51:01 +0000171 r.addRoute("RIC_CONTROL_REQ", xAppEp, nil, routeTable, -1, "%meid")
zkoczkab95b0762019-10-29 13:05:48 +0100172 //E2 Termination -> xApp
wahidwda0fd3a2020-01-01 04:28:41 +0000173 /// r.addRoute("RIC_CONTROL_ACK", e2TermEp, xAppEp, routeTable, -1, "")
174 /// r.addRoute("RIC_CONTROL_FAILURE", e2TermEp, xAppEp, routeTable, -1, "")
prabhukaliswamye110ee02019-12-23 09:51:01 +0000175 r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, -1, "")
176 r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, -1, "")
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200177 }
wahidwa8596ec2019-12-05 06:30:42 +0000178 //xApp->A1Mediator
179 if xAppEp.XAppType != sbi.PlatformType && len(xAppEp.Policies) > 0 {
180 xapp.Logger.Debug("rpe.generateXappRoutes found policies section")
181 for _, policy := range xAppEp.Policies {
rangajal749099b2019-12-10 09:37:08 +0000182 r.addRoute("A1_POLICY_REQ", nil, xAppEp, routeTable, policy, "")
wahidwa8596ec2019-12-05 06:30:42 +0000183 }
184 }
185
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200186}
187
rangajal0baa70d2020-03-31 12:28:53 +0000188func (r *Rpe) generateXappToXappRoutes(RecvxAppEp *rtmgr.Endpoint, endPointList rtmgr.Endpoints, routeTable *rtmgr.RouteTable) {
189 xapp.Logger.Debug("rpe.generateXappToXappRoutes invoked")
190
191 for _, rxmsg := range RecvxAppEp.RxMessages {
192
193 var src_present bool
wahidwbceb7d42020-10-20 16:21:52 +0000194 identicalMsg := false
195 var RxGrp []rtmgr.Endpoint
rangajal0baa70d2020-03-31 12:28:53 +0000196 xapp.Logger.Debug("RecvxAppEp.RxMessages Endpoint: %v, xAppType: %v and rxmsg: %v ", RecvxAppEp.Name, RecvxAppEp.XAppType, rxmsg)
wahidwbceb7d42020-10-20 16:21:52 +0000197 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" {
rangajal0baa70d2020-03-31 12:28:53 +0000198 for _, SrcxAppEp := range endPointList {
199 if SrcxAppEp.XAppType != sbi.PlatformType && (len(SrcxAppEp.TxMessages) > 0) && SrcxAppEp.Name != RecvxAppEp.Name {
200 for _, txmsg := range SrcxAppEp.TxMessages {
wahidwbceb7d42020-10-20 16:21:52 +0000201 if rxmsg == txmsg {
202 r.addRoute(rxmsg, SrcxAppEp, RecvxAppEp, routeTable, -1, "")
203 src_present = true
204 break
205 }
rangajal0baa70d2020-03-31 12:28:53 +0000206 }
207 }
208 }
wahidwbceb7d42020-10-20 16:21:52 +0000209 for _, SrcxAppEp := range endPointList {
210
211 if SrcxAppEp.XAppType != sbi.PlatformType && (len(SrcxAppEp.RxMessages) > 0) && SrcxAppEp.Name != RecvxAppEp.Name {
212 for _, newrxmsg := range SrcxAppEp.RxMessages {
213 if newrxmsg == rxmsg {
214 RxGrp = append(RxGrp, *SrcxAppEp)
215 identicalMsg = true
216 }
217 }
218 }
219 }
220 if src_present == false && identicalMsg == false {
221 xapp.Logger.Debug("Message type %v,for SrcxAppEp.Name %v", rxmsg, RecvxAppEp)
rangajal0baa70d2020-03-31 12:28:53 +0000222 r.addRoute(rxmsg, nil, RecvxAppEp, routeTable, -1, "")
223 }
wahidwbceb7d42020-10-20 16:21:52 +0000224 if identicalMsg == true {
225 xapp.Logger.Debug("Appending Message type %v,for SrcxAppEp.Name %v", rxmsg, RecvxAppEp)
226 RxGrp = append(RxGrp, *RecvxAppEp)
227 r.addRoute_rx_list(rxmsg, nil, RxGrp, routeTable, -1, "")
wahidweac05602020-11-11 08:43:37 +0000228 //return
wahidwbceb7d42020-10-20 16:21:52 +0000229 }
rangajal0baa70d2020-03-31 12:28:53 +0000230 }
rangajal0baa70d2020-03-31 12:28:53 +0000231 }
232}
233
wahidwcd7867c2020-02-05 10:01:12 +0000234func (r *Rpe) generateSubscriptionRoutes(selectedxAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
wahidwa8596ec2019-12-05 06:30:42 +0000235 xapp.Logger.Debug("rpe.addSubscriptionRoutes invoked")
zkoczkaaaf8d392019-10-02 17:16:06 +0200236 subscriptionList := &rtmgr.Subs
237 for _, subscription := range *subscriptionList {
wahidwa8596ec2019-12-05 06:30:42 +0000238 xapp.Logger.Debug("Subscription: %v", subscription)
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200239 xAppUuid := subscription.Fqdn + ":" + strconv.Itoa(int(subscription.Port))
wahidwa8596ec2019-12-05 06:30:42 +0000240 xapp.Logger.Debug("xApp UUID: %v", xAppUuid)
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200241 xAppEp := getEndpointByUuid(xAppUuid)
rangajald14518e2020-04-21 12:33:37 +0000242 if xAppEp != nil {
243 if xAppEp.Uuid == selectedxAppEp.Uuid {
244 xapp.Logger.Debug("xApp UUID is matched for selected xApp.UUID: %v and xApp.Name: %v", selectedxAppEp.Uuid, selectedxAppEp.Name)
245 /// TODO
246 //Subscription Manager -> xApp
247 r.addRoute("RIC_SUB_RESP", subManEp, xAppEp, routeTable, subscription.SubID, "")
248 r.addRoute("RIC_SUB_FAILURE", subManEp, xAppEp, routeTable, subscription.SubID, "")
249 r.addRoute("RIC_SUB_DEL_RESP", subManEp, xAppEp, routeTable, subscription.SubID, "")
250 r.addRoute("RIC_SUB_DEL_FAILURE", subManEp, xAppEp, routeTable, subscription.SubID, "")
251 //E2 Termination -> xApp
252 r.addRoute("RIC_INDICATION", nil, xAppEp, routeTable, subscription.SubID, "")
253 r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, subscription.SubID, "")
254 r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, subscription.SubID, "")
255 }
256 } else {
wahidwbceb7d42020-10-20 16:21:52 +0000257 xapp.Logger.Error("generateSubscriptionRoutes xAppEp is nil, xApp UUID: %v", xAppUuid)
prabhukaliswamyb47d12d2019-12-03 15:06:30 +0000258 }
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200259 }
260}
261
wahidw505e2492021-05-11 10:53:43 +0000262func (r *Rpe) generatePartialSubscriptionTable(xappSubData *models.XappSubscriptionData, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
263 xapp.Logger.Debug("rpe.addSingleSubscriptionRoutes invoked")
264 xAppUuid := *xappSubData.Address + ":" + strconv.Itoa(int(*xappSubData.Port))
265 xapp.Logger.Debug("xApp UUID: %v", xAppUuid)
266 xAppEp := getEndpointByUuid(xAppUuid)
267 if xAppEp != nil {
268 //Subscription Manager -> xApp
269 r.addRoute("RIC_SUB_RESP", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
270 r.addRoute("RIC_SUB_FAILURE", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
271 r.addRoute("RIC_SUB_DEL_RESP", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
272 r.addRoute("RIC_SUB_DEL_FAILURE", subManEp, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
273 //E2 Termination -> xApp
274 r.addRoute("RIC_INDICATION", nil, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
275 r.addRoute("RIC_CONTROL_ACK", nil, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
276 r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, *xappSubData.SubscriptionID, "")
277 } else {
278 xapp.Logger.Error("generateSubscriptionRoutes xAppEp is nil, xApp UUID: %v", xAppUuid)
279 }
280}
281
282func (r *Rpe) generatePlatformRoutes(e2TermEp []rtmgr.Endpoint, subManEp *rtmgr.Endpoint, e2ManEp *rtmgr.Endpoint, a1mediatorEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
wahidwa8596ec2019-12-05 06:30:42 +0000283 xapp.Logger.Debug("rpe.generatePlatformRoutes invoked")
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200284 //Platform Routes --- Subscription Routes
285 //Subscription Manager -> E2 Termination
wahidw8f7ca652020-07-08 18:59:53 +0530286 if rtmgr.PrsCfg == nil {
287 xapp.Logger.Info("No static routes configuration")
288 return
289 }
wahidwda0fd3a2020-01-01 04:28:41 +0000290 for _, routes := range *rtmgr.PrsCfg {
291 var sendEp *rtmgr.Endpoint
292 var Ep *rtmgr.Endpoint
293 switch routes.SenderEndPoint {
294 case "SUBMAN":
295 sendEp = subManEp
296 case "E2MAN":
297 sendEp = e2ManEp
wahidw505e2492021-05-11 10:53:43 +0000298 //case "RSM":,
299 // sendEp = rsmEp
wahidwda0fd3a2020-01-01 04:28:41 +0000300 case "A1MEDIATOR":
301 sendEp = a1mediatorEp
302 }
303 switch routes.EndPoint {
304 case "SUBMAN":
305 Ep = subManEp
306 case "E2MAN":
307 Ep = e2ManEp
wahidwcd7867c2020-02-05 10:01:12 +0000308 //case "UEMAN":
309 // Ep = ueManEp
wahidw505e2492021-05-11 10:53:43 +0000310 //case "RSM":
311 // Ep = rsmEp
wahidwda0fd3a2020-01-01 04:28:41 +0000312 case "A1MEDIATOR":
313 Ep = a1mediatorEp
314 }
rangajal6d209042020-01-08 12:18:39 +0000315
wahidwda0fd3a2020-01-01 04:28:41 +0000316 r.addRoute(routes.MessageType, sendEp, Ep, routeTable, routes.SubscriptionId, routes.Meid)
317 }
rangajal6d209042020-01-08 12:18:39 +0000318
319 if len(e2TermEp) > 0 {
320 r.addRoute_rx_list("RIC_SCTP_CLEAR_ALL", e2ManEp, e2TermEp, routeTable, -1, "")
321 r.addRoute_rx_list("E2_TERM_KEEP_ALIVE_REQ", e2ManEp, e2TermEp, routeTable, -1, "")
wahidwdd6b0562020-03-31 03:09:45 +0000322 r.addRoute_rx_list("RIC_E2_SETUP_RESP", e2ManEp, e2TermEp, routeTable, -1, "")
323 r.addRoute_rx_list("RIC_E2_SETUP_FAILURE", e2ManEp, e2TermEp, routeTable, -1, "")
rangajal6d209042020-01-08 12:18:39 +0000324 }
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200325}
326
wahidw505e2492021-05-11 10:53:43 +0000327func (r *Rpe) generatePartialRouteTable(endPointList rtmgr.Endpoints, xappSubData *models.XappSubscriptionData, updatetype rtmgr.RMRUpdateType) *rtmgr.RouteTable {
328 xapp.Logger.Debug("rpe.generatePartialRouteTable invoked")
329 xapp.Logger.Debug("Endpoint List: %v", endPointList)
330 routeTable := &rtmgr.RouteTable{}
331 subManEp := getEndpointByName(&endPointList, "SUBMAN")
332 if subManEp == nil {
333 xapp.Logger.Error("Platform component not found: %v", "Subscription Manager")
334 xapp.Logger.Debug("Endpoints: %v", endPointList)
335 }
336 /*e2TermListEp := getEndpointListByName(&endPointList, "E2TERMINST")
337 if len(e2TermListEp) == 0 {
338 xapp.Logger.Error("Platform component not found: %v", "E2 Termination List")
339 xapp.Logger.Debug("Endpoints: %v", endPointList)
340 }
341 e2ManEp := getEndpointByName(&endPointList, "E2MAN")
342 if e2ManEp == nil {
343 xapp.Logger.Error("Platform component not found: %v", "E2 Manager")
344 xapp.Logger.Debug("Endpoints: %v", endPointList)
345 }*/
346
347 if xappSubData != nil && updatetype == rtmgr.SubsType {
348 xapp.Logger.Info("Updating partial subscription routes")
349 r.generatePartialSubscriptionTable(xappSubData, subManEp, routeTable)
350 }
351 /*if updatetype == rtmgr.XappType {
352 xapp.Logger.Info("Updating partial xapp routes")
353 for _, endPoint := range endPointList {
354 xapp.Logger.Debug("Endpoint: %v, xAppType: %v", endPoint.Name, endPoint.XAppType)
355 if endPoint.XAppType != sbi.PlatformType && (len(endPoint.TxMessages) > 0 || len(endPoint.RxMessages) > 0) {
356 r.generateXappRoutes(endPoint, subManEp, routeTable)
357 r.generateXappToXappRoutes(endPoint, endPointList, routeTable)
358 }
359 }
360 }
361 if updatetype == rtmgr.E2Type {
362 xapp.Logger.Info("Updating partial E2 routes")
363 if len(e2TermListEp) > 0 {
364 r.addRoute_rx_list("RIC_SCTP_CLEAR_ALL", e2ManEp, e2TermListEp, routeTable, -1, "")
365 r.addRoute_rx_list("E2_TERM_KEEP_ALIVE_REQ", e2ManEp, e2TermListEp, routeTable, -1, "")
366 r.addRoute_rx_list("RIC_E2_SETUP_RESP", e2ManEp, e2TermListEp, routeTable, -1, "")
367 r.addRoute_rx_list("RIC_E2_SETUP_FAILURE", e2ManEp, e2TermListEp, routeTable, -1, "")
368 }
369 }*/
370
371 return routeTable
372
373}
374
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200375func (r *Rpe) generateRouteTable(endPointList rtmgr.Endpoints) *rtmgr.RouteTable {
wahidwa8596ec2019-12-05 06:30:42 +0000376 xapp.Logger.Debug("rpe.generateRouteTable invoked")
377 xapp.Logger.Debug("Endpoint List: %v", endPointList)
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200378 routeTable := &rtmgr.RouteTable{}
wahidwcd7867c2020-02-05 10:01:12 +0000379 /*e2TermEp := getEndpointByName(&endPointList, "E2TERM")
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200380 if e2TermEp == nil {
wahidwa8596ec2019-12-05 06:30:42 +0000381 xapp.Logger.Error("Platform component not found: %v", "E2 Termination")
382 xapp.Logger.Debug("Endpoints: %v", endPointList)
wahidwcd7867c2020-02-05 10:01:12 +0000383 }*/
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200384 subManEp := getEndpointByName(&endPointList, "SUBMAN")
385 if subManEp == nil {
wahidwa8596ec2019-12-05 06:30:42 +0000386 xapp.Logger.Error("Platform component not found: %v", "Subscription Manager")
387 xapp.Logger.Debug("Endpoints: %v", endPointList)
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200388 }
389 e2ManEp := getEndpointByName(&endPointList, "E2MAN")
390 if e2ManEp == nil {
wahidwa8596ec2019-12-05 06:30:42 +0000391 xapp.Logger.Error("Platform component not found: %v", "E2 Manager")
392 xapp.Logger.Debug("Endpoints: %v", endPointList)
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200393 }
wahidw505e2492021-05-11 10:53:43 +0000394 /*rsmEp := getEndpointByName(&endPointList, "RSM")
prabhukaliswamybe9f2682019-11-22 07:24:09 +0000395 if rsmEp == nil {
wahidwa8596ec2019-12-05 06:30:42 +0000396 xapp.Logger.Error("Platform component not found: %v", "Resource Status Manager")
397 xapp.Logger.Debug("Endpoints: %v", endPointList)
wahidw505e2492021-05-11 10:53:43 +0000398 }*/
wahidwa8596ec2019-12-05 06:30:42 +0000399 A1MediatorEp := getEndpointByName(&endPointList, "A1MEDIATOR")
400 if A1MediatorEp == nil {
401 xapp.Logger.Error("Platform component not found: %v", "A1Mediator")
402 xapp.Logger.Debug("Endpoints: %v", endPointList)
403 }
404
rangajal749099b2019-12-10 09:37:08 +0000405 e2TermListEp := getEndpointListByName(&endPointList, "E2TERMINST")
406 if len(e2TermListEp) == 0 {
407 xapp.Logger.Error("Platform component not found: %v", "E2 Termination List")
408 xapp.Logger.Debug("Endpoints: %v", endPointList)
409 }
wahidw505e2492021-05-11 10:53:43 +0000410 r.generatePlatformRoutes(e2TermListEp, subManEp, e2ManEp, A1MediatorEp, routeTable)
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200411
412 for _, endPoint := range endPointList {
wahidwa8596ec2019-12-05 06:30:42 +0000413 xapp.Logger.Debug("Endpoint: %v, xAppType: %v", endPoint.Name, endPoint.XAppType)
414 if endPoint.XAppType != sbi.PlatformType && (len(endPoint.TxMessages) > 0 || len(endPoint.RxMessages) > 0) {
wahidwcd7867c2020-02-05 10:01:12 +0000415 r.generateXappRoutes(endPoint, subManEp, routeTable)
416 r.generateSubscriptionRoutes(endPoint, subManEp, routeTable)
rangajal0baa70d2020-03-31 12:28:53 +0000417 r.generateXappToXappRoutes(endPoint, endPointList, routeTable)
418
zkoczkaeb2ff0d2019-09-26 16:59:54 +0200419 }
420 }
421 return routeTable
kalnagy92162652019-07-02 15:15:49 +0200422}