X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frpe%2Frmr.go;h=346644c11cd47172a09586511921010c54fcb7eb;hb=dd6b05676beaff9d6252c3486cf8fb77748d37f8;hp=ca16772dbe8ea3b041a1bc135405100c0e5c3cac;hpb=16d84d6f7d3489e65e0a83ba9c0d5d62c3914c7f;p=ric-plt%2Frtmgr.git diff --git a/pkg/rpe/rmr.go b/pkg/rpe/rmr.go index ca16772..346644c 100644 --- a/pkg/rpe/rmr.go +++ b/pkg/rpe/rmr.go @@ -14,6 +14,11 @@ 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). + ================================================================================== */ /* @@ -26,24 +31,37 @@ package rpe import ( - "rtmgr" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" + "routing-manager/pkg/rtmgr" "strconv" + //"strings" ) +type Rmr struct { + Rpe +} + +type RmrPush struct { + Rmr +} + +func NewRmrPush() *RmrPush { + instance := new(RmrPush) + return instance +} + /* Produces the raw route message consumable by RMR */ -func generateRMRPolicies(eps rtmgr.Endpoints, key string) *[]string { - rtmgr.Logger.Debug("Invoked rmr.generateRMRPolicies") - rtmgr.Logger.Debug("args: %v", eps) +func (r *Rmr) generateRMRPolicies(eps rtmgr.Endpoints, rcs *rtmgr.RicComponents, key string) *[]string { rawrt := []string{key + "newrt|start\n"} - rt := getRouteTable(eps) + rt := r.generateRouteTable(eps) for _, rte := range *rt { - rawrte := key + "rte|" + rte.MessageType + rawrte := key + "mse|" + rte.MessageType for _, tx := range rte.TxList { rawrte += "," + tx.Ip + ":" + strconv.Itoa(int(tx.Port)) } - rawrte += "|" + rawrte += "|" + strconv.Itoa(int(rte.SubID)) + "|" group := "" for _, rxg := range rte.RxGroups { member := "" @@ -61,17 +79,34 @@ func generateRMRPolicies(eps rtmgr.Endpoints, key string) *[]string { } } rawrte += group + + if (rte.RouteType == "%meid") { + rawrte += group + rte.RouteType + } + rawrt = append(rawrt, rawrte+"\n") } rawrt = append(rawrt, key+"newrt|end\n") - rtmgr.Logger.Debug("rmr.generateRMRPolicies returns: %v", rawrt) + count := 0 + + meidrt := key +"meid_map|start\n" + for _, value := range rcs.MeidMap { + meidrt += key + value + "\n" + count++ + } + meidrt += key+"meid_map|end|" + strconv.Itoa(count) +"\n" + + rawrt = append(rawrt, meidrt) + xapp.Logger.Debug("rmr.GeneratePolicies returns: %v", rawrt) + xapp.Logger.Debug("rmr.GeneratePolicies returns: %v", rcs) return &rawrt } -func generateRMRPubPolicies(eps rtmgr.Endpoints) *[]string { - return generateRMRPolicies(eps, "00000 ") +func (r *RmrPush) GeneratePolicies(eps rtmgr.Endpoints, rcs *rtmgr.RicComponents) *[]string { + xapp.Logger.Debug("Invoked rmr.GeneratePolicies, args: %v: ", eps) + return r.generateRMRPolicies(eps, rcs, "") } -func generateRMRPushPolicies(eps rtmgr.Endpoints) *[]string { - return generateRMRPolicies(eps, "") +func (r *RmrPush) GenerateRouteTable(eps rtmgr.Endpoints) *rtmgr.RouteTable { + return r.generateRouteTable(eps) }