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.
17 ==================================================================================
21 Abstract: Contains RPE (Route Policy Engine) module definitions and generic RPE components
34 SupportedRpes = []*RpeEngineConfig{
41 generatePolicies(generateRMRPubPolicies),
50 generatePolicies(generateRMRPushPolicies),
58 for _, rpe := range SupportedRpes {
60 rtmgr.Logger.Info(rpe.Engine.Name + "/" + rpe.Engine.Version)
65 func GetRpe(rpeName string) (*RpeEngineConfig, error) {
66 for _, rpe := range SupportedRpes {
67 if rpe.Engine.Name == rpeName && rpe.IsAvailable {
71 return nil, errors.New("SBI:" + rpeName + " is not supported or still not a available")
75 Gets the raw xApp list and generates the list of sender endpoints and receiver endpoint groups
76 Returns the Tx EndpointList map where the key is the messge type and also returns the nested map of Rx EndpointList's map where keys are message type and xapp type
77 Endpoint object's message type already transcoded to integer id
80 func getRouteRxTxLists(eps rtmgr.Endpoints) (*map[string]rtmgr.EndpointList, *map[string]map[string]rtmgr.EndpointList) {
81 txlist := make(map[string]rtmgr.EndpointList)
82 rxgroups := make(map[string]map[string]rtmgr.EndpointList)
83 for _, ep := range eps {
84 for _, message := range ep.RxMessages {
85 messageid := rtmgr.MESSAGETYPES[message]
86 if _, ok := rxgroups[messageid]; !ok {
87 rxgroups[messageid] = make(map[string]rtmgr.EndpointList)
89 rxgroups[messageid][ep.XAppType] = append(rxgroups[messageid][ep.XAppType], (*ep))
91 for _, message := range ep.TxMessages {
92 messageid := rtmgr.MESSAGETYPES[message]
93 txlist[messageid] = append(txlist[messageid], (*ep))
96 return &txlist, &rxgroups
100 Gets the raw xapp list and creates a route table for
101 Returns the array of route table entries
103 func getRouteTable(eps rtmgr.Endpoints) *rtmgr.RouteTable {
104 tx, rx := getRouteRxTxLists(eps)
105 var rt rtmgr.RouteTable
106 for _, messagetype := range rtmgr.MESSAGETYPES {
107 if _, ok := (*tx)[messagetype]; !ok {
110 if _, ok := (*rx)[messagetype]; !ok {
113 var rxgroups []rtmgr.EndpointList
114 for _, endpointlist := range (*rx)[messagetype] {
115 rxgroups = append(rxgroups, endpointlist)
117 rte := rtmgr.RouteTableEntry{