Appending Receiver endpoint in routes if RX message type is same 69/4869/2
authorwahidw <abdulwahid.w@nokia.com>
Tue, 20 Oct 2020 16:21:52 +0000 (16:21 +0000)
committerwahidw <abdulwahid.w@nokia.com>
Tue, 20 Oct 2020 16:43:35 +0000 (16:43 +0000)
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
Change-Id: I51c6f9b2be95c1bc3a3b6ebca602c611b3d8e33f

RELNOTES
cmd/rtmgr.go
container-tag.yaml
pkg/rpe/rpe.go

index 8a1ed82..96deaaa 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,6 @@
+### v0.6.8
+* Appending Receiver endpoint in routes if RX message type is same
+
 ### v0.6.7
 * Publish Route only once to the endpoint that requests it. Periodic/Event based distribution will be done only for the process with RMR Control Port 4561.
 
index af0aba1..1234622 100644 (file)
@@ -68,17 +68,17 @@ func main() {
        rtmgr.Mtype = make(rtmgr.MessageTypeList)
        rtmgr.Rtmgr_ready = false
 
-// RMR thread is starting port: 4560
+       // RMR thread is starting port: 4560
        c := nbi.NewControl()
        go c.Run()
 
-// Waiting for RMR to be ready
+       // Waiting for RMR to be ready
        time.Sleep(time.Duration(2) * time.Second)
        for xapp.Rmr.IsReady() == false {
-               time.Sleep(time.Duration(2) * time.Second)
+               time.Sleep(time.Duration(2) * time.Second)
        }
 
-       dummy_whid := int(xapp.Rmr.Openwh("localhost:4560"))
+       dummy_whid := int(xapp.Rmr.Openwh("rtmgr:4560"))
        xapp.Logger.Info("created dummy Wormhole ID for routingmanager and dummy_whid :%d", dummy_whid)
 
        nbi.Serve()
index 041cba7..5bb3ab8 100644 (file)
@@ -2,4 +2,4 @@
 # By default this file is in the docker build directory,
 # but the location can configured in the JJB template.
 ---
-tag: 0.6.7
+tag: 0.6.8
index 4097ae0..3a3eac1 100644 (file)
@@ -184,31 +184,49 @@ func (r *Rpe) generateXappRoutes(xAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoin
 
 }
 
-
 func (r *Rpe) generateXappToXappRoutes(RecvxAppEp *rtmgr.Endpoint, endPointList rtmgr.Endpoints, routeTable *rtmgr.RouteTable) {
        xapp.Logger.Debug("rpe.generateXappToXappRoutes invoked")
 
        for _, rxmsg := range RecvxAppEp.RxMessages {
 
                var src_present bool
+               identicalMsg := false
+               var RxGrp []rtmgr.Endpoint
                xapp.Logger.Debug("RecvxAppEp.RxMessages Endpoint: %v, xAppType: %v and rxmsg: %v ", RecvxAppEp.Name, RecvxAppEp.XAppType, rxmsg)
-               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") {
+               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" {
                        for _, SrcxAppEp := range endPointList {
                                if SrcxAppEp.XAppType != sbi.PlatformType && (len(SrcxAppEp.TxMessages) > 0) && SrcxAppEp.Name != RecvxAppEp.Name {
                                        for _, txmsg := range SrcxAppEp.TxMessages {
-                                                       if (rxmsg == txmsg) {
-                                                               r.addRoute(rxmsg, SrcxAppEp, RecvxAppEp, routeTable, -1, "")
-                                                               src_present = true
-                                                               break
-                                                       }
+                                               if rxmsg == txmsg {
+                                                       r.addRoute(rxmsg, SrcxAppEp, RecvxAppEp, routeTable, -1, "")
+                                                       src_present = true
+                                                       break
+                                               }
+                                       }
+                               }
+                       }
+                       for _, SrcxAppEp := range endPointList {
+
+                               if SrcxAppEp.XAppType != sbi.PlatformType && (len(SrcxAppEp.RxMessages) > 0) && SrcxAppEp.Name != RecvxAppEp.Name {
+                                       for _, newrxmsg := range SrcxAppEp.RxMessages {
+                                               if newrxmsg == rxmsg {
+                                                       RxGrp = append(RxGrp, *SrcxAppEp)
+                                                       identicalMsg = true
+                                               }
                                        }
                                }
                        }
-                       if src_present == false {
+                       if src_present == false && identicalMsg == false {
+                               xapp.Logger.Debug("Message type %v,for SrcxAppEp.Name %v", rxmsg, RecvxAppEp)
                                r.addRoute(rxmsg, nil, RecvxAppEp, routeTable, -1, "")
                        }
+                       if identicalMsg == true {
+                               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
+                       }
                }
-
        }
 }
 
@@ -235,7 +253,7 @@ func (r *Rpe) generateSubscriptionRoutes(selectedxAppEp *rtmgr.Endpoint, subManE
                                r.addRoute("RIC_CONTROL_FAILURE", nil, xAppEp, routeTable, subscription.SubID, "")
                        }
                } else {
-                               xapp.Logger.Error("generateSubscriptionRoutes xAppEp is nil, xApp UUID: %v", xAppUuid)
+                       xapp.Logger.Error("generateSubscriptionRoutes xAppEp is nil, xApp UUID: %v", xAppUuid)
                }
        }
 }