2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
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
10 http://www.apache.org/licenses/LICENSE-2.0
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.
19 This source code is part of the near-RT RIC (RAN Intelligent Controller)
20 platform project (RICP).
22 ==================================================================================
26 Abstract: RMR Route Policy implementation
27 Produces RMR (RIC Management Routing) formatted route messages
34 "routing-manager/pkg/rtmgr"
46 func NewRmrPush() *RmrPush {
47 instance := new(RmrPush)
52 Produces the raw route message consumable by RMR
54 func (r *Rmr) generateRMRPolicies(eps rtmgr.Endpoints, key string) *[]string {
55 rawrt := []string{key + "newrt|start\n"}
56 rt := r.generateRouteTable(eps)
57 for _, rte := range *rt {
58 rawrte := key + "mse|" + rte.MessageType
59 for _, tx := range rte.TxList {
60 rawrte += "," + tx.Ip + ":" + strconv.Itoa(int(tx.Port))
62 rawrte += "|" + strconv.Itoa(int(rte.SubID)) + "|"
64 for _, rxg := range rte.RxGroups {
66 for _, rx := range rxg {
68 member += rx.Ip + ":" + strconv.Itoa(int(rx.Port))
70 member += "," + rx.Ip + ":" + strconv.Itoa(int(rx.Port))
80 rawrt = append(rawrt, rawrte+"\n")
82 rawrt = append(rawrt, key+"newrt|end\n")
83 rtmgr.Logger.Debug("rmr.GeneratePolicies returns: %v", rawrt)
87 func (r *RmrPush) GeneratePolicies(eps rtmgr.Endpoints) *[]string {
88 rtmgr.Logger.Debug("Invoked rmr.GeneratePolicies, args: %v: ", eps)
89 return r.generateRMRPolicies(eps, "")
92 func (r *RmrPush) GenerateRouteTable(eps rtmgr.Endpoints) *rtmgr.RouteTable {
93 return r.generateRouteTable(eps)